mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
feat(trezorctl): Support generating Electrum-compatible message signatures.
This commit is contained in:
parent
d52a59e37b
commit
bf2baf798f
1
python/.changelog.d/2100.added
Normal file
1
python/.changelog.d/2100.added
Normal file
@ -0,0 +1 @@
|
|||||||
|
Support generating Electrum-compatible message signatures in CLI.
|
@ -333,6 +333,12 @@ def sign_tx(client: "TrezorClient", json_file: TextIO) -> None:
|
|||||||
@click.option("-c", "--coin", default=DEFAULT_COIN)
|
@click.option("-c", "--coin", default=DEFAULT_COIN)
|
||||||
@click.option("-n", "--address", required=True, help="BIP-32 path")
|
@click.option("-n", "--address", required=True, help="BIP-32 path")
|
||||||
@click.option("-t", "--script-type", type=ChoiceType(INPUT_SCRIPTS), default="address")
|
@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")
|
@click.argument("message")
|
||||||
@with_client
|
@with_client
|
||||||
def sign_message(
|
def sign_message(
|
||||||
@ -341,10 +347,13 @@ def sign_message(
|
|||||||
address: str,
|
address: str,
|
||||||
message: str,
|
message: str,
|
||||||
script_type: messages.InputScriptType,
|
script_type: messages.InputScriptType,
|
||||||
|
electrum_compat: bool,
|
||||||
) -> Dict[str, str]:
|
) -> Dict[str, str]:
|
||||||
"""Sign message using address of given path."""
|
"""Sign message using address of given path."""
|
||||||
address_n = tools.parse_path(address)
|
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 {
|
return {
|
||||||
"message": message,
|
"message": message,
|
||||||
"address": res.address,
|
"address": res.address,
|
||||||
|
Loading…
Reference in New Issue
Block a user