@metamask/eth-hd-keyring
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -9,2 +9,7 @@ # Changelog | ||
## [4.0.2] | ||
### Added | ||
- Add parameter validation for constructor / `deserialize` method ([#65](https://github.com/MetaMask/eth-hd-keyring/pull/65)) | ||
- As of v4.0.0, the `deserialize` method (which is also called by the constructor) can no longer generate accounts with the `numberOfAccounts` option without a `mnemonic`. Prior to v4.0.0, a mnemonic was generated automatically if it was missing, but we now want to ensure a mnemonic is never implicitly generated without the caller knowing. | ||
## [4.0.1] | ||
@@ -26,6 +31,8 @@ ### Added | ||
- Class variable `mnemonic` on `HdKeyring` can now be either type `Buffer` or type `string`. | ||
- Deserialize method (and `HdKeyring` constructor by extension) can no longer be passed an options object containing a value for `numberOfAccounts` if it is not also containing a value for `mnemonic`. | ||
- Package name changed from `eth-hd-keyring` to `@metamask/eth-hd-keyring`. | ||
[Unreleased]: https://github.com/MetaMask/eth-hd-keyring/compare/v4.0.1...HEAD | ||
[Unreleased]: https://github.com/MetaMask/eth-hd-keyring/compare/v4.0.2...HEAD | ||
[4.0.2]: https://github.com/MetaMask/eth-hd-keyring/compare/v4.0.1...v4.0.2 | ||
[4.0.1]: https://github.com/MetaMask/eth-hd-keyring/compare/v4.0.0...v4.0.1 | ||
[4.0.0]: https://github.com/MetaMask/eth-hd-keyring/releases/tag/v4.0.0 |
@@ -36,2 +36,8 @@ const { hdkey } = require('ethereumjs-wallet'); | ||
deserialize(opts = {}) { | ||
if (opts.numberOfAccounts && !opts.mnemonic) { | ||
throw new Error( | ||
'Eth-Hd-Keyring: Deserialize method cannot be called with an opts value for numberOfAccounts and no menmonic', | ||
); | ||
} | ||
if (this.root) { | ||
@@ -38,0 +44,0 @@ throw new Error( |
{ | ||
"name": "@metamask/eth-hd-keyring", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "A simple standard interface for a seed phrase generated set of Ethereum accounts.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -70,2 +70,13 @@ const { | ||
}); | ||
it('throws when numberOfAccounts is passed with no mnemonic', () => { | ||
expect( | ||
() => | ||
new HdKeyring({ | ||
numberOfAccounts: 2, | ||
}), | ||
).toThrow( | ||
'Eth-Hd-Keyring: Deserialize method cannot be called with an opts value for numberOfAccounts and no menmonic', | ||
); | ||
}); | ||
}); | ||
@@ -72,0 +83,0 @@ |
39567
632
17
2
2
0
8