Fix mnemonicToSeed password arg to optional

This commit is contained in:
junderw 2019-04-11 16:00:19 +09:00
parent d5fb1edc68
commit c8dcd010fc
No known key found for this signature in database
GPG Key ID: B256185D3A971908
2 changed files with 7 additions and 4 deletions

View File

@ -39,7 +39,10 @@ function salt(password?: string): string {
return 'mnemonic' + (password || '');
}
export function mnemonicToSeedSync(mnemonic: string, password: string): Buffer {
export function mnemonicToSeedSync(
mnemonic: string,
password?: string,
): Buffer {
const mnemonicBuffer = Buffer.from(
(mnemonic || '').normalize('NFKD'),
'utf8',
@ -54,7 +57,7 @@ export function mnemonicToSeedSync(mnemonic: string, password: string): Buffer {
export function mnemonicToSeed(
mnemonic: string,
password: string,
password?: string,
): Promise<Buffer> {
return new Promise(
(resolve, reject): void => {

4
types/index.d.ts vendored
View File

@ -1,6 +1,6 @@
/// <reference types="node" />
export declare function mnemonicToSeedSync(mnemonic: string, password: string): Buffer;
export declare function mnemonicToSeed(mnemonic: string, password: string): Promise<Buffer>;
export declare function mnemonicToSeedSync(mnemonic: string, password?: string): Buffer;
export declare function mnemonicToSeed(mnemonic: string, password?: string): Promise<Buffer>;
export declare function mnemonicToEntropy(mnemonic: string, wordlist?: string[]): string;
export declare function entropyToMnemonic(entropy: Buffer | string, wordlist?: string[]): string;
export declare function generateMnemonic(strength?: number, rng?: (size: number) => Buffer, wordlist?: string[]): string;