bip39 keystore import

This commit is contained in:
Craig Raw 2020-05-07 14:36:37 +02:00
parent 2de90dfdc1
commit 910dfcdeb1
3 changed files with 10 additions and 11 deletions

2
drongo

@ -1 +1 @@
Subproject commit c5042cf130457233955aa4c72b1ad543bdfcb171
Subproject commit d394c25a3c05c02d984b1f709623a311c2afb7a1

View file

@ -1,6 +1,6 @@
package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.crypto.ChildNumber;
import com.sparrowwallet.drongo.wallet.Bip39Calculator;
import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.drongo.wallet.WalletModel;
@ -8,12 +8,9 @@ import com.sparrowwallet.drongo.wallet.WalletModel;
import java.util.List;
public class Bip39 implements KeystoreMnemonicImport {
@Override
public Keystore getKeystore(ScriptType scriptType, List<String> mnemonicWords, String passphrase) throws ImportException {
Bip39Calculator bip39Calculator = new Bip39Calculator();
return null;
public String getName() {
return "Mnemonic Words (BIP39)";
}
@Override
@ -27,7 +24,9 @@ public class Bip39 implements KeystoreMnemonicImport {
}
@Override
public String getName() {
return null;
public Keystore getKeystore(List<ChildNumber> derivation, List<String> mnemonicWords, String passphrase) throws ImportException {
Bip39Calculator bip39Calculator = new Bip39Calculator();
byte[] seed = bip39Calculator.getSeed(mnemonicWords, passphrase);
return Keystore.fromSeed(seed, derivation);
}
}

View file

@ -1,10 +1,10 @@
package com.sparrowwallet.sparrow.io;
import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.crypto.ChildNumber;
import com.sparrowwallet.drongo.wallet.Keystore;
import java.util.List;
public interface KeystoreMnemonicImport extends KeystoreImport {
Keystore getKeystore(ScriptType scriptType, List<String> mnemonicWords, String passphrase) throws ImportException;
Keystore getKeystore(List<ChildNumber> derivation, List<String> mnemonicWords, String passphrase) throws ImportException;
}