1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 11:09:01 +00:00

new message SetU2FCounter

This commit is contained in:
Jochen Hoenicke 2016-06-12 23:49:52 +02:00
parent c81cd11253
commit e51fb2078f
No known key found for this signature in database
GPG Key ID: 65B10C0466560648
2 changed files with 15 additions and 0 deletions

View File

@ -288,6 +288,10 @@ class Commands(object):
ret = self.client.decrypt_keyvalue(address_n, args.key, args.value.decode("hex"))
return ret
def set_u2f_counter(self, args):
ret = self.client.set_u2f_counter(args.counter)
return ret
def firmware_update(self, args):
import requests
if args.file:
@ -343,6 +347,7 @@ class Commands(object):
decrypt_message.help = 'Decrypt message'
encrypt_keyvalue.help = 'Encrypt value by given key and path'
decrypt_keyvalue.help = 'Decrypt value by given key and path'
set_u2f_counter.help = 'Set U2F counter'
firmware_update.help = 'Upload new firmware to device (must be in bootloader mode)'
get_address.arguments = (
@ -460,6 +465,10 @@ class Commands(object):
(('-d', '--show-display'), {'action': 'store_true', 'default': False}),
)
set_u2f_counter.arguments = (
(('counter',), {'type': int}),
)
firmware_update.arguments = (
(('-f', '--file'), {'type': str}),
(('-u', '--url'), {'type': str}),

View File

@ -512,6 +512,12 @@ class ProtocolMixin(object):
def get_ecdh_session_key(self, identity, peer_public_key, ecdsa_curve_name=DEFAULT_CURVE):
return self.call(proto.GetECDHSessionKey(identity=identity, peer_public_key=peer_public_key, ecdsa_curve_name=ecdsa_curve_name))
@field('message')
@expect(proto.Success)
def set_u2f_counter(self, u2f_counter):
ret = self.call(proto.SetU2FCounter(u2f_counter = u2f_counter))
return ret
def verify_message(self, address, signature, message):
# Convert message to UTF8 NFC (seems to be a bitcoin-qt standard)
message = normalize_nfc(message)