From ac2acb0b5a30075d92b6931111b9bfdaf74c9c90 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Tue, 30 Jul 2019 10:25:26 +0200 Subject: [PATCH] core: mnemonic mypy --- core/src/apps/common/mnemonic.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/apps/common/mnemonic.py b/core/src/apps/common/mnemonic.py index 6d6b7b42b..77a91bbe8 100644 --- a/core/src/apps/common/mnemonic.py +++ b/core/src/apps/common/mnemonic.py @@ -51,8 +51,11 @@ def get_seed(passphrase: str = "", progress_bar: bool = True) -> bytes: elif mnemonic_type == TYPE_SLIP39: identifier = storage.device.get_slip39_identifier() iteration_exponent = storage.device.get_slip39_iteration_exponent() + if identifier is None or iteration_exponent is None: + # Identifier or exponent expected but not found + raise RuntimeError seed = slip39.decrypt( - identifier, iteration_exponent, mnemonic_secret, passphrase + identifier, iteration_exponent, mnemonic_secret, passphrase.encode() ) if progress_bar: