msg sign: Sparrow QR compat

(cherry picked from commit a2bdfc9a58)
This commit is contained in:
scgbckbone 2025-02-06 09:00:30 +01:00
parent 5bfb7388c9
commit 1e7cb8970f
3 changed files with 18 additions and 0 deletions

View File

@ -52,6 +52,7 @@ This lists the new changes that have not yet been published in a normal release.
- New Feature: Verify Signed RFC messages via BBQr
- New Feature: Sign message from QR scan (format has to be JSON)
- Enhancement: Sign/Verify Address in Sparrow via QR
- Enhancement: Sign scanned Simple Text by pressing (0). Next screens query information
about key to use.
- Bugfix: Properly re-draw status bar after Restore Master on COLDCARD without master seed.

View File

@ -305,6 +305,19 @@ def parse_msg_sign_request(data):
subpath = ""
addr_fmt = "p2pkh"
is_json = False
# sparrow compat
if "signmessage" in data:
try:
mark, subpath, *msg_line = data.split(" ", 2)
assert mark == "signmessage"
# subpath will be verified & cleaned later
assert msg_line[0][:6] == "ascii:"
text = msg_line[0][6:]
return text, subpath, addr_fmt, is_json
except: pass
# ===
try:
data_dict = ujson.loads(data.strip())
text = data_dict.get("msg", None)

View File

@ -169,6 +169,10 @@ def decode_qr_result(got, expect_secret=False, expect_text=False, expect_bbqr=Fa
return "smsg", (got,)
except: pass
# Sparrow compat
if "signmessage" in got:
return "smsg", (got,)
# try to recognize various bitcoin-related text strings...
return decode_short_text(got)