mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-15 09:50:57 +00:00
adapt new API of EncryptMessage / DecryptMessage
This commit is contained in:
parent
fc64a40769
commit
cfc8fdc214
10
cmdtr.py
10
cmdtr.py
@ -150,16 +150,14 @@ class Commands(object):
|
|||||||
return self.client.verify_message(args.address, signature, args.message)
|
return self.client.verify_message(args.address, signature, args.message)
|
||||||
|
|
||||||
def encrypt_message(self, args):
|
def encrypt_message(self, args):
|
||||||
address_n = self.client.expand_path(args.n)
|
|
||||||
pubkey = binascii.unhexlify(args.pubkey)
|
pubkey = binascii.unhexlify(args.pubkey)
|
||||||
ret = self.client.encrypt_message(address_n, pubkey, args.message)
|
ret = self.client.encrypt_message(pubkey, args.message, args.display_only)
|
||||||
return binascii.hexlify(ret)
|
return binascii.hexlify(ret)
|
||||||
|
|
||||||
def decrypt_message(self, args):
|
def decrypt_message(self, args):
|
||||||
address_n = self.client.expand_path(args.n)
|
address_n = self.client.expand_path(args.n)
|
||||||
pubkey = binascii.unhexlify(args.pubkey)
|
|
||||||
message = binascii.unhexlify(args.message)
|
message = binascii.unhexlify(args.message)
|
||||||
ret = self.client.decrypt_message(address_n, pubkey, message, args.show_only)
|
ret = self.client.decrypt_message(address_n, message)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def encrypt_keyvalue(self, args):
|
def encrypt_keyvalue(self, args):
|
||||||
@ -264,16 +262,14 @@ class Commands(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
encrypt_message.arguments = (
|
encrypt_message.arguments = (
|
||||||
(('-n', '-address'), {'type': str}),
|
|
||||||
(('pubkey',), {'type': str}),
|
(('pubkey',), {'type': str}),
|
||||||
(('message',), {'type': str}),
|
(('message',), {'type': str}),
|
||||||
|
(('-d', '--display-only'), {'action': 'store_true', 'default': False}),
|
||||||
)
|
)
|
||||||
|
|
||||||
decrypt_message.arguments = (
|
decrypt_message.arguments = (
|
||||||
(('-n', '-address'), {'type': str}),
|
(('-n', '-address'), {'type': str}),
|
||||||
(('pubkey',), {'type': str}),
|
|
||||||
(('message',), {'type': str}),
|
(('message',), {'type': str}),
|
||||||
(('-s', '--show-only'), {'action': 'store_true', 'default': False}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
verify_message.arguments = (
|
verify_message.arguments = (
|
||||||
|
@ -418,15 +418,14 @@ class ProtocolMixin(object):
|
|||||||
|
|
||||||
@field('payload')
|
@field('payload')
|
||||||
@expect(proto.Success)
|
@expect(proto.Success)
|
||||||
def encrypt_message(self, n, pubkey, message):
|
def encrypt_message(self, pubkey, message, display_only):
|
||||||
n = self._convert_prime(n)
|
return self.call(proto.EncryptMessage(pubkey=pubkey, message=message, display_only=display_only))
|
||||||
return self.call(proto.EncryptMessage(address_n=n, pubkey=pubkey, message=message))
|
|
||||||
|
|
||||||
@field('payload')
|
@field('payload')
|
||||||
@expect(proto.Success)
|
@expect(proto.Success)
|
||||||
def decrypt_message(self, n, pubkey, message, show_only):
|
def decrypt_message(self, n, message):
|
||||||
n = self._convert_prime(n)
|
n = self._convert_prime(n)
|
||||||
return self.call(proto.DecryptMessage(address_n=n, pubkey=pubkey, message=message, show_only=show_only))
|
return self.call(proto.DecryptMessage(address_n=n, message=message))
|
||||||
|
|
||||||
@field('payload')
|
@field('payload')
|
||||||
@expect(proto.Success)
|
@expect(proto.Success)
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user