mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
protobuf: encode to utf-8 bytestream
This commit is contained in:
parent
094d0b6ffb
commit
753e91dff0
@ -632,7 +632,7 @@ class ProtocolMixin(object):
|
||||
def sign_message(self, coin_name, n, message, script_type=proto.InputScriptType.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")
|
||||
message = normalize_nfc(message).encode('utf-8')
|
||||
return self.call(proto.SignMessage(coin_name=coin_name, address_n=n, message=message, script_type=script_type))
|
||||
|
||||
@expect(proto.SignedIdentity)
|
||||
@ -786,7 +786,7 @@ class ProtocolMixin(object):
|
||||
|
||||
def verify_message(self, coin_name, address, signature, message):
|
||||
# Convert message to UTF8 NFC (seems to be a bitcoin-qt standard)
|
||||
message = normalize_nfc(message).encode("utf-8")
|
||||
message = normalize_nfc(message).encode('utf-8')
|
||||
try:
|
||||
resp = self.call(proto.VerifyMessage(address=address, signature=signature, message=message, coin_name=coin_name))
|
||||
except CallException as e:
|
||||
|
@ -290,7 +290,7 @@ def dump_message(writer, msg):
|
||||
|
||||
elif ftype is UnicodeType:
|
||||
if not isinstance(svalue, bytes):
|
||||
svalue = svalue.encode()
|
||||
svalue = svalue.encode('utf-8')
|
||||
|
||||
dump_uvarint(writer, len(svalue))
|
||||
writer.write(svalue)
|
||||
|
Loading…
Reference in New Issue
Block a user