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