2016-07-02 08:58:56 +02:00
|
|
|
from .plugin import TrezorCompatiblePlugin, TrezorCompatibleKeyStore
|
2014-07-10 22:44:28 +03:00
|
|
|
|
2015-03-05 17:09:39 +01:00
|
|
|
|
2016-07-02 08:58:56 +02:00
|
|
|
class TrezorKeyStore(TrezorCompatibleKeyStore):
|
2016-08-21 22:15:17 +02:00
|
|
|
hw_type = 'trezor'
|
2016-01-29 14:58:51 +01:00
|
|
|
device = 'TREZOR'
|
2015-11-23 14:15:25 +01:00
|
|
|
|
2015-12-26 19:42:57 +09:00
|
|
|
class TrezorPlugin(TrezorCompatiblePlugin):
|
2015-12-27 13:56:50 +09:00
|
|
|
firmware_URL = 'https://www.mytrezor.com'
|
|
|
|
|
libraries_URL = 'https://github.com/trezor/python-trezor'
|
2016-05-06 05:44:23 +02:00
|
|
|
minimum_firmware = (1, 3, 3)
|
2016-07-02 08:58:56 +02:00
|
|
|
keystore_class = TrezorKeyStore
|
2016-08-15 12:28:31 +02:00
|
|
|
|
|
|
|
|
def __init__(self, *args):
|
|
|
|
|
try:
|
2017-03-15 12:13:20 +01:00
|
|
|
from . import client
|
2016-08-15 12:28:31 +02:00
|
|
|
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 14:15:29 +02:00
|
|
|
from trezorlib.transport_bridge import BridgeTransport
|
2016-08-15 12:28:31 +02:00
|
|
|
return BridgeTransport(d)
|