WIP - fix usage of set_mnemonic_secret to use kwargs only

grdddj/storage_device_rust_rewrite
grdddj 2 years ago
parent 9ee8a37b69
commit 153a7ab58b

@ -553,12 +553,13 @@ pub static mp_module_trezorstoragedevice: Module = obj_module! {
Qstr::MP_QSTR_get_mnemonic_secret => obj_fn_0!(storagedevice_get_mnemonic_secret).as_obj(),
/// def set_mnemonic_secret(
/// *,
/// secret: bytes,
/// backup_type: BackupTypeInt,
/// needs_backup: bool = False,
/// no_backup: bool = False,
/// ) -> None:
/// """Set mnemonic secret"""
/// """Set mnemonic secret. Only kwargs are supported."""
Qstr::MP_QSTR_set_mnemonic_secret => obj_fn_kw!(0, storagedevice_set_mnemonic_secret).as_obj(),
/// def is_passphrase_enabled() -> bool:

@ -55,12 +55,13 @@ def get_mnemonic_secret() -> bytes:
# rust/src/storagedevice/storage_device.rs
def set_mnemonic_secret(
*,
secret: bytes,
backup_type: BackupTypeInt,
needs_backup: bool = False,
no_backup: bool = False,
) -> None:
"""Set mnemonic secret"""
"""Set mnemonic secret. Only kwargs are supported."""
# rust/src/storagedevice/storage_device.rs

@ -129,7 +129,7 @@ async def _finish_recovery(
raise RuntimeError
storage.device.set_mnemonic_secret(
secret, backup_type, needs_backup=False, no_backup=False
secret=secret, backup_type=backup_type, needs_backup=False, no_backup=False
)
if backup_type in (BackupType.Slip39_Basic, BackupType.Slip39_Advanced):
identifier = storage.recovery.get_slip39_identifier()

@ -86,8 +86,8 @@ async def reset_device(ctx: wire.Context, msg: ResetDevice) -> Success:
storage.device.set_label(msg.label)
storage.device.set_passphrase_enabled(bool(msg.passphrase_protection))
storage.device.set_mnemonic_secret(
secret, # for SLIP-39, this is the EMS
msg.backup_type,
secret=secret, # for SLIP-39, this is the EMS
backup_type=msg.backup_type,
needs_backup=not perform_backup,
no_backup=bool(msg.no_backup),
)

Loading…
Cancel
Save