MSG->Message when we have space

This commit is contained in:
Peter D. Gray 2026-02-25 09:54:29 -05:00 committed by doc-hex
parent 239642e5f2
commit 87a6956f06
2 changed files with 10 additions and 9 deletions

View File

@ -298,7 +298,8 @@ class ApproveTransaction(UserAuthorizedAction):
from actions import file_picker
ch = await import_export_prompt("message", is_import=True, force_prompt=True,
intro="Import msg that hashes to 'to_spend' msg hash.",
key0="to input message manually", title="BIP-322 MSG",
key0="to input message manually",
title="BIP-322 Messsage" if version.has_qwerty else 'BIP-322 MSG',
no_qr=not version.has_qwerty)
# single sha256 of b'BIP0322-signed-message'
@ -312,7 +313,7 @@ class ApproveTransaction(UserAuthorizedAction):
msg = await NFC.read_bip322_msg()
elif ch == KEY_QR:
from ux_q1 import QRScannerInteraction
msg = await QRScannerInteraction().scan_text('Scan MSG from a QR code')
msg = await QRScannerInteraction().scan_text('Scan message from a QR code')
else:
choices = await file_picker(suffix='.txt', ux=False)
target = "%s.txt" % b2a_hex(self.psbt.por322_msg_hash).decode()
@ -335,7 +336,7 @@ class ApproveTransaction(UserAuthorizedAction):
assert msg_hash == self.psbt.por322_msg_hash, "hash verification failed"
ch = await ux_show_story(
msg+"\n\nPress %s to approve message, otherwise %s to exit." % (OK, X),
title="MSG:"
title="Message:"
)
return True if ch == "y" else False

View File

@ -1,6 +1,6 @@
# (c) Copyright 2026 by Coinkite Inc. This file is covered by license found in COPYING-CC.
#
# BIP-322 message signing & Proof of Reserves
# BIP-322 Message Signing and Proof of Reserves
#
import pytest, time
from io import BytesIO
@ -19,7 +19,7 @@ def verify_msg_bip322_por(cap_story, need_keypress, press_select, press_cancel,
enter_complex, pick_menu_item):
def doit(msg, refuse=False, way="sd", fname=None):
title, story = cap_story()
assert title == "BIP-322 MSG"
assert "BIP-322" in title
# file was already created with bip322_txn fixture above
if "qr" in way and not is_q1:
raise pytest.xfail("Mk4 no QR")
@ -532,7 +532,7 @@ def test_bip322_msg_import_fail(bip322_txn, start_sign, end_sign, cap_story, nee
start_sign(psbt, finalize=True)
time.sleep(.1)
title, story = cap_story()
assert title == "BIP-322 MSG"
assert 'BIP-322' in title
need_keypress("1") # SD
time.sleep(.1)
@ -545,7 +545,7 @@ def test_bip322_msg_import_fail(bip322_txn, start_sign, end_sign, cap_story, nee
start_sign(psbt, finalize=True)
time.sleep(.1)
title, story = cap_story()
assert title == "BIP-322 MSG"
assert 'BIP-322' in title
need_keypress("0") # manual input
# leave empty
@ -560,7 +560,7 @@ def test_bip322_msg_import_fail(bip322_txn, start_sign, end_sign, cap_story, nee
start_sign(psbt, finalize=True)
time.sleep(.1)
title, story = cap_story()
assert title == "BIP-322 MSG"
assert 'BIP-322' in title
need_keypress("0") # manual input
enter_complex("AAA", apply=False, b39pass=False) # msg wrong
@ -571,4 +571,4 @@ def test_bip322_msg_import_fail(bip322_txn, start_sign, end_sign, cap_story, nee
assert "hash verification failed" in story
press_cancel()
# EOF
# EOF