|
|
|
@ -124,7 +124,7 @@ async def _backup_slip39_basic(encrypted_master_secret: bytes) -> None:
|
|
|
|
|
share_threshold = await layout.slip39_prompt_threshold(share_count)
|
|
|
|
|
|
|
|
|
|
mnemonics = _get_slip39_mnemonics(
|
|
|
|
|
encrypted_master_secret, group_threshold, [(share_threshold, share_count)]
|
|
|
|
|
encrypted_master_secret, group_threshold, ((share_threshold, share_count),)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# show and confirm individual shares
|
|
|
|
@ -155,11 +155,11 @@ async def _backup_slip39_advanced(encrypted_master_secret: bytes) -> None:
|
|
|
|
|
await layout.slip39_advanced_show_and_confirm_shares(mnemonics)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def _backup_slip39_custom(
|
|
|
|
|
async def backup_slip39_custom(
|
|
|
|
|
encrypted_master_secret: bytes,
|
|
|
|
|
group_threshold: int,
|
|
|
|
|
groups: Sequence[tuple[int, int]],
|
|
|
|
|
):
|
|
|
|
|
) -> None:
|
|
|
|
|
mnemonics = _get_slip39_mnemonics(encrypted_master_secret, group_threshold, groups)
|
|
|
|
|
|
|
|
|
|
# show and confirm individual shares
|
|
|
|
@ -241,20 +241,8 @@ def _compute_secret_from_entropy(
|
|
|
|
|
return secret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def backup_seed(
|
|
|
|
|
backup_type: BackupType,
|
|
|
|
|
mnemonic_secret: bytes,
|
|
|
|
|
group_threshold: int | None = None,
|
|
|
|
|
groups: Sequence[tuple[int, int]] = (),
|
|
|
|
|
) -> None:
|
|
|
|
|
# Either both should be defined or both should be missing: group_threshold, groups
|
|
|
|
|
assert (group_threshold is None) == (len(groups) == 0)
|
|
|
|
|
|
|
|
|
|
assert backup_type != BAK_T_BIP39 or group_threshold is None
|
|
|
|
|
|
|
|
|
|
if group_threshold is not None:
|
|
|
|
|
await _backup_slip39_custom(mnemonic_secret, group_threshold, groups)
|
|
|
|
|
elif backup_type == BAK_T_SLIP39_BASIC:
|
|
|
|
|
async def backup_seed(backup_type: BackupType, mnemonic_secret: bytes) -> None:
|
|
|
|
|
if backup_type == BAK_T_SLIP39_BASIC:
|
|
|
|
|
await _backup_slip39_basic(mnemonic_secret)
|
|
|
|
|
elif backup_type == BAK_T_SLIP39_ADVANCED:
|
|
|
|
|
await _backup_slip39_advanced(mnemonic_secret)
|
|
|
|
|