@metamask-previews/keyring-controller 19.1.0-preview-cb58d7d1 → 19.1.0-preview-ac664446

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.
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
36
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
- var _KeyringController_instances, _KeyringController_controllerOperationMutex, _KeyringController_vaultOperationMutex, _KeyringController_keyringBuilders, _KeyringController_unsupportedKeyrings, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_keyringsMetadata, _KeyringController_password, _KeyringController_qrKeyringStateListener, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringByIdOrDefault, _KeyringController_getKeyringBuilderForType, _KeyringController_addQRKeyring, _KeyringController_subscribeToQRKeyringEvents, _KeyringController_unsubscribeFromQRKeyringsEvents, _KeyringController_createNewVaultWithKeyring, _KeyringController_verifySeedPhrase, _KeyringController_getUpdatedKeyrings, _KeyringController_getSerializedKeyrings, _KeyringController_restoreSerializedKeyrings, _KeyringController_unlockKeyrings, _KeyringController_updateVault, _KeyringController_getAccountsFromKeyrings, _KeyringController_createKeyringWithFirstAccount, _KeyringController_newKeyring, _KeyringController_clearKeyrings, _KeyringController_restoreKeyring, _KeyringController_destroyKeyring, _KeyringController_removeEmptyKeyrings, _KeyringController_checkForDuplicate, _KeyringController_setUnlocked, _KeyringController_assertIsUnlocked, _KeyringController_persistOrRollback, _KeyringController_withRollback, _KeyringController_assertControllerMutexIsLocked, _KeyringController_withControllerLock, _KeyringController_withVaultLock;
39
+ var _KeyringController_instances, _KeyringController_controllerOperationMutex, _KeyringController_vaultOperationMutex, _KeyringController_keyringBuilders, _KeyringController_unsupportedKeyrings, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_password, _KeyringController_qrKeyringStateListener, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringBuilderForType, _KeyringController_addQRKeyring, _KeyringController_subscribeToQRKeyringEvents, _KeyringController_unsubscribeFromQRKeyringsEvents, _KeyringController_createNewVaultWithKeyring, _KeyringController_verifySeedPhrase, _KeyringController_getUpdatedKeyrings, _KeyringController_getSerializedKeyrings, _KeyringController_restoreSerializedKeyrings, _KeyringController_unlockKeyrings, _KeyringController_updateVault, _KeyringController_getAccountsFromKeyrings, _KeyringController_createKeyringWithFirstAccount, _KeyringController_newKeyring, _KeyringController_clearKeyrings, _KeyringController_restoreKeyring, _KeyringController_destroyKeyring, _KeyringController_removeEmptyKeyrings, _KeyringController_checkForDuplicate, _KeyringController_setUnlocked, _KeyringController_assertIsUnlocked, _KeyringController_persistOrRollback, _KeyringController_withRollback, _KeyringController_assertControllerMutexIsLocked, _KeyringController_withControllerLock, _KeyringController_withVaultLock;
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.KeyringController = exports.getDefaultKeyringState = exports.keyringBuilderFactory = exports.SignTypedDataVersion = exports.AccountImportStrategy = exports.isCustodyKeyring = exports.KeyringTypes = void 0;
42
42
  const util_1 = require("@ethereumjs/util");
@@ -48,8 +48,6 @@ const eth_simple_keyring_1 = __importDefault(require("@metamask/eth-simple-keyri
48
48
  const utils_1 = require("@metamask/utils");
49
49
  const async_mutex_1 = require("async-mutex");
50
50
  const ethereumjs_wallet_1 = __importStar(require("ethereumjs-wallet"));
51
- // When generating a ULID within the same millisecond, monotonicFactory provides some guarantees regarding sort order.
52
- const ulid_1 = require("ulid");
53
51
  const constants_1 = require("./constants.cjs");
54
52
  const name = 'KeyringController';
55
53
  /**
@@ -118,7 +116,6 @@ const getDefaultKeyringState = () => {
118
116
  return {
119
117
  isUnlocked: false,
120
118
  keyrings: [],
121
- keyringsMetadata: [],
122
119
  };
123
120
  };
124
121
  exports.getDefaultKeyringState = getDefaultKeyringState;
@@ -250,7 +247,6 @@ class KeyringController extends base_controller_1.BaseController {
250
247
  vault: { persist: true, anonymous: false },
251
248
  isUnlocked: { persist: false, anonymous: true },
252
249
  keyrings: { persist: false, anonymous: false },
253
- keyringsMetadata: { persist: true, anonymous: false },
254
250
  encryptionKey: { persist: false, anonymous: false },
255
251
  encryptionSalt: { persist: false, anonymous: false },
256
252
  },
@@ -268,7 +264,6 @@ class KeyringController extends base_controller_1.BaseController {
268
264
  _KeyringController_encryptor.set(this, void 0);
269
265
  _KeyringController_cacheEncryptionKey.set(this, void 0);
270
266
  _KeyringController_keyrings.set(this, void 0);
271
- _KeyringController_keyringsMetadata.set(this, void 0);
272
267
  _KeyringController_password.set(this, void 0);
273
268
  _KeyringController_qrKeyringStateListener.set(this, void 0);
274
269
  __classPrivateFieldSet(this, _KeyringController_keyringBuilders, keyringBuilders
@@ -276,7 +271,6 @@ class KeyringController extends base_controller_1.BaseController {
276
271
  : defaultKeyringBuilders, "f");
277
272
  __classPrivateFieldSet(this, _KeyringController_encryptor, encryptor, "f");
278
273
  __classPrivateFieldSet(this, _KeyringController_keyrings, [], "f");
279
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, state?.keyringsMetadata ?? [], "f");
280
274
  __classPrivateFieldSet(this, _KeyringController_unsupportedKeyrings, [], "f");
281
275
  // This option allows the controller to cache an exported key
282
276
  // for use in decrypting and encrypting data without password
@@ -346,6 +340,30 @@ class KeyringController extends base_controller_1.BaseController {
346
340
  return addedAccountAddress;
347
341
  });
348
342
  }
343
+ async addNewAccounts(numberOfAccountsToAdd, accountCount) {
344
+ __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
345
+ return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
346
+ const primaryKeyring = this.getKeyringsByType('HD Key Tree')[0];
347
+ if (!primaryKeyring) {
348
+ throw new Error('No HD keyring found');
349
+ }
350
+ const oldAccounts = await primaryKeyring.getAccounts();
351
+ if (accountCount && oldAccounts.length !== accountCount) {
352
+ if (accountCount > oldAccounts.length) {
353
+ throw new Error('Accounts out of sequence');
354
+ }
355
+ // we return the accounts already existing starting at index `accountCount`
356
+ const existingAccounts = oldAccounts.slice(accountCount);
357
+ if (!existingAccounts[0]) {
358
+ throw new Error(`Can't find account at index ${accountCount}`);
359
+ }
360
+ return existingAccounts;
361
+ }
362
+ const newAccounts = await primaryKeyring.addAccounts(numberOfAccountsToAdd);
363
+ await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this);
364
+ return newAccounts;
365
+ });
366
+ }
349
367
  /**
350
368
  * Effectively the same as creating a new keychain then populating it
351
369
  * using the given seed phrase.
@@ -425,18 +443,13 @@ class KeyringController extends base_controller_1.BaseController {
425
443
  * Gets the seed phrase of the HD keyring.
426
444
  *
427
445
  * @param password - Password of the keyring.
428
- * @param keyringId - The id of the keyring.
429
446
  * @returns Promise resolving to the seed phrase.
430
447
  */
431
- async exportSeedPhrase(password, keyringId) {
448
+ async exportSeedPhrase(password) {
432
449
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
433
450
  await this.verifyPassword(password);
434
- const selectedKeyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringByIdOrDefault).call(this, keyringId);
435
- if (!selectedKeyring) {
436
- throw new Error('Keyring not found');
437
- }
438
- assertHasUint8ArrayMnemonic(selectedKeyring);
439
- return selectedKeyring.mnemonic;
451
+ assertHasUint8ArrayMnemonic(__classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0]);
452
+ return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0].mnemonic;
440
453
  }
441
454
  /**
442
455
  * Gets the private key from the keyring controlling an address.
@@ -621,13 +634,6 @@ class KeyringController extends base_controller_1.BaseController {
621
634
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
622
635
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
623
636
  const keyring = (await this.getKeyringForAccount(address));
624
- const keyringIndex = this.state.keyrings.findIndex((kr) => kr.accounts.includes(address));
625
- const isPrimaryKeyring = keyringIndex === 0;
626
- const shouldRemoveKeyring = (await keyring.getAccounts()).length === 1;
627
- // Primary keyring should never be removed, so we need to keep at least one account in it
628
- if (isPrimaryKeyring && shouldRemoveKeyring) {
629
- throw new Error(constants_1.KeyringControllerError.LastAccountInPrimaryKeyring);
630
- }
631
637
  // Not all the keyrings support this, so we have to check
632
638
  if (!keyring.removeAccount) {
633
639
  throw new Error(constants_1.KeyringControllerError.UnsupportedRemoveAccount);
@@ -638,7 +644,9 @@ class KeyringController extends base_controller_1.BaseController {
638
644
  // because `Keyring<State>.removeAccount` requires address to be `Hex`. Those
639
645
  // type would need to be updated for a full non-EVM support.
640
646
  keyring.removeAccount(address);
641
- if (shouldRemoveKeyring) {
647
+ const accounts = await keyring.getAccounts();
648
+ // Check if this was the last/only account
649
+ if (accounts.length === 0) {
642
650
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_removeEmptyKeyrings).call(this);
643
651
  }
644
652
  });
@@ -855,12 +863,11 @@ class KeyringController extends base_controller_1.BaseController {
855
863
  /**
856
864
  * Verifies the that the seed phrase restores the current keychain's accounts.
857
865
  *
858
- * @param keyringId - The id of the keyring to verify.
859
866
  * @returns Promise resolving to the seed phrase as Uint8Array.
860
867
  */
861
- async verifySeedPhrase(keyringId) {
868
+ async verifySeedPhrase() {
862
869
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
863
- return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withControllerLock).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this, keyringId));
870
+ return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withControllerLock).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this));
864
871
  }
865
872
  async withKeyring(selector, operation, options = {
866
873
  createIfMissing: false,
@@ -871,16 +878,12 @@ class KeyringController extends base_controller_1.BaseController {
871
878
  if ('address' in selector) {
872
879
  keyring = (await this.getKeyringForAccount(selector.address));
873
880
  }
874
- else if ('type' in selector) {
881
+ else {
875
882
  keyring = this.getKeyringsByType(selector.type)[selector.index || 0];
876
883
  if (!keyring && options.createIfMissing) {
877
884
  keyring = (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, selector.type, options.createWithData));
878
885
  }
879
886
  }
880
- else if ('id' in selector) {
881
- const index = this.state.keyringsMetadata.findIndex((metadata) => metadata.id === selector.id);
882
- keyring = __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[index];
883
- }
884
887
  if (!keyring) {
885
888
  throw new Error(constants_1.KeyringControllerError.KeyringNotFound);
886
889
  }
@@ -1094,7 +1097,7 @@ class KeyringController extends base_controller_1.BaseController {
1094
1097
  }
1095
1098
  }
1096
1099
  exports.KeyringController = KeyringController;
1097
- _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_keyringsMetadata = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1100
+ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1098
1101
  this.messagingSystem.registerActionHandler(`${name}:signMessage`, this.signMessage.bind(this));
1099
1102
  this.messagingSystem.registerActionHandler(`${name}:signPersonalMessage`, this.signPersonalMessage.bind(this));
1100
1103
  this.messagingSystem.registerActionHandler(`${name}:signTypedMessage`, this.signTypedMessage.bind(this));
@@ -1108,12 +1111,7 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
1108
1111
  this.messagingSystem.registerActionHandler(`${name}:patchUserOperation`, this.patchUserOperation.bind(this));
1109
1112
  this.messagingSystem.registerActionHandler(`${name}:signUserOperation`, this.signUserOperation.bind(this));
1110
1113
  this.messagingSystem.registerActionHandler(`${name}:addNewAccount`, this.addNewAccount.bind(this));
1111
- }, _KeyringController_getKeyringByIdOrDefault = function _KeyringController_getKeyringByIdOrDefault(keyringId) {
1112
- if (!keyringId) {
1113
- return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0];
1114
- }
1115
- const index = this.state.keyringsMetadata.findIndex((metadata) => metadata.id === keyringId);
1116
- return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[index];
1114
+ this.messagingSystem.registerActionHandler(`${name}:addNewAccounts`, this.addNewAccounts.bind(this));
1117
1115
  }, _KeyringController_getKeyringBuilderForType = function _KeyringController_getKeyringBuilderForType(type) {
1118
1116
  return __classPrivateFieldGet(this, _KeyringController_keyringBuilders, "f").find((keyringBuilder) => keyringBuilder.type === type);
1119
1117
  }, _KeyringController_addQRKeyring =
@@ -1166,29 +1164,23 @@ async function _KeyringController_createNewVaultWithKeyring(password, keyring) {
1166
1164
  });
1167
1165
  __classPrivateFieldSet(this, _KeyringController_password, password, "f");
1168
1166
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_clearKeyrings).call(this);
1169
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, [], "f");
1170
1167
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_createKeyringWithFirstAccount).call(this, keyring.type, keyring.opts);
1171
1168
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_setUnlocked).call(this);
1172
1169
  }, _KeyringController_verifySeedPhrase =
1173
1170
  /**
1174
1171
  * Internal non-exclusive method to verify the seed phrase.
1175
1172
  *
1176
- * @param keyringId - The id of the keyring to verify the seed phrase for.
1177
1173
  * @returns A promise resolving to the seed phrase as Uint8Array.
1178
1174
  */
1179
- async function _KeyringController_verifySeedPhrase(keyringId) {
1175
+ async function _KeyringController_verifySeedPhrase() {
1180
1176
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1181
- const keyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringByIdOrDefault).call(this, keyringId);
1182
- if (!keyring) {
1183
- throw new Error(constants_1.KeyringControllerError.KeyringNotFound);
1184
- }
1185
- // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
1186
- if (keyring.type !== KeyringTypes.hd) {
1187
- throw new Error(constants_1.KeyringControllerError.UnsupportedVerifySeedPhrase);
1177
+ const primaryKeyring = this.getKeyringsByType(KeyringTypes.hd)[0];
1178
+ if (!primaryKeyring) {
1179
+ throw new Error('No HD keyring found.');
1188
1180
  }
1189
- assertHasUint8ArrayMnemonic(keyring);
1190
- const seedWords = keyring.mnemonic;
1191
- const accounts = await keyring.getAccounts();
1181
+ assertHasUint8ArrayMnemonic(primaryKeyring);
1182
+ const seedWords = primaryKeyring.mnemonic;
1183
+ const accounts = await primaryKeyring.getAccounts();
1192
1184
  /* istanbul ignore if */
1193
1185
  if (accounts.length === 0) {
1194
1186
  throw new Error('Cannot verify an empty keyring.');
@@ -1368,13 +1360,9 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1368
1360
  throw new Error(constants_1.KeyringControllerError.MissingVaultData);
1369
1361
  }
1370
1362
  const updatedKeyrings = await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getUpdatedKeyrings).call(this);
1371
- if (updatedKeyrings.length !== __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length) {
1372
- throw new Error(constants_1.KeyringControllerError.KeyringMetadataLengthMismatch);
1373
- }
1374
1363
  this.update((state) => {
1375
1364
  state.vault = updatedState.vault;
1376
1365
  state.keyrings = updatedKeyrings;
1377
- state.keyringsMetadata = __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").slice();
1378
1366
  if (updatedState.encryptionKey) {
1379
1367
  state.encryptionKey = updatedState.encryptionKey;
1380
1368
  state.encryptionSalt = JSON.parse(updatedState.vault).salt;
@@ -1414,7 +1402,6 @@ async function _KeyringController_createKeyringWithFirstAccount(type, opts) {
1414
1402
  if (!firstAccount) {
1415
1403
  throw new Error(constants_1.KeyringControllerError.NoFirstAccount);
1416
1404
  }
1417
- return firstAccount;
1418
1405
  }, _KeyringController_newKeyring =
1419
1406
  /**
1420
1407
  * Instantiate, initialize and return a new keyring of the given `type`,
@@ -1428,10 +1415,6 @@ async function _KeyringController_createKeyringWithFirstAccount(type, opts) {
1428
1415
  */
1429
1416
  async function _KeyringController_newKeyring(type, data) {
1430
1417
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1431
- const newKeyringMetadata = {
1432
- id: (0, ulid_1.ulid)(),
1433
- name: '',
1434
- };
1435
1418
  const keyringBuilder = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringBuilderForType).call(this, type);
1436
1419
  if (!keyringBuilder) {
1437
1420
  throw new Error(`${constants_1.KeyringControllerError.NoKeyringBuilder}. Keyring type: ${type}`);
@@ -1459,9 +1442,6 @@ async function _KeyringController_newKeyring(type, data) {
1459
1442
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_subscribeToQRKeyringEvents).call(this, keyring);
1460
1443
  }
1461
1444
  __classPrivateFieldGet(this, _KeyringController_keyrings, "f").push(keyring);
1462
- if (__classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length < __classPrivateFieldGet(this, _KeyringController_keyrings, "f").length) {
1463
- __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").push(newKeyringMetadata);
1464
- }
1465
1445
  return keyring;
1466
1446
  }, _KeyringController_clearKeyrings =
1467
1447
  /**
@@ -1514,22 +1494,19 @@ async function _KeyringController_destroyKeyring(keyring) {
1514
1494
  async function _KeyringController_removeEmptyKeyrings() {
1515
1495
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1516
1496
  const validKeyrings = [];
1517
- const validKeyringMetadata = [];
1518
1497
  // Since getAccounts returns a Promise
1519
1498
  // We need to wait to hear back form each keyring
1520
1499
  // in order to decide which ones are now valid (accounts.length > 0)
1521
- await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring, index) => {
1500
+ await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring) => {
1522
1501
  const accounts = await keyring.getAccounts();
1523
1502
  if (accounts.length > 0) {
1524
1503
  validKeyrings.push(keyring);
1525
- validKeyringMetadata.push(__classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f")[index]);
1526
1504
  }
1527
1505
  else {
1528
1506
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_destroyKeyring).call(this, keyring);
1529
1507
  }
1530
1508
  }));
1531
1509
  __classPrivateFieldSet(this, _KeyringController_keyrings, validKeyrings, "f");
1532
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, validKeyringMetadata, "f");
1533
1510
  }, _KeyringController_checkForDuplicate =
1534
1511
  /**
1535
1512
  * Checks for duplicate keypairs, using the the first account in the given
@@ -1595,7 +1572,6 @@ async function _KeyringController_withRollback(callback) {
1595
1572
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withControllerLock).call(this, async ({ releaseLock }) => {
1596
1573
  const currentSerializedKeyrings = await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getSerializedKeyrings).call(this);
1597
1574
  const currentPassword = __classPrivateFieldGet(this, _KeyringController_password, "f");
1598
- const currentKeyringsMetadata = __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").slice();
1599
1575
  try {
1600
1576
  return await callback({ releaseLock });
1601
1577
  }
@@ -1603,7 +1579,6 @@ async function _KeyringController_withRollback(callback) {
1603
1579
  // Keyrings and password are restored to their previous state
1604
1580
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_restoreSerializedKeyrings).call(this, currentSerializedKeyrings);
1605
1581
  __classPrivateFieldSet(this, _KeyringController_password, currentPassword, "f");
1606
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, currentKeyringsMetadata, "f");
1607
1582
  throw e;
1608
1583
  }
1609
1584
  });