Skip to content

Commit

Permalink
Added some debug into to mnemonic extraction.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Feb 9, 2017
1 parent a596068 commit 514c3a6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/extract-mnemonic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,17 @@ function extractMnemonic(json, password) {
var mnemonic = bip39.entropyToMnemonic(aes.decrypt(cipherText))
var root = HDNode.fromSeedBuffer(bip39.mnemonicToSeed(mnemonic));
var node = root.derivePath("m/44'/60'/0'/0/0");
var privateKey = node.keyPair.d.toBuffer(32);
var publicKey = node.keyPair.Q.getEncoded(false);
var computedAddress = keccak256(publicKey.slice(1)).substring(24);
if (computedAddress !== address) {
reject(new Error('wrong password'));
return;
}
//console.log('Mnemonic Phrase: ' + mnemonic);
//console.log('Private Key: 0x' + privateKey.toString('hex'));
//console.log('Public Key: 0x' + publicKey.toString('hex'));
//console.log('Address: 0x' + address);
resolve(mnemonic);
}
});
Expand Down

0 comments on commit 514c3a6

Please sign in to comment.