@metamask-previews/keyring-controller 21.0.1-preview-c7dcfd5a → 21.0.1-preview-d987e9b2

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,10 +7,6 @@ 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
- - The cached encryption key is ignored when the vault needs to upgrade its encryption parameters ([#5601](https://github.com/MetaMask/core/pull/5601))
13
-
14
10
  ## [21.0.1]
15
11
 
16
12
  ### Fixed
@@ -1377,14 +1377,7 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1377
1377
  });
1378
1378
  }, _KeyringController_updateVault = function _KeyringController_updateVault() {
1379
1379
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withVaultLock).call(this, async () => {
1380
- const { encryptionKey, encryptionSalt, vault } = this.state;
1381
- // READ THIS CAREFULLY:
1382
- // We do check if the vault is still considered up-to-date, if not, we would not re-use the
1383
- // cached key and we will re-generate a new one (based on the password).
1384
- //
1385
- // This helps doing seamless updates of the vault. Useful in case we change some cryptographic
1386
- // parameters to the KDF.
1387
- const useCachedKey = encryptionKey && vault && __classPrivateFieldGet(this, _KeyringController_encryptor, "f").isVaultUpdated?.(vault);
1380
+ const { encryptionKey, encryptionSalt } = this.state;
1388
1381
  if (!__classPrivateFieldGet(this, _KeyringController_password, "f") && !encryptionKey) {
1389
1382
  throw new Error(constants_1.KeyringControllerError.MissingCredentials);
1390
1383
  }
@@ -1395,7 +1388,7 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1395
1388
  const updatedState = {};
1396
1389
  if (__classPrivateFieldGet(this, _KeyringController_cacheEncryptionKey, "f")) {
1397
1390
  assertIsExportableKeyEncryptor(__classPrivateFieldGet(this, _KeyringController_encryptor, "f"));
1398
- if (useCachedKey) {
1391
+ if (encryptionKey) {
1399
1392
  const key = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").importKey(encryptionKey);
1400
1393
  const vaultJSON = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").encryptWithKey(key, serializedKeyrings);
1401
1394
  vaultJSON.salt = encryptionSalt;