mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
rename gordian seed tool, support retrieving a keystore from a scanned crypto-output
This commit is contained in:
parent
eb1087bf8d
commit
bbdfec127a
6 changed files with 20 additions and 20 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
||||||
Subproject commit c1f6a1245e4632deb19af64faaa6ffaaca475313
|
Subproject commit 083288061ffe6e08805bb58108a9afab0d93fb0f
|
|
@ -160,6 +160,13 @@ public abstract class FileImportPane extends TitledDescriptionPane {
|
||||||
} catch(ImportException e) {
|
} catch(ImportException e) {
|
||||||
setError("Import Error", e.getMessage());
|
setError("Import Error", e.getMessage());
|
||||||
}
|
}
|
||||||
|
} else if(result.outputDescriptor != null) {
|
||||||
|
wallets = List.of(result.outputDescriptor.toKeystoreWallet(null));
|
||||||
|
try {
|
||||||
|
importFile(importer.getName(), null, null);
|
||||||
|
} catch(ImportException e) {
|
||||||
|
setError("Import Error", e.getMessage());
|
||||||
|
}
|
||||||
} else if(result.payload != null) {
|
} else if(result.payload != null) {
|
||||||
try {
|
try {
|
||||||
importFile(importer.getName(), new ByteArrayInputStream(result.payload.getBytes(StandardCharsets.UTF_8)), null);
|
importFile(importer.getName(), new ByteArrayInputStream(result.payload.getBytes(StandardCharsets.UTF_8)), null);
|
||||||
|
@ -177,6 +184,9 @@ public abstract class FileImportPane extends TitledDescriptionPane {
|
||||||
} else if(result.exception != null) {
|
} else if(result.exception != null) {
|
||||||
log.error("Error importing QR", result.exception);
|
log.error("Error importing QR", result.exception);
|
||||||
setError("Import Error", result.exception.getMessage());
|
setError("Import Error", result.exception.getMessage());
|
||||||
|
} else {
|
||||||
|
setError("Import Error", null);
|
||||||
|
setExpanded(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,19 +481,8 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
|
||||||
List<Wallet> wallets = new ArrayList<>();
|
List<Wallet> wallets = new ArrayList<>();
|
||||||
String masterFingerprint = Utils.bytesToHex(cryptoAccount.getMasterFingerprint());
|
String masterFingerprint = Utils.bytesToHex(cryptoAccount.getMasterFingerprint());
|
||||||
for(CryptoOutput cryptoOutput : cryptoAccount.getOutputDescriptors()) {
|
for(CryptoOutput cryptoOutput : cryptoAccount.getOutputDescriptors()) {
|
||||||
Wallet wallet = new Wallet();
|
|
||||||
OutputDescriptor outputDescriptor = getOutputDescriptor(cryptoOutput);
|
OutputDescriptor outputDescriptor = getOutputDescriptor(cryptoOutput);
|
||||||
if(outputDescriptor.isMultisig()) {
|
Wallet wallet = outputDescriptor.toKeystoreWallet(masterFingerprint);
|
||||||
throw new IllegalStateException("Multisig output descriptors are unsupported in CryptoAccount");
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtendedKey extendedKey = outputDescriptor.getSingletonExtendedPublicKey();
|
|
||||||
wallet.setScriptType(outputDescriptor.getScriptType());
|
|
||||||
Keystore keystore = new Keystore();
|
|
||||||
keystore.setKeyDerivation(new KeyDerivation(masterFingerprint, KeyDerivation.writePath(outputDescriptor.getKeyDerivation(extendedKey).getDerivation())));
|
|
||||||
keystore.setExtendedPublicKey(extendedKey);
|
|
||||||
wallet.getKeystores().add(keystore);
|
|
||||||
wallet.setDefaultPolicy(Policy.getPolicy(outputDescriptor.isCosigner() ? PolicyType.MULTI : PolicyType.SINGLE, wallet.getScriptType(), wallet.getKeystores(), 1));
|
|
||||||
wallets.add(wallet);
|
wallets.add(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class WalletImportDialog extends Dialog<Wallet> {
|
||||||
AnchorPane.setRightAnchor(scrollPane, 0.0);
|
AnchorPane.setRightAnchor(scrollPane, 0.0);
|
||||||
|
|
||||||
importAccordion = new Accordion();
|
importAccordion = new Accordion();
|
||||||
List<KeystoreFileImport> keystoreImporters = List.of(new ColdcardSinglesig(), new CoboVaultSinglesig(), new KeystoneSinglesig(), new PassportSinglesig(), new SeedTool(), new SpecterDIY());
|
List<KeystoreFileImport> keystoreImporters = List.of(new ColdcardSinglesig(), new CoboVaultSinglesig(), new KeystoneSinglesig(), new PassportSinglesig(), new GordianSeedTool(), new SpecterDIY());
|
||||||
for(KeystoreFileImport importer : keystoreImporters) {
|
for(KeystoreFileImport importer : keystoreImporters) {
|
||||||
FileWalletKeystoreImportPane importPane = new FileWalletKeystoreImportPane(importer);
|
FileWalletKeystoreImportPane importPane = new FileWalletKeystoreImportPane(importer);
|
||||||
importAccordion.getPanes().add(importPane);
|
importAccordion.getPanes().add(importPane);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.sparrowwallet.sparrow.io;
|
package com.sparrowwallet.sparrow.io;
|
||||||
|
|
||||||
|
import com.sparrowwallet.drongo.Network;
|
||||||
import com.sparrowwallet.drongo.protocol.ScriptType;
|
import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||||
import com.sparrowwallet.drongo.wallet.Keystore;
|
import com.sparrowwallet.drongo.wallet.Keystore;
|
||||||
import com.sparrowwallet.drongo.wallet.WalletModel;
|
import com.sparrowwallet.drongo.wallet.WalletModel;
|
||||||
|
@ -7,7 +8,7 @@ import com.sparrowwallet.drongo.wallet.WalletModel;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class SeedTool implements KeystoreFileImport {
|
public class GordianSeedTool implements KeystoreFileImport {
|
||||||
@Override
|
@Override
|
||||||
public boolean isEncrypted(File file) {
|
public boolean isEncrypted(File file) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -15,12 +16,12 @@ public class SeedTool implements KeystoreFileImport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Seed Tool";
|
return "Gordian Seed Tool";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WalletModel getWalletModel() {
|
public WalletModel getWalletModel() {
|
||||||
return WalletModel.SEED_TOOL;
|
return WalletModel.GORDIAN_SEED_TOOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,7 +36,7 @@ public class SeedTool implements KeystoreFileImport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKeystoreImportDescription() {
|
public String getKeystoreImportDescription() {
|
||||||
return "Select your seed and scan the QR code created by Authenticate > Derive Key > Other Key Derivations > Account Descriptor. Click the share icon at the bottom to show the QR.";
|
return "Select your seed and scan the QR code created by Authenticate > Derive Key > Other Key Derivations > " + Network.get().toDisplayString() + " > Master Key > Account Descriptor. Click the share icon at the bottom.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -18,9 +18,9 @@ public class HwAirgappedController extends KeystoreImportDetailController {
|
||||||
public void initializeView() {
|
public void initializeView() {
|
||||||
List<KeystoreFileImport> importers = Collections.emptyList();
|
List<KeystoreFileImport> importers = Collections.emptyList();
|
||||||
if(getMasterController().getWallet().getPolicyType().equals(PolicyType.SINGLE)) {
|
if(getMasterController().getWallet().getPolicyType().equals(PolicyType.SINGLE)) {
|
||||||
importers = List.of(new ColdcardSinglesig(), new CoboVaultSinglesig(), new KeystoneSinglesig(), new PassportSinglesig(), new SeedSigner(), new SeedTool(), new SpecterDIY());
|
importers = List.of(new ColdcardSinglesig(), new CoboVaultSinglesig(), new KeystoneSinglesig(), new PassportSinglesig(), new SeedSigner(), new GordianSeedTool(), new SpecterDIY());
|
||||||
} else if(getMasterController().getWallet().getPolicyType().equals(PolicyType.MULTI)) {
|
} else if(getMasterController().getWallet().getPolicyType().equals(PolicyType.MULTI)) {
|
||||||
importers = List.of(new ColdcardMultisig(), new CoboVaultMultisig(), new KeystoneMultisig(), new PassportMultisig(), new SeedSigner(), new SeedTool(), new SpecterDIY());
|
importers = List.of(new ColdcardMultisig(), new CoboVaultMultisig(), new KeystoneMultisig(), new PassportMultisig(), new SeedSigner(), new GordianSeedTool(), new SpecterDIY());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(KeystoreFileImport importer : importers) {
|
for(KeystoreFileImport importer : importers) {
|
||||||
|
|
Loading…
Reference in a new issue