Remove decrypt_message; no longer supported by Trezor or KeepKey
This commit is contained in:
parent
fbb5b23e78
commit
21e0cd9237
|
@ -230,7 +230,7 @@ class TrezorClientBase(GuiMixin, PrintError):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def wrap_methods(cls):
|
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',
|
'get_address', 'get_public_node',
|
||||||
'load_device_by_mnemonic', 'load_device_by_xprv',
|
'load_device_by_mnemonic', 'load_device_by_xprv',
|
||||||
'recovery_device', 'reset_device', 'sign_message',
|
'recovery_device', 'reset_device', 'sign_message',
|
||||||
|
|
|
@ -33,14 +33,7 @@ class TrezorCompatibleKeyStore(Hardware_KeyStore):
|
||||||
return self.plugin.get_client(self, force_pair)
|
return self.plugin.get_client(self, force_pair)
|
||||||
|
|
||||||
def decrypt_message(self, sequence, message, password):
|
def decrypt_message(self, sequence, message, password):
|
||||||
raise RuntimeError(_('Electrum and %s encryption and decryption are currently incompatible') % self.device)
|
raise RuntimeError(_('Encryption and decryption are not implemented by %s') % 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
|
|
||||||
|
|
||||||
def sign_message(self, sequence, message, password):
|
def sign_message(self, sequence, message, password):
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
|
@ -59,7 +52,7 @@ class TrezorCompatibleKeyStore(Hardware_KeyStore):
|
||||||
for txin in tx.inputs():
|
for txin in tx.inputs():
|
||||||
pubkeys, x_pubkeys = tx.get_sorted_pubkeys(txin)
|
pubkeys, x_pubkeys = tx.get_sorted_pubkeys(txin)
|
||||||
tx_hash = txin['prevout_hash']
|
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:
|
for x_pubkey in x_pubkeys:
|
||||||
if not is_xpubkey(x_pubkey):
|
if not is_xpubkey(x_pubkey):
|
||||||
continue
|
continue
|
||||||
|
@ -100,7 +93,7 @@ class TrezorCompatiblePlugin(HW_PluginBase):
|
||||||
# raise
|
# raise
|
||||||
self.print_error("cannot connect at", device.path, str(e))
|
self.print_error("cannot connect at", device.path, str(e))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _try_bridge(self, device):
|
def _try_bridge(self, device):
|
||||||
self.print_error("Trying to connect over Trezor Bridge...")
|
self.print_error("Trying to connect over Trezor Bridge...")
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue