Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmukai committed Apr 3, 2024
1 parent fa95387 commit bb565c8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/seedsigner/models/decode_qr.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ def extract_qr_data(image, is_binary:bool = False) -> str | None:
for barcode in barcodes:
# Only pull and return the first barcode
return barcode.data

print("No QR data")


@staticmethod
Expand All @@ -343,10 +341,10 @@ def detect_segment_type(s, wordlist_language_code=None):
# PSBT
if re.search("^UR:CRYPTO-PSBT/", s, re.IGNORECASE):
return QRType.PSBT__UR2

elif re.search("^UR:CRYPTO-OUTPUT/", s, re.IGNORECASE):
return QRType.OUTPUT__UR

elif re.search("^UR:CRYPTO-ACCOUNT/", s, re.IGNORECASE):
return QRType.ACCOUNT__UR

Expand All @@ -368,10 +366,10 @@ def detect_segment_type(s, wordlist_language_code=None):
elif re.search(r'^\{\"label\".*\"descriptor\"\:.*', desc_str, re.IGNORECASE):
# if json starting with label and contains descriptor, assume specter wallet json
return QRType.WALLET__SPECTER

elif "multisig setup file" in s.lower():
return QRType.WALLET__CONFIGFILE

elif "sortedmulti" in s:
return QRType.WALLET__GENERIC

Expand All @@ -398,7 +396,7 @@ def detect_segment_type(s, wordlist_language_code=None):
_4LETTER_WORDLIST = [word[:4].strip() for word in wordlist]
except:
_4LETTER_WORDLIST = []

if all(x in wordlist for x in s.strip().split(" ")):
# checks if all words in list are in bip39 word list
return QRType.SEED__MNEMONIC
Expand All @@ -414,7 +412,7 @@ def detect_segment_type(s, wordlist_language_code=None):
# Probably this isn't meant to be string data; check if it's valid byte data
# below.
pass

# Is it byte data?
# 32 bytes for 24-word CompactSeedQR; 16 bytes for 12-word CompactSeedQR
if len(s) == 32 or len(s) == 16:
Expand Down

0 comments on commit bb565c8

Please sign in to comment.