diff --git a/python/.changelog.d/2100.added b/python/.changelog.d/2100.added new file mode 100644 index 000000000..554cbdad7 --- /dev/null +++ b/python/.changelog.d/2100.added @@ -0,0 +1 @@ +Support generating Electrum-compatible message signatures in CLI. diff --git a/python/src/trezorlib/cli/btc.py b/python/src/trezorlib/cli/btc.py index 697acbf05..4166b6e2e 100644 --- a/python/src/trezorlib/cli/btc.py +++ b/python/src/trezorlib/cli/btc.py @@ -333,6 +333,12 @@ def sign_tx(client: "TrezorClient", json_file: TextIO) -> None: @click.option("-c", "--coin", default=DEFAULT_COIN) @click.option("-n", "--address", required=True, help="BIP-32 path") @click.option("-t", "--script-type", type=ChoiceType(INPUT_SCRIPTS), default="address") +@click.option( + "-e", + "--electrum-compat", + is_flag=True, + help="Generate Electrum-compatible signature", +) @click.argument("message") @with_client def sign_message( @@ -341,10 +347,13 @@ def sign_message( address: str, message: str, script_type: messages.InputScriptType, + electrum_compat: bool, ) -> Dict[str, str]: """Sign message using address of given path.""" address_n = tools.parse_path(address) - res = btc.sign_message(client, coin, address_n, message, script_type) + res = btc.sign_message( + client, coin, address_n, message, script_type, electrum_compat + ) return { "message": message, "address": res.address,