Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addKeystore (keystore, keystorePassword, password, cb) {
let wallet
// Try to generate wallet from keystore
try {
if (keystore.version === 1) wallet = fromV1(keystore, keystorePassword)
else if (keystore.version === 3) wallet = fromV3(keystore, keystorePassword)
else return cb(new Error('Invalid keystore version'))
} catch (e) { return cb(e) }
// Add private key
this.addPrivateKey(wallet._privKey.toString('hex'), password, cb)
}
export function decryptMewV1ToPrivKey (keystore, password)
{
return fromV1(keystore, password).getPrivateKey();
}