Skip to content

Commit

Permalink
Allow specifying the length of entropy when generating a new mnemonic (
Browse files Browse the repository at this point in the history
…#20)

* Allow specifying the length of entropy when generating a new mnemonic

* Bump version
  • Loading branch information
Mrtenz authored Oct 18, 2021
1 parent 56689f9 commit ca00615
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mycrypto/wallets",
"version": "1.3.4",
"version": "1.3.5",
"description": "Wallet abstractions to be used throughout the MyCrypto product suite.",
"repository": "MyCryptoHQ/wallets",
"author": "MyCrypto",
Expand Down
7 changes: 5 additions & 2 deletions src/implementations/deterministic/mnemonic-phrase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ export class MnemonicPhrase extends DeterministicWallet {
return new PrivateKey(node.derivePath(index.toString(10)).privateKey);
}

static create(passphrase?: string): MnemonicPhrase {
const entropy = crypto.randomBytes(MNEMONIC_ENTROPY_BYTES);
static create(
passphrase?: string,
entropyBytes: number = MNEMONIC_ENTROPY_BYTES
): MnemonicPhrase {
const entropy = crypto.randomBytes(entropyBytes);
const mnemonicPhrase = entropyToMnemonic(entropy);

return new MnemonicPhrase(mnemonicPhrase, passphrase);
Expand Down

0 comments on commit ca00615

Please sign in to comment.