Browse Source

Fix bug with UR2.0 encoding for signed PSBTs

dev-v1.0.4
Ken Carpenter 3 years ago
parent
commit
bf163d6486
  1. 10
      ports/stm32/boards/Passport/modules/auth.py

10
ports/stm32/boards/Passport/modules/auth.py

@ -919,20 +919,16 @@ async def sign_psbt_buf(psbt_buf):
gc.collect()
from ur1.encode_ur import encode_ur
from ux import DisplayURCode
from data_codecs.qr_type import QRType
from ubinascii import hexlify as b2a_hex
signed_hex = b2a_hex(signed_bytes)
# lines = [signed_hex[i:i+100] for i in range(0, len(signed_hex), 100)]
# print('signed_bytes hex')
# for line in lines:
# print(line)
# print('last_scanned_qr_type={}'.format(last_scanned_qr_type))
# print('len(signed_hex)={}'.format(len(signed_hex)))
o = DisplayURCode('Signed Txn', signed_hex, last_scanned_qr_type or QRType.UR2, None, is_binary=True)
# Text format for UR1, but binary for UR2
o = DisplayURCode('Signed Txn', signed_bytes if last_scanned_qr_type == QRType.UR2 else signed_hex, last_scanned_qr_type or QRType.UR2, None, is_binary=True)
result = await o.interact_bare()
UserAuthorizedAction.cleanup()

Loading…
Cancel
Save