@metamask/eth-hd-keyring 6.0.2 → 7.0.1
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 +17 -1
- package/index.js +3 -2
- package/package.json +10 -10
- package/test/index.js +4 -2
- package/.github/CODEOWNERS +0 -4
- package/.github/workflows/build-lint-test.yml +0 -73
- package/.github/workflows/create-release-pr.yml +0 -41
- package/.github/workflows/main.yml +0 -70
- package/.github/workflows/publish-release.yml +0 -50
- package/.yarn/releases/yarn-3.3.0.cjs +0 -807
- package/.yarnrc.yml +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [7.0.1]
|
|
10
|
+
### Changed
|
|
11
|
+
- **BREAKING:** Update minimum Node.js version from v14 to v16 ([#98](https://github.com/MetaMask/eth-hd-keyring/pull/98))
|
|
12
|
+
- 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`
|
|
18
|
+
|
|
19
|
+
## [7.0.0] [RETRACTED]
|
|
20
|
+
### Changed
|
|
21
|
+
- This version was retracted due to a bug causing code to be missing from published package.
|
|
22
|
+
|
|
9
23
|
## [6.0.2]
|
|
10
24
|
### Fixed
|
|
11
25
|
- Bump dependencies ([#94](https://github.com/MetaMask/eth-hd-keyring/pull/94))
|
|
@@ -71,7 +85,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
71
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`.
|
|
72
86
|
- Package name changed from `eth-hd-keyring` to `@metamask/eth-hd-keyring`.
|
|
73
87
|
|
|
74
|
-
[Unreleased]: https://github.com/MetaMask/eth-hd-keyring/compare/
|
|
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
|
|
75
91
|
[6.0.2]: https://github.com/MetaMask/eth-hd-keyring/compare/v6.0.1...v6.0.2
|
|
76
92
|
[6.0.1]: https://github.com/MetaMask/eth-hd-keyring/compare/v6.0.0...v6.0.1
|
|
77
93
|
[6.0.0]: https://github.com/MetaMask/eth-hd-keyring/compare/v5.0.1...v6.0.0
|
package/index.js
CHANGED
|
@@ -2,7 +2,6 @@ const { HDKey } = require('ethereum-cryptography/hdkey');
|
|
|
2
2
|
const { keccak256 } = require('ethereum-cryptography/keccak');
|
|
3
3
|
const { bytesToHex } = require('ethereum-cryptography/utils');
|
|
4
4
|
const {
|
|
5
|
-
stripHexPrefix,
|
|
6
5
|
privateToPublic,
|
|
7
6
|
publicToAddress,
|
|
8
7
|
ecsign,
|
|
@@ -20,6 +19,7 @@ const {
|
|
|
20
19
|
signTypedData,
|
|
21
20
|
SignTypedDataVersion,
|
|
22
21
|
} = require('@metamask/eth-sig-util');
|
|
22
|
+
const { assertIsHexString, remove0x } = require('@metamask/utils');
|
|
23
23
|
|
|
24
24
|
// Options:
|
|
25
25
|
const hdPathString = `m/44'/60'/0'/0`;
|
|
@@ -176,7 +176,8 @@ class HdKeyring {
|
|
|
176
176
|
|
|
177
177
|
// For eth_sign, we need to sign arbitrary data:
|
|
178
178
|
async signMessage(address, data, opts = {}) {
|
|
179
|
-
|
|
179
|
+
assertIsHexString(data);
|
|
180
|
+
const message = remove0x(data);
|
|
180
181
|
const privKey = this._getPrivateKeyFor(address, opts);
|
|
181
182
|
const msgSig = ecsign(Buffer.from(message, 'hex'), privKey);
|
|
182
183
|
const rawMsgSig = concatSig(msgSig.v, msgSig.r, msgSig.s);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/eth-hd-keyring",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "A simple standard interface for a seed phrase generated set of Ethereum accounts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ethereum",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"test": "jest"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ethereumjs/util": "8.0
|
|
29
|
-
"@metamask/eth-sig-util": "^
|
|
28
|
+
"@ethereumjs/util": "^8.1.0",
|
|
29
|
+
"@metamask/eth-sig-util": "^7.0.0",
|
|
30
30
|
"@metamask/scure-bip39": "^2.1.0",
|
|
31
|
-
"@metamask/utils": "^
|
|
32
|
-
"ethereum-cryptography": "^1.2
|
|
31
|
+
"@metamask/utils": "^8.1.0",
|
|
32
|
+
"ethereum-cryptography": "^2.1.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@ethereumjs/tx": "^4.
|
|
35
|
+
"@ethereumjs/tx": "^4.0.1",
|
|
36
36
|
"@lavamoat/allow-scripts": "^2.3.1",
|
|
37
37
|
"@lavamoat/preinstall-always-fail": "^1.0.0",
|
|
38
38
|
"@metamask/auto-changelog": "^2.5.0",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"@metamask/eslint-config-jest": "^9.0.0",
|
|
42
42
|
"@metamask/eslint-config-nodejs": "^8.0.0",
|
|
43
43
|
"@metamask/eth-hd-keyring": "4.0.1",
|
|
44
|
-
"@types/jest": "^
|
|
44
|
+
"@types/jest": "^29.4.0",
|
|
45
45
|
"eslint": "^7.32.0",
|
|
46
46
|
"eslint-config-prettier": "^8.3.0",
|
|
47
47
|
"eslint-plugin-import": "^2.24.2",
|
|
48
48
|
"eslint-plugin-jest": "^24.3.6",
|
|
49
49
|
"eslint-plugin-node": "^11.1.0",
|
|
50
50
|
"eslint-plugin-prettier": "^3.3.1",
|
|
51
|
-
"jest": "^
|
|
51
|
+
"jest": "^29.4.3",
|
|
52
52
|
"prettier": "^2.4.1",
|
|
53
53
|
"prettier-plugin-packagejson": "^2.2.12"
|
|
54
54
|
},
|
|
55
55
|
"packageManager": "yarn@3.3.0",
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": "
|
|
57
|
+
"node": "^16.20 || ^18.16 || >=20"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public",
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
"@metamask/eth-hd-keyring>ethereumjs-util>ethereum-cryptography>secp256k1": false
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|
package/test/index.js
CHANGED
|
@@ -578,7 +578,9 @@ describe('hd-keyring', () => {
|
|
|
578
578
|
numberOfAccounts: 1,
|
|
579
579
|
});
|
|
580
580
|
const localMessage = 'hello there!';
|
|
581
|
-
const msgHashHex = bufferToHex(
|
|
581
|
+
const msgHashHex = bufferToHex(
|
|
582
|
+
Buffer.from(keccak256(Buffer.from(localMessage))),
|
|
583
|
+
);
|
|
582
584
|
await keyring.addAccounts(9);
|
|
583
585
|
const addresses = await keyring.getAccounts();
|
|
584
586
|
const signatures = await Promise.all(
|
|
@@ -608,7 +610,7 @@ describe('hd-keyring', () => {
|
|
|
608
610
|
});
|
|
609
611
|
|
|
610
612
|
await expect(keyring.signMessage(firstAcct, '')).rejects.toThrow(
|
|
611
|
-
'
|
|
613
|
+
'Value must be a hexadecimal string',
|
|
612
614
|
);
|
|
613
615
|
});
|
|
614
616
|
|
package/.github/CODEOWNERS
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
name: Build, Lint, and Test
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_call:
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
prepare:
|
|
8
|
-
name: Prepare
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- name: Use Node.js
|
|
13
|
-
uses: actions/setup-node@v3
|
|
14
|
-
with:
|
|
15
|
-
node-version-file: '.nvmrc'
|
|
16
|
-
cache: 'yarn'
|
|
17
|
-
- name: Install Yarn dependencies
|
|
18
|
-
run: yarn --immutable
|
|
19
|
-
|
|
20
|
-
lint:
|
|
21
|
-
name: Lint
|
|
22
|
-
runs-on: ubuntu-latest
|
|
23
|
-
needs:
|
|
24
|
-
- prepare
|
|
25
|
-
strategy:
|
|
26
|
-
matrix:
|
|
27
|
-
node-version: [14.x, 16.x, 18.x, 19.x]
|
|
28
|
-
steps:
|
|
29
|
-
- uses: actions/checkout@v3
|
|
30
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
31
|
-
uses: actions/setup-node@v3
|
|
32
|
-
with:
|
|
33
|
-
node-version: ${{ matrix.node-version }}
|
|
34
|
-
cache: 'yarn'
|
|
35
|
-
- run: yarn --immutable --immutable-cache
|
|
36
|
-
- run: yarn lint
|
|
37
|
-
- name: Validate RC changelog
|
|
38
|
-
if: ${{ startsWith(github.head_ref, 'release/') }}
|
|
39
|
-
run: yarn auto-changelog validate --rc
|
|
40
|
-
- name: Validate changelog
|
|
41
|
-
if: ${{ !startsWith(github.head_ref, 'release/') }}
|
|
42
|
-
run: yarn auto-changelog validate
|
|
43
|
-
- name: Require clean working directory
|
|
44
|
-
shell: bash
|
|
45
|
-
run: |
|
|
46
|
-
if ! git diff --exit-code; then
|
|
47
|
-
echo "Working tree dirty at end of job"
|
|
48
|
-
exit 1
|
|
49
|
-
fi
|
|
50
|
-
test:
|
|
51
|
-
name: Test
|
|
52
|
-
runs-on: ubuntu-latest
|
|
53
|
-
needs:
|
|
54
|
-
- prepare
|
|
55
|
-
strategy:
|
|
56
|
-
matrix:
|
|
57
|
-
node-version: [14.x, 16.x, 18.x, 19.x]
|
|
58
|
-
steps:
|
|
59
|
-
- uses: actions/checkout@v3
|
|
60
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
61
|
-
uses: actions/setup-node@v3
|
|
62
|
-
with:
|
|
63
|
-
node-version: ${{ matrix.node-version }}
|
|
64
|
-
cache: 'yarn'
|
|
65
|
-
- run: yarn --immutable --immutable-cache
|
|
66
|
-
- run: yarn test
|
|
67
|
-
- name: Require clean working directory
|
|
68
|
-
shell: bash
|
|
69
|
-
run: |
|
|
70
|
-
if ! git diff --exit-code; then
|
|
71
|
-
echo "Working tree dirty at end of job"
|
|
72
|
-
exit 1
|
|
73
|
-
fi
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
name: Create Release Pull Request
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
inputs:
|
|
6
|
-
base-branch:
|
|
7
|
-
description: 'The base branch for git operations and the pull request.'
|
|
8
|
-
default: 'main'
|
|
9
|
-
required: true
|
|
10
|
-
release-type:
|
|
11
|
-
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".'
|
|
12
|
-
required: false
|
|
13
|
-
release-version:
|
|
14
|
-
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
|
|
15
|
-
required: false
|
|
16
|
-
|
|
17
|
-
jobs:
|
|
18
|
-
create-release-pr:
|
|
19
|
-
runs-on: ubuntu-latest
|
|
20
|
-
permissions:
|
|
21
|
-
contents: write
|
|
22
|
-
pull-requests: write
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v3
|
|
25
|
-
with:
|
|
26
|
-
# This is to guarantee that the most recent tag is fetched.
|
|
27
|
-
# This can be configured to a more reasonable value by consumers.
|
|
28
|
-
fetch-depth: 0
|
|
29
|
-
# We check out the specified branch, which will be used as the base
|
|
30
|
-
# branch for all git operations and the release PR.
|
|
31
|
-
ref: ${{ github.event.inputs.base-branch }}
|
|
32
|
-
- name: Setup Node.js
|
|
33
|
-
uses: actions/setup-node@v3
|
|
34
|
-
with:
|
|
35
|
-
node-version-file: '.nvmrc'
|
|
36
|
-
- uses: MetaMask/action-create-release-pr@v1
|
|
37
|
-
env:
|
|
38
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
39
|
-
with:
|
|
40
|
-
release-type: ${{ github.event.inputs.release-type }}
|
|
41
|
-
release-version: ${{ github.event.inputs.release-version }}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
name: Main
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
check-workflows:
|
|
10
|
-
name: Check workflows
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v3
|
|
14
|
-
- name: Download actionlint
|
|
15
|
-
id: download-actionlint
|
|
16
|
-
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.22
|
|
17
|
-
shell: bash
|
|
18
|
-
- name: Check workflow files
|
|
19
|
-
run: ${{ steps.download-actionlint.outputs.executable }} -color
|
|
20
|
-
shell: bash
|
|
21
|
-
|
|
22
|
-
build-lint-test:
|
|
23
|
-
name: Build, lint, and test
|
|
24
|
-
uses: ./.github/workflows/build-lint-test.yml
|
|
25
|
-
|
|
26
|
-
all-jobs-completed:
|
|
27
|
-
name: All jobs completed
|
|
28
|
-
runs-on: ubuntu-latest
|
|
29
|
-
needs:
|
|
30
|
-
- check-workflows
|
|
31
|
-
- build-lint-test
|
|
32
|
-
outputs:
|
|
33
|
-
PASSED: ${{ steps.set-output.outputs.PASSED }}
|
|
34
|
-
steps:
|
|
35
|
-
- name: Set PASSED output
|
|
36
|
-
id: set-output
|
|
37
|
-
run: echo "PASSED=true" >> "$GITHUB_OUTPUT"
|
|
38
|
-
|
|
39
|
-
all-jobs-pass:
|
|
40
|
-
name: All jobs pass
|
|
41
|
-
if: ${{ always() }}
|
|
42
|
-
runs-on: ubuntu-latest
|
|
43
|
-
needs: all-jobs-completed
|
|
44
|
-
steps:
|
|
45
|
-
- name: Check that all jobs have passed
|
|
46
|
-
run: |
|
|
47
|
-
passed="${{ needs.all-jobs-completed.outputs.PASSED }}"
|
|
48
|
-
if [[ $passed != "true" ]]; then
|
|
49
|
-
exit 1
|
|
50
|
-
fi
|
|
51
|
-
is-release:
|
|
52
|
-
# release merge commits come from github-actions
|
|
53
|
-
if: startsWith(github.event.commits[0].author.name, 'github-actions')
|
|
54
|
-
needs: all-jobs-pass
|
|
55
|
-
outputs:
|
|
56
|
-
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
|
|
57
|
-
runs-on: ubuntu-latest
|
|
58
|
-
steps:
|
|
59
|
-
- uses: MetaMask/action-is-release@v1
|
|
60
|
-
id: is-release
|
|
61
|
-
|
|
62
|
-
publish-release:
|
|
63
|
-
needs: is-release
|
|
64
|
-
if: needs.is-release.outputs.IS_RELEASE == 'true'
|
|
65
|
-
name: Publish release
|
|
66
|
-
permissions:
|
|
67
|
-
contents: write
|
|
68
|
-
uses: ./.github/workflows/publish-release.yml
|
|
69
|
-
secrets:
|
|
70
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: Publish Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_call:
|
|
5
|
-
secrets:
|
|
6
|
-
NPM_TOKEN:
|
|
7
|
-
required: true
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
publish-release:
|
|
11
|
-
permissions:
|
|
12
|
-
contents: write
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v3
|
|
16
|
-
with:
|
|
17
|
-
ref: ${{ github.sha }}
|
|
18
|
-
- name: Setup Node.js
|
|
19
|
-
uses: actions/setup-node@v3
|
|
20
|
-
with:
|
|
21
|
-
node-version-file: '.nvmrc'
|
|
22
|
-
- uses: MetaMask/action-publish-release@v2
|
|
23
|
-
env:
|
|
24
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
-
|
|
26
|
-
publish-npm-dry-run:
|
|
27
|
-
runs-on: ubuntu-latest
|
|
28
|
-
needs: publish-release
|
|
29
|
-
steps:
|
|
30
|
-
- uses: actions/checkout@v3
|
|
31
|
-
with:
|
|
32
|
-
ref: ${{ github.sha }}
|
|
33
|
-
- name: Dry Run Publish
|
|
34
|
-
# omit npm-token token to perform dry run publish
|
|
35
|
-
uses: MetaMask/action-npm-publish@v2
|
|
36
|
-
|
|
37
|
-
publish-npm:
|
|
38
|
-
environment: npm-publish
|
|
39
|
-
runs-on: ubuntu-latest
|
|
40
|
-
needs: publish-npm-dry-run
|
|
41
|
-
steps:
|
|
42
|
-
- uses: actions/checkout@v3
|
|
43
|
-
with:
|
|
44
|
-
ref: ${{ github.sha }}
|
|
45
|
-
- name: Publish
|
|
46
|
-
uses: MetaMask/action-npm-publish@v2
|
|
47
|
-
with:
|
|
48
|
-
# This `NPM_TOKEN` needs to be manually set per-repository.
|
|
49
|
-
# Look in the repository settings under "Environments", and set this token in the `npm-publish` environment.
|
|
50
|
-
npm-token: ${{ secrets.NPM_TOKEN }}
|