mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
add SignMessage.script_type
This commit is contained in:
parent
de6402e95e
commit
8133317172
11
trezorctl
11
trezorctl
@ -437,11 +437,18 @@ def get_public_node(client, coin, address, curve, show_display):
|
||||
@cli.command(help='Sign message using address of given path.')
|
||||
@click.option('-c', '--coin', default='Bitcoin')
|
||||
@click.option('-n', '-address')
|
||||
@click.option('-t', '--script-type', type=click.Choice(['address', 'segwit', 'p2shsegwit']), default='address')
|
||||
@click.argument('message')
|
||||
@click.pass_obj
|
||||
def sign_message(client, coin, address, message):
|
||||
def sign_message(client, coin, address, message, script_type):
|
||||
address_n = client.expand_path(address)
|
||||
res = client.sign_message(coin, address_n, message)
|
||||
typemap = {
|
||||
'address': types.SPENDADDRESS,
|
||||
'segwit': types.SPENDWITNESS,
|
||||
'p2shsegwit': types.SPENDP2SHWITNESS,
|
||||
}
|
||||
script_type = typemap[script_type]
|
||||
res = client.sign_message(coin, address_n, message, script_type)
|
||||
return {
|
||||
'message': message,
|
||||
'address': res.address,
|
||||
|
@ -644,11 +644,11 @@ class ProtocolMixin(object):
|
||||
return ret
|
||||
|
||||
@expect(proto.MessageSignature)
|
||||
def sign_message(self, coin_name, n, message):
|
||||
def sign_message(self, coin_name, n, message, script_type=types.SPENDADDRESS):
|
||||
n = self._convert_prime(n)
|
||||
# Convert message to UTF8 NFC (seems to be a bitcoin-qt standard)
|
||||
message = normalize_nfc(message).encode("utf-8")
|
||||
return self.call(proto.SignMessage(coin_name=coin_name, address_n=n, message=message))
|
||||
return self.call(proto.SignMessage(coin_name=coin_name, address_n=n, message=message, script_type=script_type))
|
||||
|
||||
@expect(proto.SignedIdentity)
|
||||
def sign_identity(self, identity, challenge_hidden, challenge_visual, ecdsa_curve_name=DEFAULT_CURVE):
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: types.proto
|
||||
# libprotoc 3.3.0
|
||||
# trezor-common 2eb9c7e352f708506d910f2d5b9aac1e85cafa10
|
||||
# trezor-common 00900951e072aaa2d7c48da807bb0032b6b898c1
|
||||
|
||||
import sys
|
||||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
|
||||
|
Loading…
Reference in New Issue
Block a user