@polkadot/util-crypto
Version:
A collection of useful crypto utilities for @polkadot
9 lines (8 loc) • 377 B
JavaScript
import { hasBigInt } from '@polkadot/util';
import { bip39ToEntropy, isReady } from '@polkadot/wasm-crypto';
import { mnemonicToEntropy as jsToEntropy } from './bip39.js';
export function mnemonicToEntropy(mnemonic, wordlist, onlyJs) {
return !hasBigInt || (!wordlist && !onlyJs && isReady())
? bip39ToEntropy(mnemonic)
: jsToEntropy(mnemonic, wordlist);
}