mirror of
https://github.com/romanz/amodem.git
synced 2026-03-17 23:26:01 +08:00
24 lines
690 B
Python
24 lines
690 B
Python
''' Thin wrapper around trezorlib. '''
|
|
|
|
|
|
def client():
|
|
# pylint: disable=import-error
|
|
from trezorlib.client import TrezorClient
|
|
from trezorlib.transport_hid import HidTransport
|
|
from trezorlib.messages_pb2 import PassphraseAck
|
|
|
|
devices = list(HidTransport.enumerate())
|
|
if len(devices) != 1:
|
|
msg = '{:d} Trezor devices found'.format(len(devices))
|
|
raise IOError(msg)
|
|
|
|
t = TrezorClient(HidTransport(devices[0]))
|
|
t.callback_PassphraseRequest = lambda msg: PassphraseAck(passphrase='')
|
|
return t
|
|
|
|
|
|
def identity_type(**kwargs):
|
|
# pylint: disable=import-error
|
|
from trezorlib.types_pb2 import IdentityType
|
|
return IdentityType(**kwargs)
|