From b52be27a99108899a6f76699994e70386e6ce804 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 15 May 2023 15:49:39 -0500 Subject: [PATCH] support scanning text qr containing seed words --- drongo | 2 +- .../sparrowwallet/sparrow/control/QRScanDialog.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drongo b/drongo index fe19c865..b26c5e52 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit fe19c86544d75d0ce0d8c32b0cbbd44de64ae463 +Subproject commit b26c5e5218b91c760b7f63f47d93b7301223cc2c diff --git a/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java index 83be3586..ec871b25 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/QRScanDialog.java @@ -16,6 +16,7 @@ import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.psbt.PSBT; import com.sparrowwallet.drongo.psbt.PSBTParseException; import com.sparrowwallet.drongo.uri.BitcoinURI; +import com.sparrowwallet.drongo.wallet.Bip39MnemonicCode; import com.sparrowwallet.drongo.wallet.DeterministicSeed; import com.sparrowwallet.drongo.wallet.SeedQR; import com.sparrowwallet.drongo.wallet.Wallet; @@ -351,6 +352,17 @@ public class QRScanDialog extends Dialog { //Ignore, not parseable as a CompactSeedQR } + try { + List words = Arrays.asList(qrtext.split(" ")); + if(words.size() == 12 || words.size() == 15 || words.size() == 18 || words.size() == 21 || words.size() == 24) { + Bip39MnemonicCode.INSTANCE.check(words); + result = new Result(new DeterministicSeed(words, null, System.currentTimeMillis(), DeterministicSeed.Type.BIP39)); + return; + } + } catch(Exception e) { + //Ignore, not parseable as BIP39 seed words + } + result = new Result(qrtext); } }