|
|
@ -1,4 +1,4 @@
|
|
|
|
from trezor import loop, utils, wire
|
|
|
|
from trezor import utils, wire, workflow
|
|
|
|
from trezor.crypto import slip39
|
|
|
|
from trezor.crypto import slip39
|
|
|
|
from trezor.crypto.hashlib import sha256
|
|
|
|
from trezor.crypto.hashlib import sha256
|
|
|
|
from trezor.errors import MnemonicError
|
|
|
|
from trezor.errors import MnemonicError
|
|
|
@ -14,6 +14,7 @@ from apps.common.storage import (
|
|
|
|
recovery as storage_recovery,
|
|
|
|
recovery as storage_recovery,
|
|
|
|
recovery_shares as storage_recovery_shares,
|
|
|
|
recovery_shares as storage_recovery_shares,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
from apps.homescreen.homescreen import homescreen
|
|
|
|
from apps.management import backup_types
|
|
|
|
from apps.management import backup_types
|
|
|
|
from apps.management.recovery_device import layout
|
|
|
|
from apps.management.recovery_device import layout
|
|
|
|
|
|
|
|
|
|
|
@ -25,13 +26,7 @@ if False:
|
|
|
|
async def recovery_homescreen() -> None:
|
|
|
|
async def recovery_homescreen() -> None:
|
|
|
|
# recovery process does not communicate on the wire
|
|
|
|
# recovery process does not communicate on the wire
|
|
|
|
ctx = wire.DummyContext()
|
|
|
|
ctx = wire.DummyContext()
|
|
|
|
try:
|
|
|
|
await recovery_process(ctx)
|
|
|
|
await recovery_process(ctx)
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
|
|
|
# clear the loop state, so loop.run will exit
|
|
|
|
|
|
|
|
loop.clear()
|
|
|
|
|
|
|
|
# clear the registered wire handlers to avoid conflicts
|
|
|
|
|
|
|
|
wire.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def recovery_process(ctx: wire.GenericContext) -> Success:
|
|
|
|
async def recovery_process(ctx: wire.GenericContext) -> Success:
|
|
|
@ -43,6 +38,7 @@ async def recovery_process(ctx: wire.GenericContext) -> Success:
|
|
|
|
storage_recovery.end_progress()
|
|
|
|
storage_recovery.end_progress()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
storage.wipe()
|
|
|
|
storage.wipe()
|
|
|
|
|
|
|
|
workflow.replace_default(homescreen)
|
|
|
|
raise wire.ActionCancelled("Cancelled")
|
|
|
|
raise wire.ActionCancelled("Cancelled")
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|