-WIP-electrum-btcp/plugins/trezor/trezor.py

38 lines
1.3 KiB
Python
Raw Normal View History

from .plugin import TrezorCompatiblePlugin, TrezorCompatibleKeyStore
2014-07-10 12:44:28 -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'
class TrezorPlugin(TrezorCompatiblePlugin):
firmware_URL = 'https://wallet.trezor.io'
libraries_URL = 'https://github.com/trezor/python-trezor'
minimum_firmware = (1, 5, 2)
keystore_class = TrezorKeyStore
def __init__(self, *args):
try:
2017-03-15 04:13:20 -07:00
from . import client
import trezorlib
import trezorlib.ckd_public
import trezorlib.messages
import trezorlib.device
self.client_class = client.TrezorClient
self.ckd_public = trezorlib.ckd_public
self.types = trezorlib.messages
self.DEVICE_IDS = ('TREZOR',)
self.libraries_available = True
except ImportError:
self.libraries_available = False
TrezorCompatiblePlugin.__init__(self, *args)
def enumerate(self):
from trezorlib.device import TrezorDevice
from electrum.plugins import Device
return [Device(str(d), -1, str(d), 'TREZOR', 0) for d in TrezorDevice.enumerate()]
def transport(self, device):
from trezorlib.device import TrezorDevice
return TrezorDevice.find_by_path(device.path)