@metamask/eth-hd-keyring 7.0.1 → 7.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,93 +7,132 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [7.0.3]
11
+
12
+ ### Changed
13
+
14
+ - Bump `@metamask/*` and `@lavamoat/*` dependencies ([#46](https://github.com/MetaMask/accounts/pull/46))
15
+ - Move `deepmerge` to `devDependencies` ([#44](https://github.com/MetaMask/accounts/pull/44))
16
+
17
+ ## [7.0.2]
18
+
19
+ ### Changed
20
+
21
+ - Convert to monorepo
22
+ - Package name does not change (`@metamask/eth-hd-keyring`) and sources have been moved to: `packages/keyring-eth-hd`.
23
+ - You can find all the changes [here](https://github.com/MetaMask/accounts/compare/6da58b4...38794aa).
24
+
9
25
  ## [7.0.1]
26
+
10
27
  ### Changed
28
+
11
29
  - **BREAKING:** Update minimum Node.js version from v14 to v16 ([#98](https://github.com/MetaMask/eth-hd-keyring/pull/98))
12
30
  - Bump dependencies ([#99](https://github.com/MetaMask/eth-hd-keyring/pull/99))
13
- * **BREAKING:** `@metamask/eth-sig-util` from `^6.0.0` to `^7.0.0`
14
- * **BREAKING:** `@metamask/utils` from `^5.0.2` to `^8.1.0`
15
- * `@ethereumjs/tx` from `^4.1.1` to `^4.2.0`
16
- * `@ethereumjs/util` from `8.0.5` to `^8.1.0`
17
- * `ethereum-cryptography` from `^1.2.0` to `^2.1.2`
31
+ - **BREAKING:** `@metamask/eth-sig-util` from `^6.0.0` to `^7.0.0`
32
+ - **BREAKING:** `@metamask/utils` from `^5.0.2` to `^8.1.0`
33
+ - `@ethereumjs/tx` from `^4.1.1` to `^4.2.0`
34
+ - `@ethereumjs/util` from `8.0.5` to `^8.1.0`
35
+ - `ethereum-cryptography` from `^1.2.0` to `^2.1.2`
18
36
 
19
37
  ## [7.0.0] [RETRACTED]
38
+
20
39
  ### Changed
40
+
21
41
  - This version was retracted due to a bug causing code to be missing from published package.
22
42
 
23
43
  ## [6.0.2]
44
+
24
45
  ### Fixed
46
+
25
47
  - Bump dependencies ([#94](https://github.com/MetaMask/eth-hd-keyring/pull/94))
26
- * `@ethereumjs/util` from `^8.0.2` to `^8.1.0`
27
- * `@metamask/eth-sig-util` from `^5.0.2` to `^6.0.0`
28
- * `@metamask/scure-bip39` from `^2.0.3` to `^2.1.0`
29
- * `@metamask/utils` from `^5.0.0` to `^5.0.2`
30
- * `ethereum-cryptography` from `^1.1.2` to `^1.2.0`
48
+ - `@ethereumjs/util` from `^8.0.2` to `^8.1.0`
49
+ - `@metamask/eth-sig-util` from `^5.0.2` to `^6.0.0`
50
+ - `@metamask/scure-bip39` from `^2.0.3` to `^2.1.0`
51
+ - `@metamask/utils` from `^5.0.0` to `^5.0.2`
52
+ - `ethereum-cryptography` from `^1.1.2` to `^1.2.0`
31
53
 
32
54
  ## [6.0.1] [RETRACTED]
55
+
33
56
  ### Changed
57
+
34
58
  - This version was retracted due to a bug causing code to be missing from published package.
35
59
 
36
60
  ## [6.0.0]
61
+
37
62
  ### Changed
63
+
38
64
  - Revert mnemonic serialization format from `Record<number, number>` (i.e. a stringified `Uint8Array`) which was introduced in v5.0.0 back to an untyped array of utf8 encoded bytes, which was the format prior to v5.0.0 ([#81](https://github.com/MetaMask/eth-hd-keyring/pull/81))
39
65
 
40
66
  ## [5.0.1] [DEPRECATED]
67
+
41
68
  ### Removed
69
+
42
70
  - Remove prepack script and references in order to fix publish release flow ([#77](https://github.com/MetaMask/eth-hd-keyring/pull/77))
43
71
 
44
72
  ## [5.0.0] [DEPRECATED]
73
+
45
74
  ### Changed
75
+
46
76
  - **BREAKING**: Update minimum Node.js version from v12 to v14 ([#67](https://github.com/MetaMask/eth-hd-keyring/pull/67))
47
77
  - **BREAKING:** Makes version-specific `signTypedData` methods private ([#71](https://github.com/MetaMask/eth-hd-keyring/pull/71))
48
- - Consumers should use the generic `signTypedData` method and pass the version they'd like as a property in the options argument.
78
+ - Consumers should use the generic `signTypedData` method and pass the version they'd like as a property in the options argument.
49
79
  - **BREAKING:** Makes the `wallets` property private ([#71](https://github.com/MetaMask/eth-hd-keyring/pull/71))
50
- - Consumers should not use this property as it is intended for internal use only.
80
+ - Consumers should not use this property as it is intended for internal use only.
51
81
  - **BREAKING:** Makes `getPrivateKeyFor` a private method ([#71](https://github.com/MetaMask/eth-hd-keyring/pull/71))
52
- - Consumers who wish to get the private key for a given account should use the `exportAccount` method.
82
+ - Consumers who wish to get the private key for a given account should use the `exportAccount` method.
53
83
  - **BREAKING:** Bumps browser requirements to those with ES2020 support or greater ([#70](https://github.com/MetaMask/eth-hd-keyring/pull/70))
54
- - This change is introduced in update of `@metamask/eth-sig-util` to v5 and new direct dependency on `ethereumjs/util` v8.0.2
55
- - Replaces use of `ethereumjs-wallet` implementation of hdkey with one from `ethereum-cryptography` and adapts accordingly. ([#69](https://github.com/MetaMask/eth-hd-keyring/pull/69))
84
+ - This change is introduced in update of `@metamask/eth-sig-util` to v5 and new direct dependency on `ethereumjs/util` v8.0.2
85
+ - Replaces use of `ethereumjs-wallet` implementation of hdkey with one from `ethereum-cryptography` and adapts accordingly. ([#69](https://github.com/MetaMask/eth-hd-keyring/pull/69))
56
86
  - Replaces `@metamask/bip39` with `@metamask/scure-bip39` ([#67](https://github.com/MetaMask/eth-hd-keyring/pull/67))
57
87
 
58
88
  ### Removed
89
+
59
90
  - **BREAKING:** Remove redundant `newGethSignMessage` method ([#71](https://github.com/MetaMask/eth-hd-keyring/pull/71))
60
- - Consumers can use `signPersonalMessage` method as a replacement for newGethSignMessage.
91
+ - Consumers can use `signPersonalMessage` method as a replacement for newGethSignMessage.
61
92
  - **BREAKING:** `HDKeyring` no longer extends `EventEmitter`, so no `EventEmitter` methods are available on this class ([#70](https://github.com/MetaMask/eth-hd-keyring/pull/70))
62
93
  - Removes `ethereumjs-util` dependency. ([#67](https://github.com/MetaMask/eth-hd-keyring/pull/67))
63
94
 
64
95
  ## [4.0.2]
96
+
65
97
  ### Added
98
+
66
99
  - Add parameter validation for constructor / `deserialize` method ([#65](https://github.com/MetaMask/eth-hd-keyring/pull/65))
67
- - 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.
100
+ - 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.
68
101
 
69
102
  ## [4.0.1]
103
+
70
104
  ### Added
105
+
71
106
  - Add tests to get coverage to 100% ([#62](https://github.com/MetaMask/eth-hd-keyring/pull/62))
72
107
 
73
108
  ### Fixed
109
+
74
110
  - Fix bug where an unexpected error would occur if the mnemonic passed to `_initFromMnemonic` was a buffer array ([#62](https://github.com/MetaMask/eth-hd-keyring/pull/62))
75
111
 
76
112
  ## [4.0.0]
113
+
77
114
  ### Changed
115
+
78
116
  - **BREAKING**: Do not allow re-initialization of keyring instance ([#55](https://github.com/MetaMask/eth-hd-keyring/pull/55))
79
- - Consumers are now required to call generateRandomMnemonic() after initialization for creating new SRPs.
117
+ - Consumers are now required to call generateRandomMnemonic() after initialization for creating new SRPs.
80
118
  - **BREAKING**: Update minimum Node.js version from v10 to v12 ([#45](https://github.com/MetaMask/eth-hd-keyring/pull/45))
81
119
  - Add `@lavamoat/allow-scripts` ([#47](https://github.com/MetaMask/eth-hd-keyring/pull/47))
82
- - We now have an allowlist for all post-install scripts. The standard setup script has been added, along with new contributor documentation in the README to explain this script.
120
+ - We now have an allowlist for all post-install scripts. The standard setup script has been added, along with new contributor documentation in the README to explain this script.
83
121
  - Obfuscate serialized mnemonic ([#59](https://github.com/MetaMask/eth-hd-keyring/pull/59))
84
- - Class variable `mnemonic` on `HdKeyring` can now be either type `Buffer` or type `string`.
85
- - 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`.
122
+ - Class variable `mnemonic` on `HdKeyring` can now be either type `Buffer` or type `string`.
123
+ - 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`.
86
124
  - Package name changed from `eth-hd-keyring` to `@metamask/eth-hd-keyring`.
87
125
 
88
- [Unreleased]: https://github.com/MetaMask/eth-hd-keyring/compare/v7.0.1...HEAD
89
- [7.0.1]: https://github.com/MetaMask/eth-hd-keyring/compare/v7.0.0...v7.0.1
90
- [7.0.0]: https://github.com/MetaMask/eth-hd-keyring/compare/v6.0.2...v7.0.0
91
- [6.0.2]: https://github.com/MetaMask/eth-hd-keyring/compare/v6.0.1...v6.0.2
92
- [6.0.1]: https://github.com/MetaMask/eth-hd-keyring/compare/v6.0.0...v6.0.1
93
- [6.0.0]: https://github.com/MetaMask/eth-hd-keyring/compare/v5.0.1...v6.0.0
94
- [5.0.1]: https://github.com/MetaMask/eth-hd-keyring/compare/v5.0.0...v5.0.1
95
- [5.0.0]: https://github.com/MetaMask/eth-hd-keyring/compare/v4.0.2...v5.0.0
96
- [4.0.2]: https://github.com/MetaMask/eth-hd-keyring/compare/v4.0.1...v4.0.2
97
- [4.0.1]: https://github.com/MetaMask/eth-hd-keyring/compare/v4.0.0...v4.0.1
98
- [4.0.0]: https://github.com/MetaMask/eth-hd-keyring/releases/tag/v4.0.0
126
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@7.0.3...HEAD
127
+ [7.0.3]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@7.0.2...@metamask/eth-hd-keyring@7.0.3
128
+ [7.0.2]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@7.0.1...@metamask/eth-hd-keyring@7.0.2
129
+ [7.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@7.0.0...@metamask/eth-hd-keyring@7.0.1
130
+ [7.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@6.0.2...@metamask/eth-hd-keyring@7.0.0
131
+ [6.0.2]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@6.0.1...@metamask/eth-hd-keyring@6.0.2
132
+ [6.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@6.0.0...@metamask/eth-hd-keyring@6.0.1
133
+ [6.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@5.0.1...@metamask/eth-hd-keyring@6.0.0
134
+ [5.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@5.0.0...@metamask/eth-hd-keyring@5.0.1
135
+ [5.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@4.0.2...@metamask/eth-hd-keyring@5.0.0
136
+ [4.0.2]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@4.0.1...@metamask/eth-hd-keyring@4.0.2
137
+ [4.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-hd-keyring@4.0.0...@metamask/eth-hd-keyring@4.0.1
138
+ [4.0.0]: https://github.com/MetaMask/accounts/releases/tag/@metamask/eth-hd-keyring@4.0.0
package/index.js CHANGED
@@ -294,7 +294,7 @@ class HdKeyring {
294
294
  );
295
295
  }
296
296
 
297
- // eslint-disable-next-line node/no-sync
297
+ // eslint-disable-next-line n/no-sync
298
298
  const seed = bip39.mnemonicToSeedSync(this.mnemonic, wordlist);
299
299
  this.hdWallet = HDKey.fromMasterSeed(seed);
300
300
  this.root = this.hdWallet.derive(this.hdPath);
package/jest.config.js CHANGED
@@ -1,6 +1,26 @@
1
- module.exports = {
2
- collectCoverage: true,
3
- coverageReporters: ['text', 'html'],
1
+ /*
2
+ * For a detailed explanation regarding each configuration property and type check, visit:
3
+ * https://jestjs.io/docs/configuration
4
+ */
5
+
6
+ const merge = require('deepmerge');
7
+ const path = require('path');
8
+
9
+ const baseConfig = require('../../jest.config.packages');
10
+
11
+ const displayName = path.basename(__dirname);
12
+
13
+ module.exports = merge(baseConfig, {
14
+ // The display name when running multiple projects
15
+ displayName,
16
+
17
+ // An array of regexp pattern strings used to skip coverage collection
18
+ coveragePathIgnorePatterns: ['./test'],
19
+
20
+ // The glob patterns Jest uses to detect test files
21
+ testMatch: ['**/test/**/*.[jt]s?(x)'],
22
+
23
+ // An object that configures minimum threshold enforcement for coverage results
4
24
  coverageThreshold: {
5
25
  global: {
6
26
  branches: 84,
@@ -9,15 +29,4 @@ module.exports = {
9
29
  statements: 95,
10
30
  },
11
31
  },
12
- moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
13
- // "resetMocks" resets all mocks, including mocked modules, to jest.fn(),
14
- // between each test case.
15
- resetMocks: true,
16
- // "restoreMocks" restores all mocks created using jest.spyOn to their
17
- // original implementations, between each test. It does not affect mocked
18
- // modules.
19
- restoreMocks: true,
20
- testEnvironment: 'node',
21
- testMatch: ['**/test/**/*.js'],
22
- testTimeout: 2500,
23
- };
32
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/eth-hd-keyring",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "description": "A simple standard interface for a seed phrase generated set of Ethereum accounts.",
5
5
  "keywords": [
6
6
  "ethereum",
@@ -18,43 +18,36 @@
18
18
  "author": "Dan Finlay",
19
19
  "main": "index.js",
20
20
  "scripts": {
21
- "lint": "yarn lint:eslint && yarn lint:misc --check",
22
- "lint:eslint": "eslint . --cache --ext js,ts",
23
- "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
24
- "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
25
- "test": "jest"
21
+ "build": "",
22
+ "build:clean": "",
23
+ "build:force": "",
24
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/eth-hd-keyring",
25
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/eth-hd-keyring",
26
+ "publish:preview": "yarn npm publish --tag preview",
27
+ "test": "jest",
28
+ "test:clean": "jest --clearCache",
29
+ "test:verbose": "jest --verbose"
26
30
  },
27
31
  "dependencies": {
28
32
  "@ethereumjs/util": "^8.1.0",
29
- "@metamask/eth-sig-util": "^7.0.0",
30
- "@metamask/scure-bip39": "^2.1.0",
31
- "@metamask/utils": "^8.1.0",
33
+ "@metamask/eth-sig-util": "^7.0.3",
34
+ "@metamask/scure-bip39": "^2.1.1",
35
+ "@metamask/utils": "^9.2.1",
32
36
  "ethereum-cryptography": "^2.1.2"
33
37
  },
34
38
  "devDependencies": {
35
39
  "@ethereumjs/tx": "^4.0.1",
36
- "@lavamoat/allow-scripts": "^2.3.1",
37
- "@lavamoat/preinstall-always-fail": "^1.0.0",
38
- "@metamask/auto-changelog": "^2.5.0",
40
+ "@lavamoat/allow-scripts": "^3.2.1",
41
+ "@lavamoat/preinstall-always-fail": "^2.1.0",
42
+ "@metamask/auto-changelog": "^3.4.4",
39
43
  "@metamask/bip39": "^4.0.0",
40
- "@metamask/eslint-config": "^8.0.0",
41
- "@metamask/eslint-config-jest": "^9.0.0",
42
- "@metamask/eslint-config-nodejs": "^8.0.0",
43
44
  "@metamask/eth-hd-keyring": "4.0.1",
44
45
  "@types/jest": "^29.4.0",
45
- "eslint": "^7.32.0",
46
- "eslint-config-prettier": "^8.3.0",
47
- "eslint-plugin-import": "^2.24.2",
48
- "eslint-plugin-jest": "^24.3.6",
49
- "eslint-plugin-node": "^11.1.0",
50
- "eslint-plugin-prettier": "^3.3.1",
51
- "jest": "^29.4.3",
52
- "prettier": "^2.4.1",
53
- "prettier-plugin-packagejson": "^2.2.12"
46
+ "deepmerge": "^4.2.2",
47
+ "jest": "^29.4.3"
54
48
  },
55
- "packageManager": "yarn@3.3.0",
56
49
  "engines": {
57
- "node": "^16.20 || ^18.16 || >=20"
50
+ "node": "^18.18 || >=20"
58
51
  },
59
52
  "publishConfig": {
60
53
  "access": "public",
package/.eslintrc.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- root: true,
3
-
4
- extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'],
5
-
6
- overrides: [
7
- {
8
- files: ['test/**/*.js'],
9
- extends: ['@metamask/eslint-config-jest'],
10
- rules: {
11
- 'node/no-unpublished-require': 0,
12
- },
13
- },
14
- ],
15
-
16
- ignorePatterns: ['!.eslintrc.js', '!.prettierrc.js'],
17
- };
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v18
package/.prettierrc.js DELETED
@@ -1,8 +0,0 @@
1
- // All of these are defaults except singleQuote, but we specify them
2
- // for explicitness
3
- module.exports = {
4
- quoteProps: 'as-needed',
5
- singleQuote: true,
6
- tabWidth: 2,
7
- trailingComma: 'all',
8
- };
@@ -1,9 +0,0 @@
1
- /* eslint-disable */
2
- //prettier-ignore
3
- module.exports = {
4
- name: "@yarnpkg/plugin-allow-scripts",
5
- factory: function (require) {
6
- var plugin=(()=>{var a=Object.create,l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var u=e=>l(e,"__esModule",{value:!0});var f=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)l(e,r,{get:o[r],enumerable:!0})},m=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of s(o))!c.call(e,t)&&t!=="default"&&l(e,t,{get:()=>o[t],enumerable:!(r=i(o,t))||r.enumerable});return e},x=e=>m(u(l(e!=null?a(p(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>d});var n=x(f("@yarnpkg/shell")),y={hooks:{afterAllInstalled:async()=>{let e=await(0,n.execute)("yarn run allow-scripts");e!==0&&process.exit(e)}}},d=y;return k;})();
7
- return plugin;
8
- }
9
- };