1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 11:28:14 +00:00

chore(python): add shortcut in trezorlib for academic seed

This commit is contained in:
Lukas Bielesch 2024-10-29 15:16:28 +01:00 committed by Lukáš Bielesch
parent 2396e10fbb
commit 31e0518588
2 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1 @@
Added shortcut for loading a debug device with the "academic" SLIP39 seed.

View File

@ -100,6 +100,7 @@ def wipe(client: "TrezorClient", bootloader: bool) -> str:
@click.option("-l", "--label", default="") @click.option("-l", "--label", default="")
@click.option("-i", "--ignore-checksum", is_flag=True) @click.option("-i", "--ignore-checksum", is_flag=True)
@click.option("-s", "--slip0014", is_flag=True) @click.option("-s", "--slip0014", is_flag=True)
@click.option("-a", "--academic", is_flag=True)
@click.option("-b", "--needs-backup", is_flag=True) @click.option("-b", "--needs-backup", is_flag=True)
@click.option("-n", "--no-backup", is_flag=True) @click.option("-n", "--no-backup", is_flag=True)
@with_client @with_client
@ -111,6 +112,7 @@ def load(
label: str, label: str,
ignore_checksum: bool, ignore_checksum: bool,
slip0014: bool, slip0014: bool,
academic: bool,
needs_backup: bool, needs_backup: bool,
no_backup: bool, no_backup: bool,
) -> str: ) -> str:
@ -118,13 +120,19 @@ def load(
This functionality is only available in debug mode. This functionality is only available in debug mode.
""" """
if slip0014 and mnemonic: if sum((slip0014, academic, bool(mnemonic))) > 1:
raise click.ClickException("Cannot use -s and -m together.") raise click.ClickException("Cannot use the options -a, -m, and -s together.")
if slip0014: if slip0014:
mnemonic = [" ".join(["all"] * 12)] mnemonic = [" ".join(["all"] * 12)]
if not label: if not label:
label = "SLIP-0014" label = "SLIP-0014"
elif academic:
mnemonic = [
"academic again academic academic academic academic academic academic academic academic academic academic academic academic academic academic academic pecan provide remember"
]
if not label:
label = "ACADEMIC"
try: try:
return debuglink.load_device( return debuglink.load_device(