async def doit(menu, idx, item): # apply the password immediately and drop them at top menu set_bip39_passphrase(data[idx]['pw']) from nvstore import settings from utils import xfp2str xfp = settings.get('xfp') # verification step; I don't see any way for this to go wrong assert xfp == data[idx]['xfp'] # feedback that it worked await ux_show_story("Passphrase restored.", title="[%s]" % xfp2str(xfp)) goto_top_menu()
async def interact(self): # prompt them from main import settings showit = False while 1: if showit: ch = await ux_show_story('''Given:\n\n%s\n\nShould we switch to that wallet now? OK to continue, X to cancel.''' % self._pw, title="Passphrase") else: ch = await ux_show_story('''BIP39 passphrase (%d chars long) has been provided over USB connection. Should we switch to that wallet now? Press 2 to view the provided passphrase.\n\nOK to continue, X to cancel.''' % len(self._pw), title="Passphrase", escape='2') if ch == '2': showit = True continue break try: if ch != 'y': # they don't want to! self.refused = True await ux_dramatic_pause("Refused.", 1) else: from seed import set_bip39_passphrase # full screen message shown: "Working..." set_bip39_passphrase(self._pw) self.result = settings.get('xpub') except BaseException as exc: self.failed = "Exception" sys.print_exception(exc) finally: self.done() if self.result: new_xfp = settings.get('xfp') await ux_show_story('''Above is the master key fingerprint of the current wallet.''', title="[%s]" % xfp2str(new_xfp))