mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 01:56:44 +00:00
add support for creating seedqr string
This commit is contained in:
parent
9872c6b6ec
commit
b128bb895d
1 changed files with 14 additions and 0 deletions
|
@ -30,6 +30,20 @@ public class SeedQR {
|
||||||
return new DeterministicSeed(words, null, System.currentTimeMillis(), DeterministicSeed.Type.BIP39);
|
return new DeterministicSeed(words, null, System.currentTimeMillis(), DeterministicSeed.Type.BIP39);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getSeedQR(DeterministicSeed seed) {
|
||||||
|
if(seed.isEncrypted()) {
|
||||||
|
throw new IllegalStateException("Seed cannot be encrypted");
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
for(String word : seed.getMnemonicCode()) {
|
||||||
|
int index = Bip39MnemonicCode.INSTANCE.getWordList().indexOf(word);
|
||||||
|
builder.append(String.format("%04d", index));
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public static DeterministicSeed getSeed(byte[] compactSeedQr) {
|
public static DeterministicSeed getSeed(byte[] compactSeedQr) {
|
||||||
byte[] seed;
|
byte[] seed;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue