core/mnemonic: cancel homescreen before seed progress animation

If we close the default layout before the animation starts, the workflow manager starts it again after the current workflow ends (and no layout is running).
pull/263/head
Jan Pochyla 5 years ago
parent 10f15a6952
commit 03f23fe940

@ -1,13 +1,12 @@
from micropython import const
from trezor import ui, wire
from trezor import ui, wire, workflow
from trezor.crypto.hashlib import sha256
from trezor.messages.Success import Success
from trezor.utils import consteq
from . import bip39, slip39
from apps.common import storage
from apps.common.mnemonic import bip39, slip39
TYPE_BIP39 = const(0)
TYPE_SLIP39 = const(1)
@ -46,6 +45,7 @@ def module_from_words_count(count: int):
def _start_progress():
workflow.closedefault()
ui.backlight_fade(ui.BACKLIGHT_DIM)
ui.display.clear()
ui.header("Please wait")
@ -57,3 +57,7 @@ def _render_progress(progress: int, total: int):
p = 1000 * progress // total
ui.display.loader(p, False, 18, ui.WHITE, ui.BG)
ui.display.refresh()
def _stop_progress():
pass

@ -29,7 +29,9 @@ def store(secret: bytes, needs_backup: bool, no_backup: bool):
def get_seed(secret: bytes, passphrase: str):
mnemonic._start_progress()
return bip39.seed(secret.decode(), passphrase, mnemonic._render_progress)
seed = bip39.seed(secret.decode(), passphrase, mnemonic._render_progress)
mnemonic._stop_progress()
return seed
def check(secret: bytes):

@ -82,6 +82,8 @@ def get_seed(encrypted_master_secret: bytes, passphrase: str):
mnemonic._start_progress()
identifier = storage.get_slip39_identifier()
iteration_exponent = storage.get_slip39_iteration_exponent()
return slip39.decrypt(
master_secret = slip39.decrypt(
identifier, iteration_exponent, encrypted_master_secret, passphrase
)
mnemonic._stop_progress()
return master_secret

Loading…
Cancel
Save