@metamask-previews/eth-trezor-keyring 3.1.0-preview-7b3e0a5

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.
Files changed (4) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/LICENSE +15 -0
  3. package/README.md +102 -0
  4. package/package.json +111 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,111 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [3.1.0]
11
+
12
+ ### Changed
13
+
14
+ - Bump `@trezor/connect-web` from `^9.0.6` to `^9.1.11` ([#195](https://github.com/MetaMask/eth-trezor-keyring/pull/195))
15
+
16
+ ### Fixed
17
+
18
+ - Bump `@metamask/eth-sig-util` from `^7.0.0` to `^7.0.1` ([#195](https://github.com/MetaMask/eth-trezor-keyring/pull/195))
19
+ - Bump `@trezor/connect-plugin-ethereum` from `^9.0.1` to `^9.0.3` ([#195](https://github.com/MetaMask/eth-trezor-keyring/pull/195))
20
+ - Should help fixing MM pop-up closing issue ([#10896](https://github.com/MetaMask/metamask-extension/issues/10896))
21
+
22
+ ## [3.0.0]
23
+
24
+ ### Changed
25
+
26
+ - **BREAKING**: Remove support for major node versions 14,15,17,19. Minimum Node.js version is now 16. ([#188](https://github.com/MetaMask/eth-trezor-keyring/pull/188))
27
+ - Bump `@metamask/eth-sig-util` from `^5.0.2` to `^7.0.0` ([#189](https://github.com/MetaMask/eth-trezor-keyring/pull/189))
28
+ - Bump dependency `hdkey` from `0.8.0` to `^2.1.0` ([#190](https://github.com/MetaMask/eth-trezor-keyring/pull/190))
29
+
30
+ ## [2.0.0]
31
+
32
+ ### Added
33
+
34
+ - Add `destroy` method to `TrezorKeyring`, which replaces `dispose` ([#179](https://github.com/MetaMask/eth-trezor-keyring/pull/179))
35
+
36
+ ### Changed
37
+
38
+ - **BREAKING:** Separate the bridge from the keyring ([#143](https://github.com/MetaMask/eth-trezor-keyring/pull/143))
39
+ - The Trezor bridge is now a separate class (`TrezorConnectBridge`), which must be constructed separately from the keyring and passed in as a constructor argument.
40
+ - The bridge initialization has been moved from the keyring constructor to the keyring `init` method. The bridge is expected to be passed to the keyring uninitialized, and the keyring `init` method is expected to be called after keyring construction (before the keyring is used).
41
+ - The keyring constructor no longer accepts keyring state. Instead, any pre-existing keyring state should be passed to the `deserialize` method after construction.
42
+
43
+ ### Removed
44
+
45
+ - **BREAKING:** Remove `dispose` method from `TrezorKeyring`, which is replaced by `destroy` ([#179](https://github.com/MetaMask/eth-trezor-keyring/pull/179))
46
+
47
+ ## [1.1.0]
48
+
49
+ ### Added
50
+
51
+ - Add legacy derivation path, allowing generation of accounts with the `m/44'/60'/0` path ([#175](https://github.com/MetaMask/eth-trezor-keyring/pull/175))
52
+
53
+ ### Changed
54
+
55
+ - Migrate to TypeScript ([#161](https://github.com/MetaMask/eth-trezor-keyring/pull/161))
56
+
57
+ ## [1.0.0]
58
+
59
+ ### Changed
60
+
61
+ - **BREAKING:** Rename package to use `@metamask` scope ([#160](https://github.com/MetaMask/eth-trezor-keyring/pull/160))
62
+ - **BREAKING:** Removed support for Node v12 in favor of v14 ([#135](https://github.com/MetaMask/eth-trezor-keyring/pull/135))
63
+ - Update `@ethereumjs/util`, `@ethereumjs/tx`, `@metamask/eth-sig-util` to latest versions ([#146](https://github.com/MetaMask/eth-trezor-keyring/pull/146))
64
+ - Bump trezor-connect - now @trezor/connect-plugin-ethereum & @trezor/connect-web - to v9 ([#133](https://github.com/MetaMask/eth-trezor-keyring/pull/133), [#163](https://github.com/MetaMask/eth-trezor-keyring/pull/163))
65
+
66
+ ## [0.10.0]
67
+
68
+ ### Added
69
+
70
+ - Support for EIP-721 signTypedData_v4 ([#117](https://github.com/MetaMask/eth-trezor-keyring/pull/117))
71
+
72
+ ## [0.9.1]
73
+
74
+ ### Changed
75
+
76
+ - Update trezor connect to 8.2.3, so that 1.10.4 of the Model One firmware is supported ([#115](https://github.com/MetaMask/eth-trezor-keyring/pull/115))
77
+
78
+ ## [0.9.0]
79
+
80
+ ### Added
81
+
82
+ - Add dispose method, which exposes the TrezorConnect.dispose method, allowing consumers to explictly remove the Trezor Connect iframe ([#113](https://github.com/MetaMask/eth-trezor-keyring/pull/13))
83
+
84
+ ### Fixed
85
+
86
+ - Fixed the signing of contract creation transactions, which require a nullish (empty string or undefined) `to` parameter ([#112](https://github.com/MetaMask/eth-trezor-keyring/pull/112))
87
+
88
+ ## [0.8.0]
89
+
90
+ ### Added
91
+
92
+ - Support for EIP-1559 transactions for the Model T ([#108](https://github.com/MetaMask/eth-trezor-keyring/pull/108))
93
+ - Add setHdPath method, which allows setting the HD path used by the keyring to known, supported HD paths ([#107](https://github.com/MetaMask/eth-trezor-keyring/pull/107))
94
+
95
+ ## [0.7.0]
96
+
97
+ ### Added
98
+
99
+ - Support new versions of ethereumjs/tx ([#88](https://github.com/metamask/eth-trezor-keyring/pull/88))
100
+
101
+ [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.0...HEAD
102
+ [3.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.0.0...@metamask/eth-trezor-keyring@3.1.0
103
+ [3.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@2.0.0...@metamask/eth-trezor-keyring@3.0.0
104
+ [2.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@1.1.0...@metamask/eth-trezor-keyring@2.0.0
105
+ [1.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@1.0.0...@metamask/eth-trezor-keyring@1.1.0
106
+ [1.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@0.10.0...@metamask/eth-trezor-keyring@1.0.0
107
+ [0.10.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@0.9.1...@metamask/eth-trezor-keyring@0.10.0
108
+ [0.9.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@0.9.0...@metamask/eth-trezor-keyring@0.9.1
109
+ [0.9.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@0.8.0...@metamask/eth-trezor-keyring@0.9.0
110
+ [0.8.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@0.7.0...@metamask/eth-trezor-keyring@0.8.0
111
+ [0.7.0]: https://github.com/MetaMask/accounts/releases/tag/@metamask/eth-trezor-keyring@0.7.0
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2020 MetaMask
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # eth-trezor-keyring
2
+
3
+ An implementation of MetaMask's [Keyring interface](https://github.com/MetaMask/eth-simple-keyring#the-keyring-class-protocol), that uses a TREZOR hardware
4
+ wallet for all cryptographic operations.
5
+
6
+ In most regards, it works in the same way as
7
+ [eth-hd-keyring](https://github.com/MetaMask/eth-hd-keyring), but using a TREZOR
8
+ device. However there are a number of differences:
9
+
10
+ - Because the keys are stored in the device, operations that rely on the device
11
+ will fail if there is no TREZOR device attached, or a different TREZOR device
12
+ is attached.
13
+ - It does not support the `signMessage`, `signTypedData` or `exportAccount`
14
+ methods, because TREZOR devices do not support these operations.
15
+ - The method `signPersonalMessage` requires the firmware version 2.0.7+ for TREZOR Model T and 1.6.2+ on TREZOR ONE
16
+ - As of `trezor-connect`: `8.2.2`, passing an EIP-1559 transaction to `signTransaction`
17
+ requires the firmware version 2.4.2+ for TREZOR Model T, and version 1.10.4+ for TREZOR ONE.
18
+
19
+ ## Installation
20
+
21
+ `yarn add @metamask/eth-trezor-keyring`
22
+
23
+ or
24
+
25
+ `npm install @metamask/eth-trezor-keyring`
26
+
27
+ ## Using
28
+
29
+ In addition to all the known methods from the [Keyring class protocol](https://github.com/MetaMask/eth-simple-keyring#the-keyring-class-protocol),
30
+ there are a few others:
31
+
32
+ - **isUnlocked** : Returns true if we have the public key in memory, which allows to generate the list of accounts at any time
33
+
34
+ - **unlock** : Connects to the TREZOR device and exports the extended public key, which is later used to read the available ethereum addresses inside the trezor account.
35
+
36
+ - **setAccountToUnlock** : the index of the account that you want to unlock in order to use with the signTransaction and signPersonalMessage methods
37
+
38
+ - **getFirstPage** : returns the first ordered set of accounts from the TREZOR account
39
+
40
+ - **getNextPage** : returns the next ordered set of accounts from the TREZOR account based on the current page
41
+
42
+ - **getPreviousPage** : returns the previous ordered set of accounts from the TREZOR account based on the current page
43
+
44
+ - **forgetDevice** : removes all the device info from memory so the next interaction with the keyring will prompt the user to connect the TREZOR device and export the account information
45
+
46
+ ## Contributing
47
+
48
+ ### Setup
49
+
50
+ - Install [Node.js](https://nodejs.org) version 18
51
+ - If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.
52
+ - Install [Yarn v3](https://yarnpkg.com/getting-started/install)
53
+ - Run `yarn install` to install dependencies and run any required post-install scripts
54
+ - **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.
55
+
56
+ ### Testing and Linting
57
+
58
+ Run `yarn test` to run the tests.
59
+
60
+ Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.
61
+
62
+ ### Release & Publishing
63
+
64
+ The project follows the same release process as the other libraries in the MetaMask organization. The GitHub Actions [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) and [`action-publish-release`](https://github.com/MetaMask/action-publish-release) are used to automate the release process; see those repositories for more information about how they work.
65
+
66
+ 1. Choose a release version.
67
+
68
+ - The release version should be chosen according to SemVer. Analyze the changes to see whether they include any breaking changes, new features, or deprecations, then choose the appropriate SemVer version. See [the SemVer specification](https://semver.org/) for more information.
69
+
70
+ 2. If this release is backporting changes onto a previous release, then ensure there is a major version branch for that version (e.g. `1.x` for a `v1` backport release).
71
+
72
+ - The major version branch should be set to the most recent release with that major version. For example, when backporting a `v1.0.2` release, you'd want to ensure there was a `1.x` branch that was set to the `v1.0.1` tag.
73
+
74
+ 3. Trigger the [`workflow_dispatch`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch) event [manually](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) for the `Create Release Pull Request` action to create the release PR.
75
+
76
+ - For a backport release, the base branch should be the major version branch that you ensured existed in step 2. For a normal release, the base branch should be the main branch for that repository (which should be the default value).
77
+ - This should trigger the [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) workflow to create the release PR.
78
+
79
+ 4. Update the changelog to move each change entry into the appropriate change category ([See here](https://keepachangelog.com/en/1.0.0/#types) for the full list of change categories, and the correct ordering), and edit them to be more easily understood by users of the package.
80
+
81
+ - Generally any changes that don't affect consumers of the package (e.g. lockfile changes or development environment changes) are omitted. Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).
82
+ - Try to explain each change in terms that users of the package would understand (e.g. avoid referencing internal variables/concepts).
83
+ - Consolidate related changes into one change entry if it makes it easier to explain.
84
+ - Run `yarn auto-changelog validate --rc` to check that the changelog is correctly formatted.
85
+
86
+ 5. Review and QA the release.
87
+
88
+ - If changes are made to the base branch, the release branch will need to be updated with these changes and review/QA will need to restart again. As such, it's probably best to avoid merging other PRs into the base branch while review is underway.
89
+
90
+ 6. Squash & Merge the release.
91
+
92
+ - This should trigger the [`action-publish-release`](https://github.com/MetaMask/action-publish-release) workflow to tag the final release commit and publish the release on GitHub.
93
+
94
+ 7. Publish the release on npm.
95
+
96
+ - Be very careful to use a clean local environment to publish the release, and follow exactly the same steps used during CI.
97
+ - Use `npm publish --dry-run` to examine the release contents to ensure the correct files are included. Compare to previous releases if necessary (e.g. using `https://unpkg.com/browse/[package name]@[package version]/`).
98
+ - Once you are confident the release contents are correct, publish the release using `npm publish`.
99
+
100
+ ## Attributions
101
+
102
+ This code was inspired by [eth-ledger-keyring](https://github.com/jamespic/eth-ledger-keyring) and [eth-hd-keyring](https://github.com/MetaMask/eth-hd-keyring)
package/package.json ADDED
@@ -0,0 +1,111 @@
1
+ {
2
+ "name": "@metamask-previews/eth-trezor-keyring",
3
+ "version": "3.1.0-preview-7b3e0a5",
4
+ "description": "A MetaMask compatible keyring, for trezor hardware wallets",
5
+ "keywords": [
6
+ "ethereum",
7
+ "keyring",
8
+ "trezor",
9
+ "metamask"
10
+ ],
11
+ "homepage": "https://github.com/metamask/eth-trezor-keyring#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/metamask/eth-trezor-keyring/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/MetaMask/eth-trezor-keyring.git"
18
+ },
19
+ "license": "ISC",
20
+ "author": "Bruno Barbieri",
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
23
+ "files": [
24
+ "dist/"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc --build tsconfig.build.json",
28
+ "build:clean": "rimraf dist && yarn build",
29
+ "build:docs": "typedoc",
30
+ "build:force": "tsc --build tsconfig.build.json --force",
31
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/eth-trezor-keyring",
32
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/eth-trezor-keyring",
33
+ "prepack": "./scripts/prepack.sh",
34
+ "publish:preview": "yarn npm publish --tag preview",
35
+ "test": "jest && jest-it-up",
36
+ "test:clean": "jest --clearCache",
37
+ "test:verbose": "jest --verbose",
38
+ "test:watch": "jest --watch"
39
+ },
40
+ "dependencies": {
41
+ "@ethereumjs/tx": "^4.0.0",
42
+ "@ethereumjs/util": "^8.0.0",
43
+ "@metamask/eth-sig-util": "^7.0.1",
44
+ "@trezor/connect-plugin-ethereum": "^9.0.3",
45
+ "@trezor/connect-web": "^9.1.11",
46
+ "deepmerge": "^4.2.2",
47
+ "hdkey": "^2.1.0",
48
+ "jest-environment-jsdom": "^29.7.0"
49
+ },
50
+ "devDependencies": {
51
+ "@ethereumjs/common": "^3.0.0",
52
+ "@lavamoat/allow-scripts": "^3.0.4",
53
+ "@metamask/auto-changelog": "^3.0.0",
54
+ "@types/ethereumjs-tx": "^1.0.1",
55
+ "@types/hdkey": "^2.0.1",
56
+ "@types/jest": "^28.1.6",
57
+ "@types/node": "^16.18.57",
58
+ "@types/sinon": "^9.0.10",
59
+ "@types/w3c-web-usb": "^1.0.6",
60
+ "depcheck": "^1.4.3",
61
+ "ethereumjs-tx": "^1.3.4",
62
+ "jest": "^28.1.3",
63
+ "jest-it-up": "^2.2.0",
64
+ "rimraf": "^4.1.2",
65
+ "sinon": "^9.2.3",
66
+ "ts-jest": "^28.0.7",
67
+ "ts-node": "^10.7.0",
68
+ "typedoc": "^0.23.15",
69
+ "typescript": "~4.8.4"
70
+ },
71
+ "engines": {
72
+ "node": "^18.18 || >=20"
73
+ },
74
+ "publishConfig": {
75
+ "access": "public",
76
+ "registry": "https://registry.npmjs.org/"
77
+ },
78
+ "installConfig": {
79
+ "hoistingLimits": "workspaces"
80
+ },
81
+ "lavamoat": {
82
+ "allowScripts": {
83
+ "keccak": false,
84
+ "secp256k1": false,
85
+ "@lavamoat/preinstall-always-fail": false,
86
+ "core-js": false,
87
+ "blake-hash": false,
88
+ "tiny-secp256k1": false,
89
+ "protobufjs": false,
90
+ "ethereumjs-tx>ethereumjs-util>keccak": false,
91
+ "ethereumjs-util>ethereum-cryptography>keccak": false,
92
+ "ethereumjs-util>ethereum-cryptography>secp256k1": false,
93
+ "hdkey>secp256k1": false,
94
+ "trezor-connect>@trezor/transport>protobufjs": false,
95
+ "trezor-connect>@trezor/utxo-lib>blake-hash": false,
96
+ "trezor-connect>@trezor/utxo-lib>tiny-secp256k1": false,
97
+ "@trezor/connect-web>@trezor/connect>@trezor/transport>protobufjs": false,
98
+ "@trezor/connect-web>@trezor/connect>@trezor/utxo-lib>blake-hash": false,
99
+ "@trezor/connect-web>@trezor/connect>@trezor/utxo-lib>tiny-secp256k1": false,
100
+ "@ethereumjs/tx>ethereumjs-util>ethereum-cryptography>keccak": false,
101
+ "@ethereumjs/tx>ethereumjs-util>ethereum-cryptography>secp256k1": false,
102
+ "ethereumjs-tx>ethereumjs-util>ethereum-cryptography>keccak": false,
103
+ "ethereumjs-tx>ethereumjs-util>ethereum-cryptography>secp256k1": false,
104
+ "@trezor/connect-web>@trezor/connect>@trezor/blockchain-link>@solana/web3.js>bigint-buffer": false,
105
+ "@trezor/connect-web>@trezor/connect>@trezor/blockchain-link>ws>bufferutil": false,
106
+ "@trezor/connect-web>@trezor/connect>@trezor/blockchain-link>ws>utf-8-validate": false,
107
+ "@trezor/connect-web>@trezor/connect>@trezor/protobuf>protobufjs": false,
108
+ "@trezor/connect-web>@trezor/connect>@trezor/transport>usb": false
109
+ }
110
+ }
111
+ }