Browse Source

hardware multisig: partial bip45 derivation

master
ThomasV 9 years ago
parent
commit
4d4171fe53
  1. 16
      lib/base_wizard.py

16
lib/base_wizard.py

@ -208,9 +208,14 @@ class BaseWizard(object):
def on_device(self, name, device_info): def on_device(self, name, device_info):
self.plugin = self.plugins.get_plugin(name) self.plugin = self.plugins.get_plugin(name)
self.plugin.setup_device(device_info, self) self.plugin.setup_device(device_info, self)
print device_info if self.wallet_type=='multisig':
f = lambda x: self.run('on_hardware_account_id', name, device_info, int(x)) # There is no general standard for HD multisig.
self.account_id_dialog(f) # This is partially compatible with BIP45; assumes index=0
self.on_hw_derivation(name, device_info, "m/45'/0")
else:
from keystore import bip44_derivation
f = lambda x: self.run('on_hw_derivation', name, device_info, bip44_derivation(int(x)))
self.account_id_dialog(f)
def account_id_dialog(self, f): def account_id_dialog(self, f):
message = '\n'.join([ message = '\n'.join([
@ -225,9 +230,8 @@ class BaseWizard(object):
return False return False
self.line_dialog(run_next=f, title=_('Account Number'), message=message, default='0', test=is_int) self.line_dialog(run_next=f, title=_('Account Number'), message=message, default='0', test=is_int)
def on_hardware_account_id(self, name, device_info, account_id): def on_hw_derivation(self, name, device_info, derivation):
from keystore import hardware_keystore, bip44_derivation from keystore import hardware_keystore
derivation = bip44_derivation(int(account_id))
xpub = self.plugin.get_xpub(device_info.device.id_, derivation, self) xpub = self.plugin.get_xpub(device_info.device.id_, derivation, self)
if xpub is None: if xpub is None:
self.show_error('Cannot read xpub from device') self.show_error('Cannot read xpub from device')

Loading…
Cancel
Save