Getting rid of all the uneeded logging
This commit is contained in:
parent
4d16737b23
commit
385a4cedbb
@ -19,20 +19,17 @@ module.exports.handler = (argv) => {
|
||||
|
||||
// TODO: validate user backed up mnemonic
|
||||
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
||||
console.log("Seed: ", seed.toString('hex'))
|
||||
const node = bip32.fromSeed(seed);
|
||||
console.log("xpriv: ", node.toBase58());
|
||||
|
||||
// TODO: Get user key password
|
||||
const password = "vanished";
|
||||
// TODO: Encrypt text securely...
|
||||
const encryptedPrivateKey = cryptoUtil.encrypt(node.toBase58(), password);
|
||||
|
||||
console.log("Encrypted Private Key: ", encryptedPrivateKey);
|
||||
|
||||
// Check if a key exist...
|
||||
db.Key.create({
|
||||
encryptedPrivateKey: encryptedPrivateKey,
|
||||
encryptedPrivateKey: encryptedPrivateKey.cipherText,
|
||||
iv: encryptedPrivateKey.iv,
|
||||
name: "FirstKey"
|
||||
}).then(key => {
|
||||
console.log("Successfully created: ", key.name)
|
||||
|
@ -22,19 +22,14 @@ module.exports.handler = (argv) => {
|
||||
// TODO: Load password from config...
|
||||
if(key) {
|
||||
const password = "vanished";
|
||||
|
||||
console.log("Encrypted: ", key.encryptedPrivateKey);
|
||||
|
||||
const decryptedPrivateKey = cryptoUtil.decrypt(key.encryptedPrivateKey, password);
|
||||
console.log("Decrypted: ", decryptedPrivateKey);
|
||||
const masterNode = bip32.fromBase58(decryptedPrivateKey);
|
||||
const iv = key.iv;
|
||||
|
||||
console.log("Node: ", masterNode.toBase58());
|
||||
const decryptedPrivateKey = cryptoUtil.decrypt(key.encryptedPrivateKey, password, iv);
|
||||
const masterNode = bip32.fromBase58(decryptedPrivateKey);
|
||||
|
||||
const derivationPath = `m/${cryptoUtil.randomDerivationPath(true)}`
|
||||
|
||||
const xpubNode = masterNode.derivePath(derivationPath);
|
||||
console.log("Xpub: ", xpubNode.neutered().toBase58());
|
||||
|
||||
// TODO save xpub and derivation path in db...
|
||||
return db.ExtendedPublicKey.create({
|
||||
|
Loading…
x
Reference in New Issue
Block a user