async def recovery_homescreen() -> None: if not storage.recovery.is_in_progress(): workflow.set_default(homescreen) return # recovery process does not communicate on the wire ctx = wire.DUMMY_CONTEXT await recovery_process(ctx)
async def recovery_device(ctx: wire.Context, msg: RecoveryDevice) -> Success: """ Recover BIP39/SLIP39 seed into empty device. Recovery is also possible with replugged Trezor. We call this process Persistence. User starts the process here using the RecoveryDevice msg and then they can unplug the device anytime and continue without a computer. """ _validate(msg) if storage.recovery.is_in_progress(): return await recovery_process(ctx) await _continue_dialog(ctx, msg) if not msg.dry_run: # wipe storage to make sure the device is in a clear state storage.reset() # for dry run pin needs to be entered if msg.dry_run: curpin, salt = await request_pin_and_sd_salt(ctx, "Enter PIN") if not config.check_pin(curpin, salt): await error_pin_invalid(ctx) if not msg.dry_run: # set up pin if requested if msg.pin_protection: newpin = await request_pin_confirm(ctx, allow_cancel=False) config.change_pin("", newpin, None, None) storage.device.set_passphrase_enabled(bool(msg.passphrase_protection)) if msg.u2f_counter is not None: storage.device.set_u2f_counter(msg.u2f_counter) if msg.label is not None: storage.device.set_label(msg.label) storage.recovery.set_in_progress(True) storage.recovery.set_dry_run(bool(msg.dry_run)) workflow.set_default(recovery_homescreen) return await recovery_process(ctx)
def set_homescreen() -> None: if not config.is_unlocked(): from apps.homescreen.lockscreen import lockscreen workflow.set_default(lockscreen) elif storage.recovery.is_in_progress(): from apps.management.recovery_device.homescreen import recovery_homescreen workflow.set_default(recovery_homescreen) else: from apps.homescreen.homescreen import homescreen workflow.set_default(homescreen)