import into master seed if none yet set

This commit is contained in:
Peter D. Gray 2023-12-06 14:17:19 -05:00
parent 801fbb89b5
commit 138cbad573
No known key found for this signature in database
GPG Key ID: A2DCD558C2BE5D7C

View File

@ -646,7 +646,10 @@ class QRScannerInteraction:
async def scan_anything(self, expect_secret=False):
# start a QR scan, and act on what we find, whatever it may be.
from flow import has_secrets
from actions import goto_top_menu
problem = None
while 1:
prompt = 'Scan any QR code, or CANCEL' if not expect_secret else \
'Scan XPRV or Seed Words, or CANCEL'
@ -662,7 +665,7 @@ class QRScannerInteraction:
problem = str(exc)
continue
except Exception as exc:
import sys; sys.print_exception(exc)
#import sys; sys.print_exception(exc)
problem = "Unable to decode QR"
continue
@ -670,13 +673,19 @@ class QRScannerInteraction:
if what == 'xprv':
from actions import import_extended_key_as_secret
text_xprv, = vals
await import_extended_key_as_secret(text_xprv, True)
await import_extended_key_as_secret(text_xprv, has_secrets())
goto_top_menu(first_time=True)
return
if what == 'words':
from seed import set_ephemeral_seed_words # dirty API
from seed import set_ephemeral_seed_words, set_seed_value
words, = vals
await set_ephemeral_seed_words(words, meta='From QR')
if has_secrets():
await set_ephemeral_seed_words(words, meta='From QR')
else:
set_seed_value(words=words)
goto_top_menu(first_time=True)
return
if what == 'psbt':
@ -700,7 +709,6 @@ class QRScannerInteraction:
await ux_visualize_textqr(txt)
return
# not reached?
problem = 'Unhandled: ' + what