Skip to content

Instantly share code, notes, and snippets.

@pinheadmz
Created June 8, 2021 00:11
Show Gist options
  • Save pinheadmz/3aacf83e8ee16d0956bf7107b918bf34 to your computer and use it in GitHub Desktop.
Save pinheadmz/3aacf83e8ee16d0956bf7107b918bf34 to your computer and use it in GitHub Desktop.
diff --git a/lib/hd/hd.js b/lib/hd/hd.js
index d284171ef..0ca02ec3c 100644
--- a/lib/hd/hd.js
+++ b/lib/hd/hd.js
@@ -58,12 +58,12 @@ HD.fromSeed = function fromSeed(options) {
/**
* Instantiate an hd private key from a mnemonic.
* @param {Mnemonic} mnemonic
- * @param {String?} passphrase
+ * @param {String?} bip39Passphrase
* @returns {HDPrivateKey}
*/
-HD.fromMnemonic = function fromMnemonic(mnemonic, passphrase) {
- return HDPrivateKey.fromMnemonic(mnemonic, passphrase);
+HD.fromMnemonic = function fromMnemonic(mnemonic, bip39Passphrase) {
+ return HDPrivateKey.fromMnemonic(mnemonic, bip39Passphrase);
};
/**
diff --git a/lib/wallet/http.js b/lib/wallet/http.js
index 3d7e8ff0b..d6db20cd4 100644
--- a/lib/wallet/http.js
+++ b/lib/wallet/http.js
@@ -299,7 +299,7 @@ class HTTP extends Server {
m: valid.u32('m'),
n: valid.u32('n'),
passphrase: valid.str('passphrase'),
- 'bip39-passphrase': valid.str('bip39-passphrase'),
+ bip39Passphrase: valid.str('bip39Passphrase'),
master: master,
mnemonic: mnemonic,
accountKey: accountKey,
diff --git a/lib/wallet/wallet.js b/lib/wallet/wallet.js
index 381a42d44..04d97a482 100644
--- a/lib/wallet/wallet.js
+++ b/lib/wallet/wallet.js
@@ -108,7 +108,7 @@ class Wallet extends EventEmitter {
'Must create wallet with hd private key.');
} else {
mnemonic = new Mnemonic(options.mnemonic);
- key = HD.fromMnemonic(mnemonic, options['bip39-passphrase']);
+ key = HD.fromMnemonic(mnemonic, options.bip39Passphrase);
}
this.master.fromKey(key, mnemonic);
diff --git a/test/wallet-test.js b/test/wallet-test.js
index e6ddc3044..1bf860ddf 100644
--- a/test/wallet-test.js
+++ b/test/wallet-test.js
@@ -1357,7 +1357,7 @@ describe('Wallet', function() {
assert.bufferEqual(key.getHash(), addr.getHash());
});
- it('should yield different keys when bip39-passphrase is supplied', async () => {
+ it('should yield different keys when bip39Passphrase is supplied', async () => {
const wallet = await wdb.create({
mnemonic: {bits: 256}
});
@@ -1368,7 +1368,7 @@ describe('Wallet', function() {
const wallet3 = await wdb.create({
mnemonic: wallet.master.mnemonic.toString(),
- 'bip39-passphrase': 'test'
+ bip39Passphrase: 'test'
});
assert.equal(wallet.master.key.xprivkey(), wallet2.master.key.xprivkey());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment