mirror of
https://github.com/romanz/amodem.git
synced 2026-04-19 04:36:02 +08:00
trezor: update to latest trezorlib version
This commit is contained in:
@@ -97,9 +97,8 @@ class Trezor(interface.Device):
|
|||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
"""Enumerate and connect to the first USB HID interface."""
|
"""Enumerate and connect to the first USB HID interface."""
|
||||||
for d in self._defs.Transport.enumerate():
|
for transport in self._defs.Transport.enumerate():
|
||||||
log.debug('endpoint: %s', d)
|
log.debug('transport: %s', transport)
|
||||||
transport = self._defs.Transport(d)
|
|
||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
connection = self._defs.Client(transport)
|
connection = self._defs.Client(transport)
|
||||||
self._override_pin_handler(connection)
|
self._override_pin_handler(connection)
|
||||||
@@ -132,7 +131,7 @@ class Trezor(interface.Device):
|
|||||||
result = self.conn.get_public_node(
|
result = self.conn.get_public_node(
|
||||||
n=addr, ecdsa_curve_name=curve_name)
|
n=addr, ecdsa_curve_name=curve_name)
|
||||||
log.debug('result: %s', result)
|
log.debug('result: %s', result)
|
||||||
return result.node.public_key
|
return bytes(result.node.public_key)
|
||||||
|
|
||||||
def _identity_proto(self, identity):
|
def _identity_proto(self, identity):
|
||||||
result = self._defs.IdentityType()
|
result = self._defs.IdentityType()
|
||||||
@@ -154,7 +153,7 @@ class Trezor(interface.Device):
|
|||||||
log.debug('result: %s', result)
|
log.debug('result: %s', result)
|
||||||
assert len(result.signature) == 65
|
assert len(result.signature) == 65
|
||||||
assert result.signature[:1] == b'\x00'
|
assert result.signature[:1] == b'\x00'
|
||||||
return result.signature[1:]
|
return bytes(result.signature[1:])
|
||||||
except self._defs.CallException as e:
|
except self._defs.CallException as e:
|
||||||
msg = '{} error: {}'.format(self, e)
|
msg = '{} error: {}'.format(self, e)
|
||||||
log.debug(msg, exc_info=True)
|
log.debug(msg, exc_info=True)
|
||||||
@@ -173,7 +172,7 @@ class Trezor(interface.Device):
|
|||||||
log.debug('result: %s', result)
|
log.debug('result: %s', result)
|
||||||
assert len(result.session_key) in {65, 33} # NIST256 or Curve25519
|
assert len(result.session_key) in {65, 33} # NIST256 or Curve25519
|
||||||
assert result.session_key[:1] == b'\x04'
|
assert result.session_key[:1] == b'\x04'
|
||||||
return result.session_key
|
return bytes(result.session_key)
|
||||||
except self._defs.CallException as e:
|
except self._defs.CallException as e:
|
||||||
msg = '{} error: {}'.format(self, e)
|
msg = '{} error: {}'.format(self, e)
|
||||||
log.debug(msg, exc_info=True)
|
log.debug(msg, exc_info=True)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
from trezorlib.client import CallException, PinException
|
from trezorlib.client import CallException, PinException
|
||||||
from trezorlib.client import TrezorClient as Client
|
from trezorlib.client import TrezorClient as Client
|
||||||
from trezorlib.messages_pb2 import PassphraseAck, PinMatrixAck
|
from trezorlib.messages import IdentityType, PassphraseAck, PinMatrixAck
|
||||||
from trezorlib.transport_bridge import BridgeTransport
|
from trezorlib.transport_bridge import BridgeTransport
|
||||||
from trezorlib.transport_hid import HidTransport
|
from trezorlib.transport_hid import HidTransport
|
||||||
from trezorlib.types_pb2 import IdentityType
|
|
||||||
|
|||||||
Reference in New Issue
Block a user