add trezor safe 3 support (hwi update still required)

This commit is contained in:
Craig Raw 2024-01-30 09:37:00 +02:00
parent 55d5a97d99
commit 1ba501f5c8
4 changed files with 5 additions and 4 deletions

2
drongo

@ -1 +1 @@
Subproject commit 4279884591d1d7e0f957c8834a7bc26b4b0b0d94 Subproject commit d255913654b29a33c772dead9b66721c70fe7950

View file

@ -27,7 +27,8 @@ public class UsbStatusButton extends MenuButton {
public void setDevices(List<Device> devices) { public void setDevices(List<Device> devices) {
for(Device device : devices) { for(Device device : devices) {
MenuItem deviceItem = new MenuItem(device.getModel().toDisplayString()); MenuItem deviceItem = new MenuItem(device.getModel().toDisplayString());
if(!device.isNeedsPinSent() && (device.getModel() == WalletModel.TREZOR_1 || device.getModel() == WalletModel.TREZOR_T || device.getModel() == WalletModel.KEEPKEY || device.getModel() == WalletModel.BITBOX_02)) { if(!device.isNeedsPinSent() && (device.getModel() == WalletModel.TREZOR_1 || device.getModel() == WalletModel.TREZOR_T ||
device.getModel() == WalletModel.TREZOR_SAFE_3 || device.getModel() == WalletModel.KEEPKEY || device.getModel() == WalletModel.BITBOX_02)) {
deviceItem = new Menu(device.getModel().toDisplayString()); deviceItem = new Menu(device.getModel().toDisplayString());
MenuItem toggleItem = new MenuItem("Toggle Passphrase" + (!device.getModel().externalPassphraseEntry() ? "" : (device.isNeedsPassphraseSent() ? " Off" : " On"))); MenuItem toggleItem = new MenuItem("Toggle Passphrase" + (!device.getModel().externalPassphraseEntry() ? "" : (device.isNeedsPassphraseSent() ? " Off" : " On")));
toggleItem.setOnAction(event -> { toggleItem.setOnAction(event -> {

View file

@ -836,7 +836,7 @@ public class Hwi {
public WalletModel deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { public WalletModel deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
String modelStr = json.getAsJsonPrimitive().getAsString(); String modelStr = json.getAsJsonPrimitive().getAsString();
try { try {
return WalletModel.valueOf(modelStr.toUpperCase(Locale.ROOT)); return WalletModel.valueOf(modelStr.toUpperCase(Locale.ROOT).replace(' ', '_'));
} catch(Exception e) { } catch(Exception e) {
for(WalletModel model : WalletModel.values()) { for(WalletModel model : WalletModel.values()) {
if(modelStr.startsWith(model.getType())) { if(modelStr.startsWith(model.getType())) {

View file

@ -108,7 +108,7 @@ public class SpecterDesktop implements WalletImport, WalletExport {
WalletModel walletModel = device.getWalletModel(); WalletModel walletModel = device.getWalletModel();
if(walletModel != null) { if(walletModel != null) {
keystore.setWalletModel(walletModel); keystore.setWalletModel(walletModel);
if(walletModel == WalletModel.TREZOR_1 || walletModel == WalletModel.TREZOR_T || walletModel == WalletModel.KEEPKEY || if(walletModel == WalletModel.TREZOR_1 || walletModel == WalletModel.TREZOR_T || walletModel == WalletModel.TREZOR_SAFE_3 || walletModel == WalletModel.KEEPKEY ||
walletModel == WalletModel.LEDGER_NANO_S || walletModel == WalletModel.LEDGER_NANO_X || walletModel == WalletModel.LEDGER_NANO_S_PLUS || walletModel == WalletModel.LEDGER_NANO_S || walletModel == WalletModel.LEDGER_NANO_X || walletModel == WalletModel.LEDGER_NANO_S_PLUS ||
walletModel == WalletModel.BITBOX_02 || walletModel == WalletModel.COLDCARD) { walletModel == WalletModel.BITBOX_02 || walletModel == WalletModel.COLDCARD) {
keystore.setSource(KeystoreSource.HW_USB); keystore.setSource(KeystoreSource.HW_USB);