mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +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
|
||||
|
||||
|
||||
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):
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user