@muirglacier/jellyfish-wallet-mnemonic
Version:
A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance for Bitcoin
45 lines • 1.75 kB
TypeScript
/// <reference types="node" />
/**
* @param {string} mnemonic sentence to validate
* @return {boolean} validity
*/
export declare function validateMnemonicSentence(mnemonic: string | string[]): boolean;
/**
* @param {string} word to check if exist in mnemonic english word list
* @return {boolean} validity
*/
export declare function validateMnemonicWord(word: string): boolean;
/**
* Generate a random mnemonic code of length, uses crypto.randomBytes under the hood.
* Defaults to 256-bits of entropy.
* https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
*
* | ENT | CS | ENT+CS | MS |
* +-------+----+--------+------+
* | 128 | 4 | 132 | 12 |
* | 160 | 5 | 165 | 15 |
* | 192 | 6 | 198 | 18 |
* | 224 | 7 | 231 | 21 |
* | 256 | 8 | 264 | 24 |
*
* @param {number} length the sentence length of the mnemonic code
* @param {(number) => Buffer} [rng = randomBytes] cryptographically strong random values generator required
* @return {string[]} generated mnemonic word list, (COLD STORAGE)
*/
export declare function generateMnemonicWords(length?: 12 | 15 | 18 | 21 | 24, rng?: (numOfBytes: number) => Buffer): string[];
/**
* @param {string[]} mnemonic words, (COLD)
* @return {Buffer} HD seed, (HOT) but ideally should not be kept at rest
*/
export declare function mnemonicToSeed(mnemonic: string[]): Buffer;
/**
* @param {string[]} mnemonic words, (COLD)
* @return {Buffer} 32 byte
*/
export declare function mnemonicAsEntropy(mnemonic: string[]): Buffer;
/**
* @param {Buffer} entropy 32 bytes buffer
* @return {string[]} mnemonic words, (COLD)
*/
export declare function entropyAsMnemonic(entropy: Buffer): string[];
//# sourceMappingURL=mnemonic.d.ts.map