1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 13:01:12 +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,22 +53,25 @@ 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)
passphrase = cache.get_passphrase()
if passphrase is None:
passphrase = await protect_by_passphrase(ctx)
cache.set_passphrase(passphrase)
_start_bip39_progress()
seed = bip39.seed(storage.get_mnemonic(), passphrase, _render_bip39_progress)
cache.set_seed(seed)
keychain = Keychain(seed, namespaces) keychain = Keychain(seed, namespaces)
return keychain return keychain
@ui.layout
async def _compute_seed(ctx: wire.Context) -> bytes:
passphrase = cache.get_passphrase()
if passphrase is None:
passphrase = await protect_by_passphrase(ctx)
cache.set_passphrase(passphrase)
_start_bip39_progress()
seed = bip39.seed(storage.get_mnemonic(), passphrase, _render_bip39_progress)
cache.set_seed(seed)
return seed
def _start_bip39_progress(): def _start_bip39_progress():
ui.display.clear() ui.display.clear()
ui.header("Please wait") ui.header("Please wait")