Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function hdkeyFromMnemonic(mnemonic: string): Object {
if (!bip39.validateMnemonic(mnemonic)) {
throw new Error('invalid mnemonic');
}
return HDKey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic));
}