@metamask-previews/keyring-controller 22.0.2-preview-a272c5e1 → 22.0.2-preview-8e80bb02

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,14 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add support for envelope encryption ([#5940](https://github.com/MetaMask/core/pull/5940))
13
-
14
- ### Changed
15
-
16
- - Upgrade mock encryptor to support multiple ciphertexts ([#5943](https://github.com/MetaMask/core/pull/5943))
17
-
18
10
  ## [22.0.2]
19
11
 
20
12
  ### Fixed
@@ -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_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_unsupportedKeyrings, _KeyringController_password, _KeyringController_encryptionKey, _KeyringController_qrKeyringStateListener, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringById, _KeyringController_getKeyringByIdOrDefault, _KeyringController_getKeyringMetadata, _KeyringController_getKeyringBuilderForType, _KeyringController_addQRKeyring, _KeyringController_subscribeToQRKeyringEvents, _KeyringController_unsubscribeFromQRKeyringsEvents, _KeyringController_createNewVaultWithKeyring, _KeyringController_updateCachedEncryptionKey, _KeyringController_verifySeedPhrase, _KeyringController_getUpdatedKeyrings, _KeyringController_getSerializedKeyrings, _KeyringController_getSessionState, _KeyringController_restoreSerializedKeyrings, _KeyringController_unlockKeyrings, _KeyringController_updateVault, _KeyringController_isNewEncryptionAvailable, _KeyringController_isEnvelopeEncryptionEnabled, _KeyringController_getAccountsFromKeyrings, _KeyringController_createKeyringWithFirstAccount, _KeyringController_newKeyring, _KeyringController_createKeyring, _KeyringController_clearKeyrings, _KeyringController_restoreKeyring, _KeyringController_destroyKeyring, _KeyringController_removeEmptyKeyrings, _KeyringController_assertNoDuplicateAccounts, _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_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_unsupportedKeyrings, _KeyringController_password, _KeyringController_qrKeyringStateListener, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringById, _KeyringController_getKeyringByIdOrDefault, _KeyringController_getKeyringMetadata, _KeyringController_getKeyringBuilderForType, _KeyringController_addQRKeyring, _KeyringController_subscribeToQRKeyringEvents, _KeyringController_unsubscribeFromQRKeyringsEvents, _KeyringController_createNewVaultWithKeyring, _KeyringController_verifySeedPhrase, _KeyringController_getUpdatedKeyrings, _KeyringController_getSerializedKeyrings, _KeyringController_getSessionState, _KeyringController_restoreSerializedKeyrings, _KeyringController_unlockKeyrings, _KeyringController_updateVault, _KeyringController_isNewEncryptionAvailable, _KeyringController_getAccountsFromKeyrings, _KeyringController_createKeyringWithFirstAccount, _KeyringController_newKeyring, _KeyringController_createKeyring, _KeyringController_clearKeyrings, _KeyringController_restoreKeyring, _KeyringController_destroyKeyring, _KeyringController_removeEmptyKeyrings, _KeyringController_assertNoDuplicateAccounts, _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");
@@ -168,17 +168,6 @@ function assertIsValidPassword(password) {
168
168
  throw new Error(constants_1.KeyringControllerError.InvalidEmptyPassword);
169
169
  }
170
170
  }
171
- /**
172
- * Assert that the provided cacheEncryptionKey is true.
173
- *
174
- * @param cacheEncryptionKey - The cacheEncryptionKey to check.
175
- * @throws If the cacheEncryptionKey is not true.
176
- */
177
- function assertIsCacheEncryptionKeyTrue(cacheEncryptionKey) {
178
- if (!cacheEncryptionKey) {
179
- throw new Error(constants_1.KeyringControllerError.CacheEncryptionKeyDisabled);
180
- }
181
- }
182
171
  /**
183
172
  * Checks if the provided value is a serialized keyrings array.
184
173
  *
@@ -269,7 +258,6 @@ class KeyringController extends base_controller_1.BaseController {
269
258
  keyrings: { persist: false, anonymous: false },
270
259
  encryptionKey: { persist: false, anonymous: false },
271
260
  encryptionSalt: { persist: false, anonymous: false },
272
- encryptedEncryptionKey: { persist: true, anonymous: false },
273
261
  },
274
262
  messenger,
275
263
  state: {
@@ -286,7 +274,6 @@ class KeyringController extends base_controller_1.BaseController {
286
274
  _KeyringController_keyrings.set(this, void 0);
287
275
  _KeyringController_unsupportedKeyrings.set(this, void 0);
288
276
  _KeyringController_password.set(this, void 0);
289
- _KeyringController_encryptionKey.set(this, void 0);
290
277
  _KeyringController_qrKeyringStateListener.set(this, void 0);
291
278
  __classPrivateFieldSet(this, _KeyringController_keyringBuilders, keyringBuilders
292
279
  ? keyringBuilders.concat(defaultKeyringBuilders)
@@ -386,22 +373,19 @@ class KeyringController extends base_controller_1.BaseController {
386
373
  /**
387
374
  * Create a new vault and primary keyring.
388
375
  *
389
- * This only works if keyrings are empty. If there is a pre-existing unlocked
390
- * vault, calling this will have no effect. If there is a pre-existing locked
391
- * vault, it will be replaced.
376
+ * This only works if keyrings are empty. If there is a pre-existing unlocked vault, calling this will have no effect.
377
+ * If there is a pre-existing locked vault, it will be replaced.
392
378
  *
393
379
  * @param password - Password to unlock the new vault.
394
- * @param encryptionKey - Optional encryption key to encrypt the new vault. If
395
- * set, envelope encryption will be used.
396
380
  * @returns Promise resolving when the operation ends successfully.
397
381
  */
398
- async createNewVaultAndKeychain(password, encryptionKey) {
382
+ async createNewVaultAndKeychain(password) {
399
383
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
400
384
  const accounts = await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getAccountsFromKeyrings).call(this);
401
385
  if (!accounts.length) {
402
386
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_createNewVaultWithKeyring).call(this, password, {
403
387
  type: KeyringTypes.hd,
404
- }, encryptionKey);
388
+ });
405
389
  }
406
390
  });
407
391
  }
@@ -430,16 +414,7 @@ class KeyringController extends base_controller_1.BaseController {
430
414
  if (!this.state.vault) {
431
415
  throw new Error(constants_1.KeyringControllerError.VaultError);
432
416
  }
433
- if (this.state.encryptedEncryptionKey) {
434
- // Envelope encryption mode.
435
- assertIsExportableKeyEncryptor(__classPrivateFieldGet(this, _KeyringController_encryptor, "f"));
436
- const key = (await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decrypt(password, this.state.encryptedEncryptionKey));
437
- const importedKey = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").importKey(key);
438
- await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decryptWithKey(importedKey, this.state.vault);
439
- }
440
- else {
441
- await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decrypt(password, this.state.vault);
442
- }
417
+ await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decrypt(password, this.state.vault);
443
418
  }
444
419
  /**
445
420
  * Returns the status of the vault.
@@ -628,7 +603,7 @@ class KeyringController extends base_controller_1.BaseController {
628
603
  try {
629
604
  wallet = ethereumjs_wallet_1.thirdparty.fromEtherWallet(input, password);
630
605
  }
631
- catch {
606
+ catch (e) {
632
607
  wallet = wallet || (await ethereumjs_wallet_1.default.fromV3(input, password, true));
633
608
  }
634
609
  privateKey = (0, utils_1.bytesToHex)(wallet.getPrivateKey());
@@ -687,7 +662,6 @@ class KeyringController extends base_controller_1.BaseController {
687
662
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withRollback).call(this, async () => {
688
663
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_unsubscribeFromQRKeyringsEvents).call(this);
689
664
  __classPrivateFieldSet(this, _KeyringController_password, undefined, "f");
690
- __classPrivateFieldSet(this, _KeyringController_encryptionKey, undefined, "f");
691
665
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_clearKeyrings).call(this);
692
666
  this.update((state) => {
693
667
  state.isUnlocked = false;
@@ -868,24 +842,10 @@ class KeyringController extends base_controller_1.BaseController {
868
842
  * @returns Promise resolving when the operation completes.
869
843
  */
870
844
  changePassword(password) {
871
- return this.changePasswordAndEncryptionKey(password);
872
- }
873
- /**
874
- * Changes the password and encryption key used to encrypt the vault.
875
- *
876
- * @param password - The new password.
877
- * @param encryptionKey - The new encryption key. If omitted, the encryption
878
- * key will not be changed.
879
- * @returns Promise resolving when the operation completes.
880
- */
881
- changePasswordAndEncryptionKey(password, encryptionKey) {
882
845
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
883
846
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
884
847
  assertIsValidPassword(password);
885
- // Update password.
886
848
  __classPrivateFieldSet(this, _KeyringController_password, password, "f");
887
- // Update encryption key.
888
- __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_updateCachedEncryptionKey).call(this, encryptionKey);
889
849
  // We need to clear encryption key and salt from state
890
850
  // to force the controller to re-encrypt the vault using
891
851
  // the new password.
@@ -1199,7 +1159,7 @@ class KeyringController extends base_controller_1.BaseController {
1199
1159
  }
1200
1160
  }
1201
1161
  exports.KeyringController = KeyringController;
1202
- _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_encryptionKey = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1162
+ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1203
1163
  this.messagingSystem.registerActionHandler(`${name}:signMessage`, this.signMessage.bind(this));
1204
1164
  this.messagingSystem.registerActionHandler(`${name}:signEip7702Authorization`, this.signEip7702Authorization.bind(this));
1205
1165
  this.messagingSystem.registerActionHandler(`${name}:signPersonalMessage`, this.signPersonalMessage.bind(this));
@@ -1268,10 +1228,9 @@ async function _KeyringController_addQRKeyring() {
1268
1228
  * @param keyring - A object containing the params to instantiate a new keyring.
1269
1229
  * @param keyring.type - The keyring type.
1270
1230
  * @param keyring.opts - Optional parameters required to instantiate the keyring.
1271
- * @param encryptionKey - Optional encryption key to encrypt the vault.
1272
1231
  * @returns A promise that resolves to the state.
1273
1232
  */
1274
- async function _KeyringController_createNewVaultWithKeyring(password, keyring, encryptionKey) {
1233
+ async function _KeyringController_createNewVaultWithKeyring(password, keyring) {
1275
1234
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1276
1235
  if (typeof password !== 'string') {
1277
1236
  throw new TypeError(constants_1.KeyringControllerError.WrongPasswordType);
@@ -1281,17 +1240,9 @@ async function _KeyringController_createNewVaultWithKeyring(password, keyring, e
1281
1240
  delete state.encryptionSalt;
1282
1241
  });
1283
1242
  __classPrivateFieldSet(this, _KeyringController_password, password, "f");
1284
- __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_updateCachedEncryptionKey).call(this, encryptionKey);
1285
1243
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_clearKeyrings).call(this);
1286
1244
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_createKeyringWithFirstAccount).call(this, keyring.type, keyring.opts);
1287
1245
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_setUnlocked).call(this);
1288
- }, _KeyringController_updateCachedEncryptionKey = function _KeyringController_updateCachedEncryptionKey(encryptionKey) {
1289
- if (!encryptionKey && this.state.encryptedEncryptionKey) {
1290
- __classPrivateFieldSet(this, _KeyringController_encryptionKey, this.state.encryptionKey, "f");
1291
- }
1292
- else {
1293
- __classPrivateFieldSet(this, _KeyringController_encryptionKey, encryptionKey, "f");
1294
- }
1295
1246
  }, _KeyringController_verifySeedPhrase =
1296
1247
  /**
1297
1248
  * Internal non-exclusive method to verify the seed phrase.
@@ -1381,7 +1332,6 @@ async function _KeyringController_getSessionState() {
1381
1332
  return {
1382
1333
  keyrings: await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getSerializedKeyrings).call(this),
1383
1334
  password: __classPrivateFieldGet(this, _KeyringController_password, "f"),
1384
- encryptionKey: __classPrivateFieldGet(this, _KeyringController_encryptionKey, "f"),
1385
1335
  };
1386
1336
  }, _KeyringController_restoreSerializedKeyrings =
1387
1337
  /**
@@ -1417,7 +1367,7 @@ async function _KeyringController_restoreSerializedKeyrings(serializedKeyrings)
1417
1367
  */
1418
1368
  async function _KeyringController_unlockKeyrings(password, encryptionKey, encryptionSalt) {
1419
1369
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withVaultLock).call(this, async () => {
1420
- const { vault: encryptedVault, encryptedEncryptionKey } = this.state;
1370
+ const encryptedVault = this.state.vault;
1421
1371
  if (!encryptedVault) {
1422
1372
  throw new Error(constants_1.KeyringControllerError.VaultError);
1423
1373
  }
@@ -1426,20 +1376,11 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1426
1376
  if (__classPrivateFieldGet(this, _KeyringController_cacheEncryptionKey, "f")) {
1427
1377
  assertIsExportableKeyEncryptor(__classPrivateFieldGet(this, _KeyringController_encryptor, "f"));
1428
1378
  if (password) {
1429
- if (encryptedEncryptionKey) {
1430
- const key = (await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decrypt(password, encryptedEncryptionKey));
1431
- const importedKey = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").importKey(key);
1432
- vault = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decryptWithKey(importedKey, encryptedVault);
1433
- __classPrivateFieldSet(this, _KeyringController_password, password, "f");
1434
- updatedState.encryptionKey = key;
1435
- }
1436
- else {
1437
- const result = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decryptWithDetail(password, encryptedVault);
1438
- vault = result.vault;
1439
- __classPrivateFieldSet(this, _KeyringController_password, password, "f");
1440
- updatedState.encryptionKey = result.exportedKeyString;
1441
- updatedState.encryptionSalt = result.salt;
1442
- }
1379
+ const result = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").decryptWithDetail(password, encryptedVault);
1380
+ vault = result.vault;
1381
+ __classPrivateFieldSet(this, _KeyringController_password, password, "f");
1382
+ updatedState.encryptionKey = result.exportedKeyString;
1383
+ updatedState.encryptionSalt = result.salt;
1443
1384
  }
1444
1385
  else {
1445
1386
  const parsedEncryptedVault = JSON.parse(encryptedVault);
@@ -1510,31 +1451,15 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1510
1451
  updatedState.vault = JSON.stringify(vaultJSON);
1511
1452
  }
1512
1453
  else if (__classPrivateFieldGet(this, _KeyringController_password, "f")) {
1513
- if (__classPrivateFieldGet(this, _KeyringController_encryptionKey, "f")) {
1514
- // Update cached key.
1515
- updatedState.encryptionKey = __classPrivateFieldGet(this, _KeyringController_encryptionKey, "f");
1516
- // Encrypt key and update encrypted key.
1517
- const encryptedKey = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").encrypt(__classPrivateFieldGet(this, _KeyringController_password, "f"), __classPrivateFieldGet(this, _KeyringController_encryptionKey, "f"));
1518
- updatedState.encryptedEncryptionKey = encryptedKey;
1519
- // Encrypt and update vault.
1520
- const importedKey = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").importKey(__classPrivateFieldGet(this, _KeyringController_encryptionKey, "f"));
1521
- const vaultJSON = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").encryptWithKey(importedKey, serializedKeyrings);
1522
- updatedState.vault = JSON.stringify(vaultJSON);
1523
- }
1524
- else {
1525
- const { vault: newVault, exportedKeyString } = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").encryptWithDetail(__classPrivateFieldGet(this, _KeyringController_password, "f"), serializedKeyrings);
1526
- updatedState.vault = newVault;
1527
- updatedState.encryptionKey = exportedKeyString;
1528
- }
1454
+ const { vault: newVault, exportedKeyString } = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").encryptWithDetail(__classPrivateFieldGet(this, _KeyringController_password, "f"), serializedKeyrings);
1455
+ updatedState.vault = newVault;
1456
+ updatedState.encryptionKey = exportedKeyString;
1529
1457
  }
1530
1458
  }
1531
1459
  else {
1532
1460
  assertIsValidPassword(__classPrivateFieldGet(this, _KeyringController_password, "f"));
1533
1461
  updatedState.vault = await __classPrivateFieldGet(this, _KeyringController_encryptor, "f").encrypt(__classPrivateFieldGet(this, _KeyringController_password, "f"), serializedKeyrings);
1534
1462
  }
1535
- if (__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_isEnvelopeEncryptionEnabled).call(this)) {
1536
- assertIsCacheEncryptionKeyTrue(__classPrivateFieldGet(this, _KeyringController_cacheEncryptionKey, "f"));
1537
- }
1538
1463
  if (!updatedState.vault) {
1539
1464
  throw new Error(constants_1.KeyringControllerError.MissingVaultData);
1540
1465
  }
@@ -1546,9 +1471,6 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1546
1471
  state.encryptionKey = updatedState.encryptionKey;
1547
1472
  state.encryptionSalt = JSON.parse(updatedState.vault).salt;
1548
1473
  }
1549
- if (updatedState.encryptedEncryptionKey) {
1550
- state.encryptedEncryptionKey = updatedState.encryptedEncryptionKey;
1551
- }
1552
1474
  });
1553
1475
  return true;
1554
1476
  });
@@ -1558,8 +1480,6 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1558
1480
  return false;
1559
1481
  }
1560
1482
  return !__classPrivateFieldGet(this, _KeyringController_encryptor, "f").isVaultUpdated(vault);
1561
- }, _KeyringController_isEnvelopeEncryptionEnabled = function _KeyringController_isEnvelopeEncryptionEnabled() {
1562
- return this.state.encryptedEncryptionKey || __classPrivateFieldGet(this, _KeyringController_encryptionKey, "f");
1563
1483
  }, _KeyringController_getAccountsFromKeyrings =
1564
1484
  /**
1565
1485
  * Retrieves all the accounts from keyrings instances
@@ -1644,8 +1564,7 @@ async function _KeyringController_createKeyring(type, data) {
1644
1564
  if (keyring.init) {
1645
1565
  await keyring.init();
1646
1566
  }
1647
- if (type === KeyringTypes.hd &&
1648
- (!(0, utils_1.isObject)(data) || !data.mnemonic)) {
1567
+ if (type === KeyringTypes.hd && (!(0, utils_1.isObject)(data) || !data.mnemonic)) {
1649
1568
  if (!keyring.generateRandomMnemonic) {
1650
1569
  throw new Error(constants_1.KeyringControllerError.UnsupportedGenerateRandomMnemonic);
1651
1570
  }
@@ -1767,16 +1686,11 @@ async function _KeyringController_assertNoDuplicateAccounts(additionalKeyrings =
1767
1686
  }
1768
1687
  }, _KeyringController_persistOrRollback =
1769
1688
  /**
1770
- * Execute the given function after acquiring the controller lock and save the
1771
- * vault to state after it (only if needed), or rollback to their previous
1772
- * state in case of error.
1773
- *
1774
- * ATTENTION: The callback must **not** alter `controller.state`. Any state
1775
- * change performed by the callback will not be rolled back on error.
1689
+ * Execute the given function after acquiring the controller lock
1690
+ * and save the vault to state after it (only if needed), or rollback to their
1691
+ * previous state in case of error.
1776
1692
  *
1777
- * @param callback - The function to execute. This callback must **not** alter
1778
- * `controller.state`. Any state change performed by the callback will not be
1779
- * rolled back on error.
1693
+ * @param callback - The function to execute.
1780
1694
  * @returns The result of the function.
1781
1695
  */
1782
1696
  async function _KeyringController_persistOrRollback(callback) {