From cc2314d89d1726bc1a881e98d459c7780479b591 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 24 Apr 2023 12:26:52 +0200 Subject: [PATCH] fix(python/trezorctl): do not prompt twice when enabling force-on-device fixes #2833 --- python/.changelog.d/2833.fixed | 1 + python/src/trezorlib/cli/settings.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 python/.changelog.d/2833.fixed diff --git a/python/.changelog.d/2833.fixed b/python/.changelog.d/2833.fixed new file mode 100644 index 000000000..b215797d0 --- /dev/null +++ b/python/.changelog.d/2833.fixed @@ -0,0 +1 @@ +When enabling passphrase force-on-device, do not also prompt to enable passphrase if it is already enabled. diff --git a/python/src/trezorlib/cli/settings.py b/python/src/trezorlib/cli/settings.py index eb23398db..05a5f1e86 100644 --- a/python/src/trezorlib/cli/settings.py +++ b/python/src/trezorlib/cli/settings.py @@ -319,8 +319,14 @@ passphrase = cast(AliasedGroup, passphrase_main) @with_client def passphrase_on(client: "TrezorClient", force_on_device: Optional[bool]) -> str: """Enable passphrase.""" + if client.features.passphrase_protection is not True: + use_passphrase = True + else: + use_passphrase = None return device.apply_settings( - client, use_passphrase=True, passphrase_always_on_device=force_on_device + client, + use_passphrase=use_passphrase, + passphrase_always_on_device=force_on_device, )