fixup! feat(core): add ability to request backups with any number of groups/shares.

Ioan Bizău 2 weeks ago
parent ba49b9e760
commit 4f29ab3bda

@ -302,7 +302,7 @@ def unlock_bootloader(client: "TrezorClient") -> str:
@cli.command()
@click.argument("enable", type=ChoiceType({"on": True, "off": False}))
@click.argument("enable", type=ChoiceType({"on": True, "off": False}), required=False)
@click.option(
"-e",
"--expiry",
@ -329,7 +329,7 @@ def set_busy(
@cli.command()
@click.argument("hex_challenge")
@click.argument("hex_challenge", required=False)
@with_client
def authenticate(client: "TrezorClient", hex_challenge: Optional[str]) -> None:
"""Get information to verify the authenticity of the device."""

@ -31,7 +31,7 @@ from ..input_flows import (
InputFlowBip39Backup,
InputFlowSlip39AdvancedBackup,
InputFlowSlip39BasicBackup,
InputFlowSlip39SingleBackup,
InputFlowSlip39CustomBackup,
)
@ -115,18 +115,15 @@ def test_backup_slip39_advanced(client: Client, click_info: bool):
@pytest.mark.skip_t1b1
@pytest.mark.setup_client(needs_backup=True, mnemonic=MNEMONIC_SLIP39_ADVANCED_20)
@pytest.mark.parametrize(
"click_info", [True, False], ids=["click_info", "no_click_info"]
"share_threshold,share_count", [(1, 1), (2, 2), (3, 5)], ids=["1_of_1", "2_of_2", "3_of_5"]
)
def test_backup_slip39_single(client: Client, click_info: bool):
if click_info and client.model is models.T2B1:
pytest.skip("click_info not implemented on T2B1")
def test_backup_slip39_custom(client: Client, share_threshold, share_count):
assert client.features.needs_backup is True
with client:
IF = InputFlowSlip39SingleBackup(client, click_info)
IF = InputFlowSlip39CustomBackup(client, share_count)
client.set_input_flow(IF.get())
device.backup(client, group_threshold=1, groups=[(1, 1)])
device.backup(client, group_threshold=1, groups=[(share_threshold, share_count)])
client.init_device()
assert client.features.initialized is True

@ -1383,11 +1383,11 @@ class InputFlowSlip39BasicResetRecovery(InputFlowBase):
self.debug.press_yes()
class InputFlowSlip39SingleBackup(InputFlowBase):
def __init__(self, client: Client, click_info: bool):
class InputFlowSlip39CustomBackup(InputFlowBase):
def __init__(self, client: Client, share_count: int):
super().__init__(client)
self.mnemonics: list[str] = []
self.click_info = click_info
self.share_count = share_count
def input_flow_tt(self) -> BRGeneratorType:
yield # Checklist
@ -1396,7 +1396,7 @@ class InputFlowSlip39SingleBackup(InputFlowBase):
self.debug.press_yes()
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 1)
self.mnemonics = yield from load_N_shares(self.debug, self.share_count)
br = yield # Confirm backup
assert br.code == B.Success
@ -1409,7 +1409,7 @@ class InputFlowSlip39SingleBackup(InputFlowBase):
self.debug.press_yes()
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 1)
self.mnemonics = yield from load_N_shares(self.debug, self.share_count)
br = yield # Confirm backup
assert br.code == B.Success
@ -1422,7 +1422,7 @@ class InputFlowSlip39SingleBackup(InputFlowBase):
self.debug.press_yes()
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 1)
self.mnemonics = yield from load_N_shares(self.debug, self.share_count)
br = yield # Confirm backup
assert br.code == B.Success

Loading…
Cancel
Save