mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-29 19:08:12 +00:00
Restore progress_bar parameter in mnemonic.seed (#297)
Restore progress_bar parameter in mnemonic.seed
This commit is contained in:
commit
049c5211f3
@ -22,12 +22,12 @@ def get() -> (bytes, int):
|
|||||||
return mnemonic_secret, mnemonic_type
|
return mnemonic_secret, mnemonic_type
|
||||||
|
|
||||||
|
|
||||||
def get_seed(passphrase: str = ""):
|
def get_seed(passphrase: str = "", progress_bar=True):
|
||||||
mnemonic_secret, mnemonic_type = get()
|
mnemonic_secret, mnemonic_type = get()
|
||||||
if mnemonic_type == TYPE_BIP39:
|
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:
|
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):
|
def dry_run(secret: bytes):
|
||||||
|
@ -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)
|
storage.store_mnemonic(secret, mnemonic.TYPE_BIP39, needs_backup, no_backup)
|
||||||
|
|
||||||
|
|
||||||
def get_seed(secret: bytes, passphrase: str):
|
def get_seed(secret: bytes, passphrase: str, progress_bar=True):
|
||||||
|
if progress_bar:
|
||||||
mnemonic._start_progress()
|
mnemonic._start_progress()
|
||||||
seed = bip39.seed(secret.decode(), passphrase, mnemonic._render_progress)
|
seed = bip39.seed(secret.decode(), passphrase, mnemonic._render_progress)
|
||||||
mnemonic._stop_progress()
|
mnemonic._stop_progress()
|
||||||
|
else:
|
||||||
|
seed = bip39.seed(secret.decode(), passphrase)
|
||||||
|
|
||||||
return seed
|
return seed
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,13 +77,15 @@ def store(secret: bytes, needs_backup: bool, no_backup: bool):
|
|||||||
storage.clear_slip39_data()
|
storage.clear_slip39_data()
|
||||||
|
|
||||||
|
|
||||||
def get_seed(encrypted_master_secret: bytes, passphrase: str):
|
def get_seed(encrypted_master_secret: bytes, passphrase: str, progress_bar=True):
|
||||||
|
if progress_bar:
|
||||||
mnemonic._start_progress()
|
mnemonic._start_progress()
|
||||||
identifier = storage.get_slip39_identifier()
|
identifier = storage.get_slip39_identifier()
|
||||||
iteration_exponent = storage.get_slip39_iteration_exponent()
|
iteration_exponent = storage.get_slip39_iteration_exponent()
|
||||||
master_secret = slip39.decrypt(
|
master_secret = slip39.decrypt(
|
||||||
identifier, iteration_exponent, encrypted_master_secret, passphrase
|
identifier, iteration_exponent, encrypted_master_secret, passphrase
|
||||||
)
|
)
|
||||||
|
if progress_bar:
|
||||||
mnemonic._stop_progress()
|
mnemonic._stop_progress()
|
||||||
return master_secret
|
return master_secret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user