From 2be9d0a25aa82f53e0e258448a4d8c19fde8bb52 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Tue, 17 Oct 2017 18:18:03 +0900 Subject: [PATCH] Remove decrypt_message; no longer supported by Trezor or KeepKey --- plugins/trezor/clientbase.py | 2 +- plugins/trezor/plugin.py | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/plugins/trezor/clientbase.py b/plugins/trezor/clientbase.py index 95196c0a4..d76ca84e5 100644 --- a/plugins/trezor/clientbase.py +++ b/plugins/trezor/clientbase.py @@ -229,7 +229,7 @@ class TrezorClientBase(GuiMixin, PrintError): @staticmethod def wrap_methods(cls): - for method in ['apply_settings', 'change_pin', 'decrypt_message', + for method in ['apply_settings', 'change_pin', 'get_address', 'get_public_node', 'load_device_by_mnemonic', 'load_device_by_xprv', 'recovery_device', 'reset_device', 'sign_message', diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py index edfe318ec..639de7c9e 100644 --- a/plugins/trezor/plugin.py +++ b/plugins/trezor/plugin.py @@ -29,14 +29,7 @@ class TrezorCompatibleKeyStore(Hardware_KeyStore): return self.plugin.get_client(self, force_pair) def decrypt_message(self, sequence, message, password): - raise RuntimeError(_('Electrum and %s encryption and decryption are currently incompatible') % self.device) - client = self.get_client() - address_path = self.get_derivation() + "/%d/%d"%sequence - address_n = client.expand_path(address_path) - payload = base64.b64decode(message) - nonce, message, msg_hmac = payload[:33], payload[33:-8], payload[-8:] - result = client.decrypt_message(address_n, nonce, message, msg_hmac) - return result.message + raise RuntimeError(_('Encryption and decryption are not implemented by %s') % self.device) def sign_message(self, sequence, message, password): client = self.get_client() @@ -55,7 +48,7 @@ class TrezorCompatibleKeyStore(Hardware_KeyStore): for txin in tx.inputs(): pubkeys, x_pubkeys = tx.get_sorted_pubkeys(txin) tx_hash = txin['prevout_hash'] - prev_tx[tx_hash] = txin['prev_tx'] + prev_tx[tx_hash] = txin['prev_tx'] for x_pubkey in x_pubkeys: if not is_xpubkey(x_pubkey): continue @@ -96,7 +89,7 @@ class TrezorCompatiblePlugin(HW_PluginBase): # raise self.print_error("cannot connect at", device.path, str(e)) return None - + def _try_bridge(self, device): self.print_error("Trying to connect over Trezor Bridge...") try: