2016-07-01 23:58:56 -07:00
|
|
|
from .plugin import TrezorCompatiblePlugin, TrezorCompatibleKeyStore
|
2014-07-10 12:44:28 -07:00
|
|
|
|
2015-03-05 08:09:39 -08:00
|
|
|
|
2016-07-01 23:58:56 -07:00
|
|
|
class TrezorKeyStore(TrezorCompatibleKeyStore):
|
2016-08-21 13:15:17 -07:00
|
|
|
hw_type = 'trezor'
|
2016-01-29 05:58:51 -08:00
|
|
|
device = 'TREZOR'
|
2015-11-23 05:15:25 -08:00
|
|
|
|
2015-12-26 02:42:57 -08:00
|
|
|
class TrezorPlugin(TrezorCompatiblePlugin):
|
2015-12-26 20:56:50 -08:00
|
|
|
firmware_URL = 'https://www.mytrezor.com'
|
|
|
|
libraries_URL = 'https://github.com/trezor/python-trezor'
|
2016-05-05 20:44:23 -07:00
|
|
|
minimum_firmware = (1, 3, 3)
|
2016-07-01 23:58:56 -07:00
|
|
|
keystore_class = TrezorKeyStore
|
2016-08-15 03:28:31 -07:00
|
|
|
|
|
|
|
def __init__(self, *args):
|
|
|
|
try:
|
|
|
|
import client
|
|
|
|
import trezorlib
|
|
|
|
import trezorlib.ckd_public
|
|
|
|
import trezorlib.transport_hid
|
|
|
|
self.client_class = client.TrezorClient
|
|
|
|
self.ckd_public = trezorlib.ckd_public
|
|
|
|
self.types = trezorlib.client.types
|
|
|
|
self.DEVICE_IDS = trezorlib.transport_hid.DEVICE_IDS
|
|
|
|
self.libraries_available = True
|
|
|
|
except ImportError:
|
|
|
|
self.libraries_available = False
|
|
|
|
TrezorCompatiblePlugin.__init__(self, *args)
|
|
|
|
|
|
|
|
def hid_transport(self, pair):
|
|
|
|
from trezorlib.transport_hid import HidTransport
|
|
|
|
return HidTransport(pair)
|
|
|
|
|
|
|
|
def bridge_transport(self, d):
|
2016-08-13 05:15:29 -07:00
|
|
|
from trezorlib.transport_bridge import BridgeTransport
|
2016-08-15 03:28:31 -07:00
|
|
|
return BridgeTransport(d)
|