|
|
@ -385,17 +385,25 @@ class TrustedCoinPlugin(BasePlugin): |
|
|
|
f = lambda x: wizard.request_passphrase(seed, x) |
|
|
|
wizard.show_seed_dialog(run_next=f, seed_text=seed) |
|
|
|
|
|
|
|
def get_xkeys(self, seed, passphrase, derivation): |
|
|
|
from electrum.mnemonic import Mnemonic |
|
|
|
from electrum.keystore import bip32_root, bip32_private_derivation |
|
|
|
bip32_seed = Mnemonic.mnemonic_to_seed(seed, passphrase) |
|
|
|
xprv, xpub = bip32_root(bip32_seed, 'standard') |
|
|
|
xprv, xpub = bip32_private_derivation(xprv, "m/", derivation) |
|
|
|
return xprv, xpub |
|
|
|
|
|
|
|
def xkeys_from_seed(self, seed, passphrase): |
|
|
|
words = seed.split() |
|
|
|
n = len(words) |
|
|
|
# old version use long seed phrases |
|
|
|
if n >= 24: |
|
|
|
assert passphrase == '' |
|
|
|
xprv1, xpub1 = keystore.xkeys_from_seed(' '.join(words[0:12]), '', "m/") |
|
|
|
xprv2, xpub2 = keystore.xkeys_from_seed(' '.join(words[12:]), '', "m/") |
|
|
|
xprv1, xpub1 = self.get_xkeys(' '.join(words[0:12]), '', "m/") |
|
|
|
xprv2, xpub2 = self.get_xkeys(' '.join(words[12:]), '', "m/") |
|
|
|
elif n==12: |
|
|
|
xprv1, xpub1 = keystore.xkeys_from_seed(seed, passphrase, "m/0'/") |
|
|
|
xprv2, xpub2 = keystore.xkeys_from_seed(seed, passphrase, "m/1'/") |
|
|
|
xprv1, xpub1 = self.get_xkeys(seed, passphrase, "m/0'/") |
|
|
|
xprv2, xpub2 = self.get_xkeys(seed, passphrase, "m/1'/") |
|
|
|
else: |
|
|
|
raise BaseException('unrecognized seed length') |
|
|
|
return xprv1, xpub1, xprv2, xpub2 |
|
|
|