1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-07 05:51:38 +00:00

seed: render the waiting screen in layout

This commit is contained in:
Jan Pochyla 2019-01-17 16:54:35 +01:00
parent 34f499fc04
commit dca0068218

View File

@ -53,10 +53,15 @@ class Keychain:
async def get_keychain(ctx: wire.Context, namespaces: list) -> Keychain: async def get_keychain(ctx: wire.Context, namespaces: list) -> Keychain:
if not storage.is_initialized(): if not storage.is_initialized():
raise wire.ProcessError("Device is not initialized") raise wire.ProcessError("Device is not initialized")
seed = cache.get_seed() seed = cache.get_seed()
if seed is None: if seed is None:
# derive seed from mnemonic and passphrase seed = await _compute_seed(ctx)
keychain = Keychain(seed, namespaces)
return keychain
@ui.layout
async def _compute_seed(ctx: wire.Context) -> bytes:
passphrase = cache.get_passphrase() passphrase = cache.get_passphrase()
if passphrase is None: if passphrase is None:
passphrase = await protect_by_passphrase(ctx) passphrase = await protect_by_passphrase(ctx)
@ -64,9 +69,7 @@ async def get_keychain(ctx: wire.Context, namespaces: list) -> Keychain:
_start_bip39_progress() _start_bip39_progress()
seed = bip39.seed(storage.get_mnemonic(), passphrase, _render_bip39_progress) seed = bip39.seed(storage.get_mnemonic(), passphrase, _render_bip39_progress)
cache.set_seed(seed) cache.set_seed(seed)
return seed
keychain = Keychain(seed, namespaces)
return keychain
def _start_bip39_progress(): def _start_bip39_progress():