1
0

trustedcoin: use 12-word seeds with separate derivations

This commit is contained in:
ThomasV
2016-09-27 13:21:25 +02:00
parent 997dd17933
commit 296f30b924
3 changed files with 28 additions and 19 deletions

View File

@@ -814,3 +814,10 @@ def bip32_private_key(sequence, k, chain):
for i in sequence:
k, chain = CKD_priv(k, chain, i)
return SecretToASecret(k, True)
def xkeys_from_seed(seed, derivation):
from mnemonic import Mnemonic
xprv, xpub = bip32_root(Mnemonic.mnemonic_to_seed(seed, ''))
xprv, xpub = bip32_private_derivation(xprv, "m/", derivation)
return xprv, xpub

View File

@@ -710,16 +710,6 @@ def from_xprv(xprv):
k.xpub = xpub
return k
def xprv_from_seed(seed):
# do not store the seed, only the master xprv
xprv, xpub = bip32_root(Mnemonic.mnemonic_to_seed(seed, ''))
return from_xprv(xprv)
def xpub_from_seed(seed):
# store only master xpub
xprv, xpub = bip32_root(Mnemonic.mnemonic_to_seed(seed,''))
return from_xpub(xpub)
def from_keys(text):
if is_xprv(text):
k = from_xprv(text)