@metamask-previews/keyring-controller 21.0.6-preview-cb2e65da → 21.0.6-preview-dedc8739

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
+ - Metadata for unsupported keyring is removed on unlock ([#5725](https://github.com/MetaMask/core/pull/5725))
13
+
10
14
  ## [21.0.6]
11
15
 
12
16
  ### Changed
@@ -1387,6 +1387,7 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1387
1387
  const updatedKeyrings = await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getUpdatedKeyrings).call(this);
1388
1388
  this.update((state) => {
1389
1389
  state.keyrings = updatedKeyrings;
1390
+ state.keyringsMetadata = __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").slice();
1390
1391
  if (updatedState.encryptionKey || updatedState.encryptionSalt) {
1391
1392
  state.encryptionKey = updatedState.encryptionKey;
1392
1393
  state.encryptionSalt = updatedState.encryptionSalt;
@@ -1607,6 +1608,11 @@ async function _KeyringController_restoreKeyring(serialized) {
1607
1608
  catch (error) {
1608
1609
  console.error(error);
1609
1610
  __classPrivateFieldGet(this, _KeyringController_unsupportedKeyrings, "f").push(serialized);
1611
+ if (__classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length > __classPrivateFieldGet(this, _KeyringController_keyrings, "f").length) {
1612
+ // There was already a metadata entry for the keyring, so
1613
+ // we need to remove it
1614
+ __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").splice(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").length, 1);
1615
+ }
1610
1616
  return undefined;
1611
1617
  }
1612
1618
  }, _KeyringController_destroyKeyring =