commit 96c7f9e7cbc0176ce14017491cbfb1d58d8386f2
parent c298860e117f72fb960cff84faeabdb2439029ba
Author: Neil Booth <kyuupichan@gmail.com>
Date: Sat, 26 Dec 2015 12:23:35 +0900
Partially revert prior
Diffstat:
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/plugins/keepkey/keepkey.py b/plugins/keepkey/keepkey.py
@@ -93,9 +93,15 @@ class KeepKeyWallet(BIP32_HD_Wallet):
return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64)
def derive_xkeys(self, root, derivation, password):
- derivation = derivation.replace(self.root_name,"44'/0'/")
- xpub = self.get_public_key(derivation)
- return xpub, None
+ x = self.master_private_keys.get(root)
+ if x:
+ root_xprv = pw_decode(x, password)
+ xprv, xpub = bip32_private_derivation(root_xprv, root, derivation)
+ return xpub, xprv
+ else:
+ derivation = derivation.replace(self.root_name,"44'/0'/")
+ xpub = self.get_public_key(derivation)
+ return xpub, None
def get_public_key(self, bip32_path):
address_n = self.plugin.get_client().expand_path(bip32_path)
diff --git a/plugins/trezor/trezor.py b/plugins/trezor/trezor.py
@@ -92,9 +92,15 @@ class TrezorWallet(BIP32_HD_Wallet):
return pbkdf2.PBKDF2(mnemonic, 'mnemonic' + passphrase, iterations = PBKDF2_ROUNDS, macmodule = hmac, digestmodule = hashlib.sha512).read(64)
def derive_xkeys(self, root, derivation, password):
- derivation = derivation.replace(self.root_name,"44'/0'/")
- xpub = self.get_public_key(derivation)
- return xpub, None
+ x = self.master_private_keys.get(root)
+ if x:
+ root_xprv = pw_decode(x, password)
+ xprv, xpub = bip32_private_derivation(root_xprv, root, derivation)
+ return xpub, xprv
+ else:
+ derivation = derivation.replace(self.root_name,"44'/0'/")
+ xpub = self.get_public_key(derivation)
+ return xpub, None
def get_public_key(self, bip32_path):
address_n = self.plugin.get_client().expand_path(bip32_path)