@metamask/eth-ledger-bridge-keyring 0.12.0 → 0.13.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/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.13.0]
11
+ ### Added
12
+ - hdk.publicKey and hdk.chainCode should not be updated when unlocking using hdPath for an account. ([#146](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/146))
13
+
10
14
  ## [0.12.0]
11
15
  ### Added
12
16
  - 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))
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
- this.hdk.publicKey = Buffer.from(payload.publicKey, 'hex')
137
- this.hdk.chainCode = Buffer.from(payload.chainCode, 'hex')
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'))
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/eth-ledger-bridge-keyring",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "A MetaMask compatible keyring, for ledger hardware wallets",
5
5
  "main": "index.js",
6
6
  "files": [