Import multisig QR (scan anything)

This commit is contained in:
scgbckbone 2024-02-15 17:08:33 +01:00 committed by doc-hex
parent 3dd2ace221
commit e2a1bcbc3e
2 changed files with 17 additions and 3 deletions

View File

@ -219,6 +219,9 @@ def decode_qr_text(got):
except:
pass
if "sortedmulti(" in orig_got:
return 'multi', (orig_got,)
# catch-all ... was text. Can still show on-screen perhaps useful for other applications
return 'text', (orig_got,)

View File

@ -6,12 +6,12 @@ import utime, gc, ngu, sys
import uasyncio as asyncio
from uasyncio import sleep_ms
from charcodes import *
from lcd_display import CHARS_W, CHARS_H, CursorSpec, CURSOR_SOLID, CURSOR_OUTLINE, CURSOR_DW_SOLID
from lcd_display import CHARS_W, CHARS_H, CursorSpec, CURSOR_SOLID, CURSOR_OUTLINE
from exceptions import AbortInteraction, QRDecodeExplained
from queues import QueueEmpty
import bip39
from decoders import decode_qr_result
from ubinascii import hexlify as b2a_hex
from utils import problem_file_line
from glob import numpad # may be None depending on import order, careful
class PressRelease:
@ -895,7 +895,18 @@ class QRScannerInteraction:
if what == 'addr':
proto, addr, args = vals
await ux_visualize_bip21(proto, addr, args)
return
return
if what == "multi":
from auth import maybe_enroll_xpub
from ux import ux_show_story
ms_config, = vals
try:
maybe_enroll_xpub(config=ms_config)
except Exception as e:
await ux_show_story(
'Failed to import.\n\n%s\n%s' % (e, problem_file_line(e)))
return
if what == 'text' or what == 'xpub':
# we couldn't really decode it.