From 31e0518588ed4d28b23b42d55b17f8fc4406a36a Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Tue, 29 Oct 2024 15:16:28 +0100 Subject: [PATCH] chore(python): add shortcut in trezorlib for academic seed --- python/.changelog.d/4282.added | 1 + python/src/trezorlib/cli/device.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 python/.changelog.d/4282.added diff --git a/python/.changelog.d/4282.added b/python/.changelog.d/4282.added new file mode 100644 index 0000000000..d7c37f0d9b --- /dev/null +++ b/python/.changelog.d/4282.added @@ -0,0 +1 @@ +Added shortcut for loading a debug device with the "academic" SLIP39 seed. diff --git a/python/src/trezorlib/cli/device.py b/python/src/trezorlib/cli/device.py index 6f2bd14883..52c0bd3961 100644 --- a/python/src/trezorlib/cli/device.py +++ b/python/src/trezorlib/cli/device.py @@ -100,6 +100,7 @@ def wipe(client: "TrezorClient", bootloader: bool) -> str: @click.option("-l", "--label", default="") @click.option("-i", "--ignore-checksum", 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("-n", "--no-backup", is_flag=True) @with_client @@ -111,6 +112,7 @@ def load( label: str, ignore_checksum: bool, slip0014: bool, + academic: bool, needs_backup: bool, no_backup: bool, ) -> str: @@ -118,13 +120,19 @@ def load( This functionality is only available in debug mode. """ - if slip0014 and mnemonic: - raise click.ClickException("Cannot use -s and -m together.") + if sum((slip0014, academic, bool(mnemonic))) > 1: + raise click.ClickException("Cannot use the options -a, -m, and -s together.") if slip0014: mnemonic = [" ".join(["all"] * 12)] if not label: 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: return debuglink.load_device(