fixup! refactor(core): make 1-of-1 SLIP39 backups use same messaging as BIP39

Ioan Bizău 3 weeks ago
parent e9dda08859
commit 8ee6bd65f5

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Collection
from typing import TYPE_CHECKING, Sequence
import storage
import storage.device as storage_device
@ -121,7 +121,7 @@ async def _backup_slip39_basic(encrypted_master_secret: bytes) -> None:
await layout.slip39_show_checklist(1, BAK_T_SLIP39_BASIC)
share_threshold = await layout.slip39_prompt_threshold(share_count)
mnemonics = await _backup_slip39(
mnemonics = _get_slip39_mnemonics(
encrypted_master_secret, group_threshold, [(share_threshold, share_count)]
)
@ -147,7 +147,7 @@ async def _backup_slip39_advanced(encrypted_master_secret: bytes) -> None:
share_threshold = await layout.slip39_prompt_threshold(share_count, i)
groups.append((share_threshold, share_count))
mnemonics = await _backup_slip39(encrypted_master_secret, group_threshold, groups)
mnemonics = _get_slip39_mnemonics(encrypted_master_secret, group_threshold, groups)
# show and confirm individual shares
await layout.slip39_advanced_show_and_confirm_shares(mnemonics)
@ -156,9 +156,9 @@ async def _backup_slip39_advanced(encrypted_master_secret: bytes) -> None:
async def _backup_slip39_custom(
encrypted_master_secret: bytes,
group_threshold: int,
groups: Collection[tuple[int, int]],
groups: Sequence[tuple[int, int]],
):
mnemonics = await _backup_slip39(encrypted_master_secret, group_threshold, groups)
mnemonics = _get_slip39_mnemonics(encrypted_master_secret, group_threshold, groups)
# show and confirm individual shares
if len(groups) == 1 and groups[0][0] == 1 and groups[0][1] == 1:
@ -171,10 +171,10 @@ async def _backup_slip39_custom(
else:
await layout.slip39_advanced_show_and_confirm_shares(mnemonics)
async def _backup_slip39(
def _get_slip39_mnemonics(
encrypted_master_secret: bytes,
group_threshold: int,
groups: Collection[tuple[int, int]],
groups: Sequence[tuple[int, int]],
):
identifier = storage_device.get_slip39_identifier()
iteration_exponent = storage_device.get_slip39_iteration_exponent()
@ -235,7 +235,7 @@ async def backup_seed(
backup_type: BackupType,
mnemonic_secret: bytes,
group_threshold: int | None = None,
groups: Collection[tuple[int, int]] = (),
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)

@ -1390,8 +1390,6 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
self.share_count = share_count
def input_flow_tt(self) -> BRGeneratorType:
yield # Checklist
self.debug.press_yes()
yield # Confirm show seeds
self.debug.press_yes()
@ -1403,8 +1401,6 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
self.debug.press_yes()
def input_flow_tr(self) -> BRGeneratorType:
yield # Checklist
self.debug.press_yes()
yield # Confirm show seeds
self.debug.press_yes()
@ -1416,8 +1412,6 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
self.debug.press_yes()
def input_flow_t3t1(self) -> BRGeneratorType:
yield # Checklist
self.debug.press_yes()
yield # Confirm show seeds
self.debug.press_yes()

Loading…
Cancel
Save