@metamask/eth-ledger-bridge-keyring 0.12.0 → 0.14.0
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/index.js +8 -6
- package/package.json +16 -6
- package/CHANGELOG.md +0 -43
package/index.js
CHANGED
|
@@ -119,7 +119,7 @@ class LedgerBridgeKeyring extends EventEmitter {
|
|
|
119
119
|
this.hdPath = hdPath
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
unlock (hdPath) {
|
|
122
|
+
unlock (hdPath, updateHdk = true) {
|
|
123
123
|
if (this.isUnlocked() && !hdPath) {
|
|
124
124
|
return Promise.resolve('already unlocked')
|
|
125
125
|
}
|
|
@@ -133,8 +133,10 @@ class LedgerBridgeKeyring extends EventEmitter {
|
|
|
133
133
|
},
|
|
134
134
|
({ success, payload }) => {
|
|
135
135
|
if (success) {
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
if (updateHdk) {
|
|
137
|
+
this.hdk.publicKey = Buffer.from(payload.publicKey, 'hex')
|
|
138
|
+
this.hdk.chainCode = Buffer.from(payload.chainCode, 'hex')
|
|
139
|
+
}
|
|
138
140
|
resolve(payload.address)
|
|
139
141
|
} else {
|
|
140
142
|
reject(payload.error || new Error('Unknown error'))
|
|
@@ -347,7 +349,7 @@ class LedgerBridgeKeyring extends EventEmitter {
|
|
|
347
349
|
},
|
|
348
350
|
({ success, payload }) => {
|
|
349
351
|
if (success) {
|
|
350
|
-
let v = payload.v
|
|
352
|
+
let v = parseInt(payload.v, 10)
|
|
351
353
|
v = v.toString(16)
|
|
352
354
|
if (v.length < 2) {
|
|
353
355
|
v = `0${v}`
|
|
@@ -373,7 +375,7 @@ class LedgerBridgeKeyring extends EventEmitter {
|
|
|
373
375
|
throw new Error(`Ledger: Account for address '${checksummedAddress}' not found`)
|
|
374
376
|
}
|
|
375
377
|
const { hdPath } = this.accountDetails[checksummedAddress]
|
|
376
|
-
const unlockedAddress = await this.unlock(hdPath)
|
|
378
|
+
const unlockedAddress = await this.unlock(hdPath, false)
|
|
377
379
|
|
|
378
380
|
// unlock resolves to the address for the given hdPath as reported by the ledger device
|
|
379
381
|
// if that address is not the requested address, then this account belongs to a different device or seed
|
|
@@ -412,7 +414,7 @@ class LedgerBridgeKeyring extends EventEmitter {
|
|
|
412
414
|
})
|
|
413
415
|
|
|
414
416
|
if (success) {
|
|
415
|
-
let v = payload.v
|
|
417
|
+
let v = parseInt(payload.v, 10)
|
|
416
418
|
v = v.toString(16)
|
|
417
419
|
if (v.length < 2) {
|
|
418
420
|
v = `0${v}`
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/eth-ledger-bridge-keyring",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "A MetaMask compatible keyring, for ledger hardware wallets",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"index.js"
|
|
8
8
|
],
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=14.0.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "mocha",
|
|
@@ -34,17 +34,15 @@
|
|
|
34
34
|
"url": "https://github.com/MetaMask/eth-ledger-bridge-keyring/issues"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/MetaMask/eth-ledger-bridge-keyring#readme",
|
|
37
|
-
"resolutions": {
|
|
38
|
-
"mocha/**/mkdirp": "^0.5.3"
|
|
39
|
-
},
|
|
40
37
|
"dependencies": {
|
|
41
|
-
"eth-sig-util": "^2.0.0",
|
|
42
38
|
"@ethereumjs/tx": "^3.2.0",
|
|
39
|
+
"eth-sig-util": "^2.0.0",
|
|
43
40
|
"ethereumjs-util": "^7.0.9",
|
|
44
41
|
"hdkey": "0.8.0"
|
|
45
42
|
},
|
|
46
43
|
"devDependencies": {
|
|
47
44
|
"@ethereumjs/common": "^2.4.0",
|
|
45
|
+
"@lavamoat/allow-scripts": "^2.3.0",
|
|
48
46
|
"@metamask/eslint-config": "^3.0.0",
|
|
49
47
|
"babel-eslint": "^10.1.0",
|
|
50
48
|
"chai": "^4.1.2",
|
|
@@ -55,5 +53,17 @@
|
|
|
55
53
|
"eslint-plugin-mocha": "^6.2.2",
|
|
56
54
|
"ethereumjs-tx": "^1.3.4",
|
|
57
55
|
"mocha": "^5.0.4"
|
|
56
|
+
},
|
|
57
|
+
"packageManager": "yarn@3.4.1",
|
|
58
|
+
"lavamoat": {
|
|
59
|
+
"allowScripts": {
|
|
60
|
+
"@lavamoat/preinstall-always-fail": false,
|
|
61
|
+
"eth-sig-util>ethereumjs-abi>ethereumjs-util>keccak": false,
|
|
62
|
+
"eth-sig-util>ethereumjs-util>keccak": false,
|
|
63
|
+
"ethereumjs-tx>ethereumjs-util>keccak": false,
|
|
64
|
+
"ethereumjs-util>ethereum-cryptography>keccak": false,
|
|
65
|
+
"ethereumjs-util>ethereum-cryptography>secp256k1": false,
|
|
66
|
+
"hdkey>secp256k1": false
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
69
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
## [0.12.0]
|
|
11
|
-
### Added
|
|
12
|
-
- Add a new `destroy` method which will remove the `message` event listener from window. ([#145](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/145))
|
|
13
|
-
|
|
14
|
-
## [0.11.0]
|
|
15
|
-
### Added
|
|
16
|
-
- Add a new `isConnected` method which allows determining if the device is last known to be connected. ([#131](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/131))
|
|
17
|
-
### Changed
|
|
18
|
-
- Messaging now runs off of message IDs instead of assuming the response received is from the last message sent, which will not always been true. ([#132](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/132))
|
|
19
|
-
|
|
20
|
-
## [0.10.0]
|
|
21
|
-
### Added
|
|
22
|
-
- Add a new `attemptMakeApp` method which allows clients to attempt a creation of the Ledger transport for the purposes of detecting/catching potential connection errors. ([#126](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/126))
|
|
23
|
-
|
|
24
|
-
## [0.9.0]
|
|
25
|
-
### Changed
|
|
26
|
-
- `updateTransportMethod` no longer defaults its parameter to false, and now names the param sent with the `'ledger-update-transport'` message `transportType`. This better is to support the use of an enum, instead of a boolean, for specifying transport preferences. ([#114](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/114))
|
|
27
|
-
|
|
28
|
-
## [0.8.0]
|
|
29
|
-
### Added
|
|
30
|
-
- Allow ledger-bridge iframe to connect Ledger wia WebHID, when it is supported by the current browser ([#107](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/107))
|
|
31
|
-
|
|
32
|
-
### Changed
|
|
33
|
-
- Reject with an Error object if unlocking is not successful ([#104](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/104))
|
|
34
|
-
- Ensure that logs of errors only have a single `Error:` string in the message ([#105](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/105))
|
|
35
|
-
|
|
36
|
-
## [0.7.0]
|
|
37
|
-
### Changed
|
|
38
|
-
- Remove unused `events` and `ethereumjs-tx` dependencies ([#101](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/101), [#102](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/102))
|
|
39
|
-
- Update eth-ledger-bridge-keyring to support EIP-1559 transactions ([#98](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/98), [#97](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/97), [#96](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/96))
|
|
40
|
-
|
|
41
|
-
## [0.6.0]
|
|
42
|
-
### Added
|
|
43
|
-
- Support new versions of ethereumjs/tx ([#68](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/68))
|