diff --git a/core/src/apps/common/mnemonic/__init__.py b/core/src/apps/common/mnemonic/__init__.py index e65d006e14..b1e4622d39 100644 --- a/core/src/apps/common/mnemonic/__init__.py +++ b/core/src/apps/common/mnemonic/__init__.py @@ -22,12 +22,12 @@ def get() -> (bytes, int): return mnemonic_secret, mnemonic_type -def get_seed(passphrase: str = ""): +def get_seed(passphrase: str = "", progress_bar=True): mnemonic_secret, mnemonic_type = get() if mnemonic_type == TYPE_BIP39: - return bip39.get_seed(mnemonic_secret, passphrase) + return bip39.get_seed(mnemonic_secret, passphrase, progress_bar) elif mnemonic_type == TYPE_SLIP39: - return slip39.get_seed(mnemonic_secret, passphrase) + return slip39.get_seed(mnemonic_secret, passphrase, progress_bar) def dry_run(secret: bytes): diff --git a/core/src/apps/common/mnemonic/bip39.py b/core/src/apps/common/mnemonic/bip39.py index 09426b285e..63641b30fe 100644 --- a/core/src/apps/common/mnemonic/bip39.py +++ b/core/src/apps/common/mnemonic/bip39.py @@ -27,10 +27,14 @@ def store(secret: bytes, needs_backup: bool, no_backup: bool): storage.store_mnemonic(secret, mnemonic.TYPE_BIP39, needs_backup, no_backup) -def get_seed(secret: bytes, passphrase: str): - mnemonic._start_progress() - seed = bip39.seed(secret.decode(), passphrase, mnemonic._render_progress) - mnemonic._stop_progress() +def get_seed(secret: bytes, passphrase: str, progress_bar=True): + if progress_bar: + mnemonic._start_progress() + seed = bip39.seed(secret.decode(), passphrase, mnemonic._render_progress) + mnemonic._stop_progress() + else: + seed = bip39.seed(secret.decode(), passphrase) + return seed diff --git a/core/src/apps/common/mnemonic/slip39.py b/core/src/apps/common/mnemonic/slip39.py index e888fa7cfb..aac6920c5d 100644 --- a/core/src/apps/common/mnemonic/slip39.py +++ b/core/src/apps/common/mnemonic/slip39.py @@ -77,14 +77,16 @@ def store(secret: bytes, needs_backup: bool, no_backup: bool): storage.clear_slip39_data() -def get_seed(encrypted_master_secret: bytes, passphrase: str): - mnemonic._start_progress() +def get_seed(encrypted_master_secret: bytes, passphrase: str, progress_bar=True): + if progress_bar: + mnemonic._start_progress() identifier = storage.get_slip39_identifier() iteration_exponent = storage.get_slip39_iteration_exponent() master_secret = slip39.decrypt( identifier, iteration_exponent, encrypted_master_secret, passphrase ) - mnemonic._stop_progress() + if progress_bar: + mnemonic._stop_progress() return master_secret