From 6f6e7c0bccfa4c73f33462cfaab69deff9724292 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Thu, 3 Nov 2016 20:19:24 +0200 Subject: [PATCH] device: allow loading identities from a file (instead of argument) --- trezor_agent/device/__init__.py | 4 +- trezor_agent/device/interface.py | 68 ++++++++++++++++++-------------- trezor_agent/device/keepkey.py | 10 +---- trezor_agent/device/trezor.py | 31 +++++++-------- 4 files changed, 56 insertions(+), 57 deletions(-) diff --git a/trezor_agent/device/__init__.py b/trezor_agent/device/__init__.py index 65e915c..d37e6db 100644 --- a/trezor_agent/device/__init__.py +++ b/trezor_agent/device/__init__.py @@ -16,11 +16,11 @@ DEVICE_TYPES = [ ] -def detect(identity_str, curve_name): +def detect(): """Detect the first available device and return it to the user.""" for device_type in DEVICE_TYPES: try: - with device_type(identity_str, curve_name) as d: + with device_type() as d: return d except interface.NotFoundError as e: log.debug('device not found: %s', e) diff --git a/trezor_agent/device/interface.py b/trezor_agent/device/interface.py index 5baa21e..32bd44e 100644 --- a/trezor_agent/device/interface.py +++ b/trezor_agent/device/interface.py @@ -45,20 +45,6 @@ def identity_to_string(identity_dict): return ''.join(result) -def get_bip32_address(identity_dict, ecdh=False): - """Compute BIP32 derivation address according to SLIP-0013/0017.""" - index = struct.pack(''.format(identity_to_string(self.identity_dict), self.curve_name) + + def get_bip32_address(self, ecdh=False): + """Compute BIP32 derivation address according to SLIP-0013/0017.""" + index = struct.pack('