From c8dcd010fcb4dc5f256dbd644bc80af1a18e5df0 Mon Sep 17 00:00:00 2001 From: junderw Date: Thu, 11 Apr 2019 16:00:19 +0900 Subject: [PATCH] Fix mnemonicToSeed password arg to optional --- ts_src/index.ts | 7 +++++-- types/index.d.ts | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ts_src/index.ts b/ts_src/index.ts index d51b7d4..849d1b0 100644 --- a/ts_src/index.ts +++ b/ts_src/index.ts @@ -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 { return new Promise( (resolve, reject): void => { diff --git a/types/index.d.ts b/types/index.d.ts index 69e0381..5c34d76 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,6 @@ /// -export declare function mnemonicToSeedSync(mnemonic: string, password: string): Buffer; -export declare function mnemonicToSeed(mnemonic: string, password: string): Promise; +export declare function mnemonicToSeedSync(mnemonic: string, password?: string): Buffer; +export declare function mnemonicToSeed(mnemonic: string, password?: string): Promise; 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;