@metamask-previews/keyring-controller 21.0.2-preview-9d7b1fa6 → 21.0.2-preview-a906644

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
+ ### Fixed
11
+
12
+ - Fixed wrong error message thrown when using the wrong password ([#1234](https://github.com/MetaMask/core/pull/1234))
13
+
10
14
  ## [21.0.2]
11
15
 
12
16
  ### Changed
@@ -1295,9 +1295,6 @@ async function _KeyringController_restoreSerializedKeyrings(serializedKeyrings)
1295
1295
  for (const serializedKeyring of serializedKeyrings) {
1296
1296
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_restoreKeyring).call(this, serializedKeyring);
1297
1297
  }
1298
- if (__classPrivateFieldGet(this, _KeyringController_keyrings, "f").length !== __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length) {
1299
- throw new Error(constants_1.KeyringControllerError.KeyringMetadataLengthMismatch);
1300
- }
1301
1298
  }, _KeyringController_unlockKeyrings =
1302
1299
  /**
1303
1300
  * Unlock Keyrings, decrypting the vault and deserializing all
@@ -1355,6 +1352,11 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1355
1352
  throw new Error(constants_1.KeyringControllerError.VaultDataError);
1356
1353
  }
1357
1354
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_restoreSerializedKeyrings).call(this, vault);
1355
+ // The keyrings array and the keyringsMetadata array should
1356
+ // always be the same length while the controller is unlocked.
1357
+ if (__classPrivateFieldGet(this, _KeyringController_keyrings, "f").length !== __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length) {
1358
+ throw new Error(constants_1.KeyringControllerError.KeyringMetadataLengthMismatch);
1359
+ }
1358
1360
  const updatedKeyrings = await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getUpdatedKeyrings).call(this);
1359
1361
  this.update((state) => {
1360
1362
  state.keyrings = updatedKeyrings;