Skip to content

Commit

Permalink
Merge pull request bitcoinjs#113 from bitcoinjs/fixTypes
Browse files Browse the repository at this point in the history
Fix mnemonicToSeed password arg to optional
  • Loading branch information
junderw authored Apr 11, 2019
2 parents d5fb1ed + 743c7c0 commit 6878403
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bip39",
"version": "3.0.0",
"version": "3.0.1",
"description": "Bitcoin BIP39: Mnemonic code for generating deterministic keys",
"main": "src/index.js",
"types": "./types/index.d.ts",
Expand Down
7 changes: 5 additions & 2 deletions ts_src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 => {
Expand Down
4 changes: 2 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 6878403

Please sign in to comment.