@metamask-previews/keyring-controller 19.0.3-preview-2ba45577 → 19.0.3-preview-4c4eb52a

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_keyrings, _KeyringController_unsupportedKeyrings, _KeyringController_password, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _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_persistOrRollback, _KeyringController_withRollback, _KeyringController_assertControllerMutexIsLocked, _KeyringController_withControllerLock, _KeyringController_withVaultLock;
39
+ var _KeyringController_instances, _KeyringController_controllerOperationMutex, _KeyringController_vaultOperationMutex, _KeyringController_keyringBuilders, _KeyringController_keyrings, _KeyringController_keyringsMetadata, _KeyringController_unsupportedKeyrings, _KeyringController_password, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_qrKeyringStateListener, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringById, _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_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,7 +48,10 @@ 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");
51
53
  const constants_1 = require("./constants.cjs");
54
+ const ulid = (0, ulid_1.monotonicFactory)();
52
55
  const name = 'KeyringController';
53
56
  /**
54
57
  * Available keyring types
@@ -132,6 +135,7 @@ const getDefaultKeyringState = () => {
132
135
  return {
133
136
  isUnlocked: false,
134
137
  keyrings: [],
138
+ keyringsMetadata: [],
135
139
  };
136
140
  };
137
141
  exports.getDefaultKeyringState = getDefaultKeyringState;
@@ -263,6 +267,7 @@ class KeyringController extends base_controller_1.BaseController {
263
267
  vault: { persist: true, anonymous: false },
264
268
  isUnlocked: { persist: false, anonymous: true },
265
269
  keyrings: { persist: false, anonymous: false },
270
+ keyringsMetadata: { persist: true, anonymous: false },
266
271
  encryptionKey: { persist: false, anonymous: false },
267
272
  encryptionSalt: { persist: false, anonymous: false },
268
273
  },
@@ -277,6 +282,7 @@ class KeyringController extends base_controller_1.BaseController {
277
282
  _KeyringController_vaultOperationMutex.set(this, new async_mutex_1.Mutex());
278
283
  _KeyringController_keyringBuilders.set(this, void 0);
279
284
  _KeyringController_keyrings.set(this, void 0);
285
+ _KeyringController_keyringsMetadata.set(this, void 0);
280
286
  _KeyringController_unsupportedKeyrings.set(this, void 0);
281
287
  _KeyringController_password.set(this, void 0);
282
288
  _KeyringController_encryptor.set(this, void 0);
@@ -287,6 +293,7 @@ class KeyringController extends base_controller_1.BaseController {
287
293
  : defaultKeyringBuilders, "f");
288
294
  __classPrivateFieldSet(this, _KeyringController_encryptor, encryptor, "f");
289
295
  __classPrivateFieldSet(this, _KeyringController_keyrings, [], "f");
296
+ __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, state?.keyringsMetadata ?? [], "f");
290
297
  __classPrivateFieldSet(this, _KeyringController_unsupportedKeyrings, [], "f");
291
298
  // This option allows the controller to cache an exported key
292
299
  // for use in decrypting and encrypting data without password
@@ -305,11 +312,11 @@ class KeyringController extends base_controller_1.BaseController {
305
312
  */
306
313
  async addNewAccount(accountCount) {
307
314
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
308
- const primaryKeyring = this.getKeyringsByType('HD Key Tree')[0];
309
- if (!primaryKeyring) {
315
+ const selectedKeyring = this.getKeyringsByType('HD Key Tree')[0];
316
+ if (!selectedKeyring) {
310
317
  throw new Error('No HD keyring found');
311
318
  }
312
- const oldAccounts = await primaryKeyring.getAccounts();
319
+ const oldAccounts = await selectedKeyring.getAccounts();
313
320
  if (accountCount && oldAccounts.length !== accountCount) {
314
321
  if (accountCount > oldAccounts.length) {
315
322
  throw new Error('Account out of sequence');
@@ -321,7 +328,7 @@ class KeyringController extends base_controller_1.BaseController {
321
328
  }
322
329
  return existingAccount;
323
330
  }
324
- const [addedAccountAddress] = await primaryKeyring.addAccounts(1);
331
+ const [addedAccountAddress] = await selectedKeyring.addAccounts(1);
325
332
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this);
326
333
  return addedAccountAddress;
327
334
  });
@@ -431,12 +438,21 @@ class KeyringController extends base_controller_1.BaseController {
431
438
  * Gets the seed phrase of the HD keyring.
432
439
  *
433
440
  * @param password - Password of the keyring.
441
+ * @param keyringId - The id of the keyring.
434
442
  * @returns Promise resolving to the seed phrase.
435
443
  */
436
- async exportSeedPhrase(password) {
444
+ async exportSeedPhrase(password, keyringId) {
437
445
  await this.verifyPassword(password);
438
- assertHasUint8ArrayMnemonic(__classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0]);
439
- return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0].mnemonic;
446
+ if (!keyringId) {
447
+ assertHasUint8ArrayMnemonic(__classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0]);
448
+ return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0].mnemonic;
449
+ }
450
+ const selectedKeyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, keyringId);
451
+ if (!selectedKeyring) {
452
+ throw new Error('Keyring not found');
453
+ }
454
+ assertHasUint8ArrayMnemonic(selectedKeyring);
455
+ return selectedKeyring.mnemonic;
440
456
  }
441
457
  /**
442
458
  * Gets the private key from the keyring controlling an address.
@@ -837,10 +853,24 @@ class KeyringController extends base_controller_1.BaseController {
837
853
  /**
838
854
  * Verifies the that the seed phrase restores the current keychain's accounts.
839
855
  *
856
+ * @param keyringId - The id of the keyring to verify.
840
857
  * @returns Promise resolving to the seed phrase as Uint8Array.
841
858
  */
842
- async verifySeedPhrase() {
843
- return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withControllerLock).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this));
859
+ async verifySeedPhrase(keyringId) {
860
+ let keyring;
861
+ if (!keyringId) {
862
+ keyring = __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0];
863
+ }
864
+ else {
865
+ keyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, keyringId);
866
+ if (keyring.type !== KeyringTypes.hd) {
867
+ throw new Error(constants_1.KeyringControllerError.UnsupportedVerifySeedPhrase);
868
+ }
869
+ }
870
+ if (!keyring) {
871
+ throw new Error(constants_1.KeyringControllerError.NoHdKeyring);
872
+ }
873
+ return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withControllerLock).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this, keyringId));
844
874
  }
845
875
  async withKeyring(selector, operation, options = {
846
876
  createIfMissing: false,
@@ -850,12 +880,15 @@ class KeyringController extends base_controller_1.BaseController {
850
880
  if ('address' in selector) {
851
881
  keyring = (await this.getKeyringForAccount(selector.address));
852
882
  }
853
- else {
883
+ else if ('type' in selector) {
854
884
  keyring = this.getKeyringsByType(selector.type)[selector.index || 0];
855
885
  if (!keyring && options.createIfMissing) {
856
886
  keyring = (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, selector.type, options.createWithData));
857
887
  }
858
888
  }
889
+ else if ('id' in selector) {
890
+ keyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, selector.id);
891
+ }
859
892
  if (!keyring) {
860
893
  throw new Error(constants_1.KeyringControllerError.KeyringNotFound);
861
894
  }
@@ -1055,7 +1088,7 @@ class KeyringController extends base_controller_1.BaseController {
1055
1088
  }
1056
1089
  }
1057
1090
  exports.KeyringController = KeyringController;
1058
- _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1091
+ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_keyringsMetadata = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1059
1092
  this.messagingSystem.registerActionHandler(`${name}:signMessage`, this.signMessage.bind(this));
1060
1093
  this.messagingSystem.registerActionHandler(`${name}:signPersonalMessage`, this.signPersonalMessage.bind(this));
1061
1094
  this.messagingSystem.registerActionHandler(`${name}:signTypedMessage`, this.signTypedMessage.bind(this));
@@ -1069,6 +1102,9 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
1069
1102
  this.messagingSystem.registerActionHandler(`${name}:patchUserOperation`, this.patchUserOperation.bind(this));
1070
1103
  this.messagingSystem.registerActionHandler(`${name}:signUserOperation`, this.signUserOperation.bind(this));
1071
1104
  this.messagingSystem.registerActionHandler(`${name}:addNewAccount`, this.addNewAccount.bind(this));
1105
+ }, _KeyringController_getKeyringById = function _KeyringController_getKeyringById(keyringId) {
1106
+ const index = this.state.keyringsMetadata.findIndex((metadata) => metadata.id === keyringId);
1107
+ return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[index];
1072
1108
  }, _KeyringController_getKeyringBuilderForType = function _KeyringController_getKeyringBuilderForType(type) {
1073
1109
  return __classPrivateFieldGet(this, _KeyringController_keyringBuilders, "f").find((keyringBuilder) => keyringBuilder.type === type);
1074
1110
  }, _KeyringController_addQRKeyring =
@@ -1082,7 +1118,7 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
1082
1118
  async function _KeyringController_addQRKeyring() {
1083
1119
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1084
1120
  // QRKeyring is not yet compatible with Keyring type from @metamask/utils
1085
- return (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, KeyringTypes.qr));
1121
+ return (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, KeyringTypes.qr, undefined));
1086
1122
  }, _KeyringController_subscribeToQRKeyringEvents = function _KeyringController_subscribeToQRKeyringEvents(qrKeyring) {
1087
1123
  __classPrivateFieldSet(this, _KeyringController_qrKeyringStateListener, (state) => {
1088
1124
  this.messagingSystem.publish(`${name}:qrKeyringStateChange`, state);
@@ -1127,17 +1163,20 @@ async function _KeyringController_createNewVaultWithKeyring(password, keyring) {
1127
1163
  /**
1128
1164
  * Internal non-exclusive method to verify the seed phrase.
1129
1165
  *
1166
+ * @param keyringId - The id of the keyring to verify the seed phrase for.
1130
1167
  * @returns A promise resolving to the seed phrase as Uint8Array.
1131
1168
  */
1132
- async function _KeyringController_verifySeedPhrase() {
1169
+ async function _KeyringController_verifySeedPhrase(keyringId) {
1133
1170
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1134
- const primaryKeyring = this.getKeyringsByType(KeyringTypes.hd)[0];
1135
- if (!primaryKeyring) {
1171
+ const keyring = keyringId
1172
+ ? __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, keyringId)
1173
+ : this.getKeyringsByType(KeyringTypes.hd)[0];
1174
+ if (!keyring) {
1136
1175
  throw new Error('No HD keyring found.');
1137
1176
  }
1138
- assertHasUint8ArrayMnemonic(primaryKeyring);
1139
- const seedWords = primaryKeyring.mnemonic;
1140
- const accounts = await primaryKeyring.getAccounts();
1177
+ assertHasUint8ArrayMnemonic(keyring);
1178
+ const seedWords = keyring.mnemonic;
1179
+ const accounts = await keyring.getAccounts();
1141
1180
  /* istanbul ignore if */
1142
1181
  if (accounts.length === 0) {
1143
1182
  throw new Error('Cannot verify an empty keyring.');
@@ -1185,7 +1224,7 @@ async function _KeyringController_getUpdatedKeyrings() {
1185
1224
  async function _KeyringController_getSerializedKeyrings({ includeUnsupported } = {
1186
1225
  includeUnsupported: true,
1187
1226
  }) {
1188
- const serializedKeyrings = await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring) => {
1227
+ const serializedKeyrings = await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring, index) => {
1189
1228
  const [type, data] = await Promise.all([
1190
1229
  keyring.type,
1191
1230
  keyring.serialize(),
@@ -1207,6 +1246,9 @@ async function _KeyringController_restoreSerializedKeyrings(serializedKeyrings)
1207
1246
  for (const serializedKeyring of serializedKeyrings) {
1208
1247
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_restoreKeyring).call(this, serializedKeyring);
1209
1248
  }
1249
+ if (__classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length > __classPrivateFieldGet(this, _KeyringController_keyrings, "f").length) {
1250
+ throw new Error(constants_1.KeyringControllerError.KeyringMetadataLengthMismatch);
1251
+ }
1210
1252
  }, _KeyringController_unlockKeyrings =
1211
1253
  /**
1212
1254
  * Unlock Keyrings, decrypting the vault and deserializing all
@@ -1320,10 +1362,14 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1320
1362
  this.update((state) => {
1321
1363
  state.vault = updatedState.vault;
1322
1364
  state.keyrings = updatedKeyrings;
1365
+ state.keyringsMetadata = __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f");
1323
1366
  if (updatedState.encryptionKey) {
1324
1367
  state.encryptionKey = updatedState.encryptionKey;
1325
1368
  state.encryptionSalt = JSON.parse(updatedState.vault).salt;
1326
1369
  }
1370
+ if (updatedKeyrings.length < __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length) {
1371
+ throw new Error(constants_1.KeyringControllerError.KeyringMetadataLengthMismatch);
1372
+ }
1327
1373
  });
1328
1374
  return true;
1329
1375
  });
@@ -1359,13 +1405,13 @@ async function _KeyringController_createKeyringWithFirstAccount(type, opts) {
1359
1405
  if (!firstAccount) {
1360
1406
  throw new Error(constants_1.KeyringControllerError.NoFirstAccount);
1361
1407
  }
1408
+ return firstAccount;
1362
1409
  }, _KeyringController_newKeyring =
1363
1410
  /**
1364
1411
  * Instantiate, initialize and return a new keyring of the given `type`,
1365
1412
  * using the given `opts`. The keyring is built using the keyring builder
1366
1413
  * registered for the given `type`.
1367
1414
  *
1368
- *
1369
1415
  * @param type - The type of keyring to add.
1370
1416
  * @param data - The data to restore a previously serialized keyring.
1371
1417
  * @returns The new keyring.
@@ -1373,6 +1419,10 @@ async function _KeyringController_createKeyringWithFirstAccount(type, opts) {
1373
1419
  */
1374
1420
  async function _KeyringController_newKeyring(type, data) {
1375
1421
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1422
+ const newKeyringMetadata = {
1423
+ id: ulid().toString(),
1424
+ name: '',
1425
+ };
1376
1426
  const keyringBuilder = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringBuilderForType).call(this, type);
1377
1427
  if (!keyringBuilder) {
1378
1428
  throw new Error(`${constants_1.KeyringControllerError.NoKeyringBuilder}. Keyring type: ${type}`);
@@ -1403,6 +1453,10 @@ async function _KeyringController_newKeyring(type, data) {
1403
1453
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_subscribeToQRKeyringEvents).call(this, keyring);
1404
1454
  }
1405
1455
  __classPrivateFieldGet(this, _KeyringController_keyrings, "f").push(keyring);
1456
+ if (newKeyringMetadata &&
1457
+ __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length < __classPrivateFieldGet(this, _KeyringController_keyrings, "f").length) {
1458
+ __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, [...__classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f"), newKeyringMetadata], "f");
1459
+ }
1406
1460
  return keyring;
1407
1461
  }, _KeyringController_clearKeyrings =
1408
1462
  /**
@@ -1415,6 +1469,10 @@ async function _KeyringController_clearKeyrings() {
1415
1469
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_destroyKeyring).call(this, keyring);
1416
1470
  }
1417
1471
  __classPrivateFieldSet(this, _KeyringController_keyrings, [], "f");
1472
+ __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, [], "f");
1473
+ // this.update((state) => {
1474
+ // state.keyringsMetadata = [];
1475
+ // });
1418
1476
  }, _KeyringController_restoreKeyring =
1419
1477
  /**
1420
1478
  * Restore a Keyring from a provided serialized payload.
@@ -1455,19 +1513,22 @@ async function _KeyringController_destroyKeyring(keyring) {
1455
1513
  async function _KeyringController_removeEmptyKeyrings() {
1456
1514
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1457
1515
  const validKeyrings = [];
1516
+ const validKeyringMetadata = [];
1458
1517
  // Since getAccounts returns a Promise
1459
1518
  // We need to wait to hear back form each keyring
1460
1519
  // in order to decide which ones are now valid (accounts.length > 0)
1461
- await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring) => {
1520
+ await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring, index) => {
1462
1521
  const accounts = await keyring.getAccounts();
1463
1522
  if (accounts.length > 0) {
1464
1523
  validKeyrings.push(keyring);
1524
+ validKeyringMetadata.push(this.state.keyringsMetadata[index]);
1465
1525
  }
1466
1526
  else {
1467
1527
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_destroyKeyring).call(this, keyring);
1468
1528
  }
1469
1529
  }));
1470
1530
  __classPrivateFieldSet(this, _KeyringController_keyrings, validKeyrings, "f");
1531
+ __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, validKeyringMetadata, "f");
1471
1532
  }, _KeyringController_checkForDuplicate =
1472
1533
  /**
1473
1534
  * Checks for duplicate keypairs, using the the first account in the given