@metamask-previews/keyring-controller 16.0.0-preview-699063fc → 16.0.0-preview-a6633f22

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.
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkZGV2QNCGjs = require('./chunk-ZGV2QNCG.js');
6
+ var _chunkNOCGQCUMjs = require('./chunk-NOCGQCUM.js');
7
7
 
8
8
  // src/KeyringController.ts
9
9
  var _util = require('@ethereumjs/util');
@@ -74,6 +74,14 @@ function assertIsExportableKeyEncryptor(encryptor) {
74
74
  throw new Error("KeyringController - The encryptor does not support encryption key export." /* UnsupportedEncryptionKeyExport */);
75
75
  }
76
76
  }
77
+ function assertIsValidPassword(password) {
78
+ if (typeof password !== "string") {
79
+ throw new Error("KeyringController - Password must be of type string." /* WrongPasswordType */);
80
+ }
81
+ if (!password || !password.length) {
82
+ throw new Error("KeyringController - Password cannot be empty." /* InvalidEmptyPassword */);
83
+ }
84
+ }
77
85
  function isSerializedKeyringsArray(array) {
78
86
  return typeof array === "object" && Array.isArray(array) && array.every((value) => value.type && _utils.isValidJson.call(void 0, value.data));
79
87
  }
@@ -124,14 +132,14 @@ var KeyringController = class extends _basecontroller.BaseController {
124
132
  * Constructor helper for registering this controller's messaging system
125
133
  * actions.
126
134
  */
127
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _registerMessageHandlers);
135
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _registerMessageHandlers);
128
136
  /**
129
137
  * Get the keyring builder for the given `type`.
130
138
  *
131
139
  * @param type - The type of keyring to get the builder for.
132
140
  * @returns The keyring builder, or undefined if none exists.
133
141
  */
134
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getKeyringBuilderForType);
142
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _getKeyringBuilderForType);
135
143
  /**
136
144
  * Add qr hardware keyring.
137
145
  *
@@ -139,15 +147,15 @@ var KeyringController = class extends _basecontroller.BaseController {
139
147
  * @throws If a QRKeyring builder is not provided
140
148
  * when initializing the controller
141
149
  */
142
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _addQRKeyring);
150
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _addQRKeyring);
143
151
  /**
144
152
  * Subscribe to a QRKeyring state change events and
145
153
  * forward them through the messaging system.
146
154
  *
147
155
  * @param qrKeyring - The QRKeyring instance to subscribe to
148
156
  */
149
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _subscribeToQRKeyringEvents);
150
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _unsubscribeFromQRKeyringsEvents);
157
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _subscribeToQRKeyringEvents);
158
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _unsubscribeFromQRKeyringsEvents);
151
159
  /**
152
160
  * Create new vault with an initial keyring
153
161
  *
@@ -162,14 +170,14 @@ var KeyringController = class extends _basecontroller.BaseController {
162
170
  * @param keyring.opts - Optional parameters required to instantiate the keyring.
163
171
  * @returns A promise that resolves to the state.
164
172
  */
165
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _createNewVaultWithKeyring);
173
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _createNewVaultWithKeyring);
166
174
  /**
167
175
  * Get the updated array of each keyring's type and
168
176
  * accounts list.
169
177
  *
170
178
  * @returns A promise resolving to the updated keyrings array.
171
179
  */
172
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getUpdatedKeyrings);
180
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _getUpdatedKeyrings);
173
181
  /**
174
182
  * Serialize the current array of keyring instances,
175
183
  * including unsupported keyrings by default.
@@ -178,13 +186,13 @@ var KeyringController = class extends _basecontroller.BaseController {
178
186
  * @param options.includeUnsupported - Whether to include unsupported keyrings.
179
187
  * @returns The serialized keyrings.
180
188
  */
181
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getSerializedKeyrings);
189
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _getSerializedKeyrings);
182
190
  /**
183
191
  * Restore a serialized keyrings array.
184
192
  *
185
193
  * @param serializedKeyrings - The serialized keyrings array.
186
194
  */
187
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _restoreSerializedKeyrings);
195
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _restoreSerializedKeyrings);
188
196
  /**
189
197
  * Unlock Keyrings, decrypting the vault and deserializing all
190
198
  * keyrings contained in it, using a password or an encryption key with salt.
@@ -194,20 +202,20 @@ var KeyringController = class extends _basecontroller.BaseController {
194
202
  * @param encryptionSalt - The salt used to encrypt the vault.
195
203
  * @returns A promise resolving to the deserialized keyrings array.
196
204
  */
197
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _unlockKeyrings);
205
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _unlockKeyrings);
198
206
  /**
199
207
  * Update the vault with the current keyrings.
200
208
  *
201
209
  * @returns A promise resolving to `true` if the operation is successful.
202
210
  */
203
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _updateVault);
211
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _updateVault);
204
212
  /**
205
213
  * Retrieves all the accounts from keyrings instances
206
214
  * that are currently in memory.
207
215
  *
208
216
  * @returns A promise resolving to an array of accounts.
209
217
  */
210
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getAccountsFromKeyrings);
218
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _getAccountsFromKeyrings);
211
219
  /**
212
220
  * Create a new keyring, ensuring that the first account is
213
221
  * also created.
@@ -216,7 +224,7 @@ var KeyringController = class extends _basecontroller.BaseController {
216
224
  * @param opts - Optional parameters required to instantiate the keyring.
217
225
  * @returns A promise that resolves if the operation is successful.
218
226
  */
219
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _createKeyringWithFirstAccount);
227
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _createKeyringWithFirstAccount);
220
228
  /**
221
229
  * Instantiate, initialize and return a new keyring of the given `type`,
222
230
  * using the given `opts`. The keyring is built using the keyring builder
@@ -228,12 +236,12 @@ var KeyringController = class extends _basecontroller.BaseController {
228
236
  * @returns The new keyring.
229
237
  * @throws If the keyring includes duplicated accounts.
230
238
  */
231
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _newKeyring);
239
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _newKeyring);
232
240
  /**
233
241
  * Remove all managed keyrings, destroying all their
234
242
  * instances in memory.
235
243
  */
236
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _clearKeyrings);
244
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _clearKeyrings);
237
245
  /**
238
246
  * Restore a Keyring from a provided serialized payload.
239
247
  * On success, returns the resulting keyring instance.
@@ -241,7 +249,7 @@ var KeyringController = class extends _basecontroller.BaseController {
241
249
  * @param serialized - The serialized keyring.
242
250
  * @returns The deserialized keyring or undefined if the keyring type is unsupported.
243
251
  */
244
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _restoreKeyring);
252
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _restoreKeyring);
245
253
  /**
246
254
  * Destroy Keyring
247
255
  *
@@ -251,14 +259,14 @@ var KeyringController = class extends _basecontroller.BaseController {
251
259
  *
252
260
  * @param keyring - The keyring to destroy.
253
261
  */
254
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _destroyKeyring);
262
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _destroyKeyring);
255
263
  /**
256
264
  * Remove empty keyrings.
257
265
  *
258
266
  * Loops through the keyrings and removes the ones with empty accounts
259
267
  * (usually after removing the last / only account) from a keyring.
260
268
  */
261
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _removeEmptyKeyrings);
269
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _removeEmptyKeyrings);
262
270
  /**
263
271
  * Checks for duplicate keypairs, using the the first account in the given
264
272
  * array. Rejects if a duplicate is found.
@@ -269,14 +277,14 @@ var KeyringController = class extends _basecontroller.BaseController {
269
277
  * @param newAccountArray - Array of new accounts.
270
278
  * @returns The account, if no duplicate is found.
271
279
  */
272
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _checkForDuplicate);
280
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _checkForDuplicate);
273
281
  /**
274
282
  * Set the `isUnlocked` to true and notify listeners
275
283
  * through the messenger.
276
284
  *
277
285
  * @fires KeyringController:unlock
278
286
  */
279
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _setUnlocked);
287
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _setUnlocked);
280
288
  /**
281
289
  * Execute the given function after acquiring the controller lock
282
290
  * and save the keyrings to state after it, or rollback to their
@@ -285,7 +293,7 @@ var KeyringController = class extends _basecontroller.BaseController {
285
293
  * @param fn - The function to execute.
286
294
  * @returns The result of the function.
287
295
  */
288
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _persistOrRollback);
296
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _persistOrRollback);
289
297
  /**
290
298
  * Execute the given function after acquiring the controller lock
291
299
  * and rollback keyrings and password states in case of error.
@@ -293,13 +301,13 @@ var KeyringController = class extends _basecontroller.BaseController {
293
301
  * @param fn - The function to execute atomically.
294
302
  * @returns The result of the function.
295
303
  */
296
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _withRollback);
304
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _withRollback);
297
305
  /**
298
306
  * Assert that the controller mutex is locked.
299
307
  *
300
308
  * @throws If the controller mutex is not locked.
301
309
  */
302
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _assertControllerMutexIsLocked);
310
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _assertControllerMutexIsLocked);
303
311
  /**
304
312
  * Lock the controller mutex before executing the given function,
305
313
  * and release it after the function is resolved or after an
@@ -312,7 +320,7 @@ var KeyringController = class extends _basecontroller.BaseController {
312
320
  * @param fn - The function to execute while the controller mutex is locked.
313
321
  * @returns The result of the function.
314
322
  */
315
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _withControllerLock);
323
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _withControllerLock);
316
324
  /**
317
325
  * Lock the vault mutex before executing the given function,
318
326
  * and release it after the function is resolved or after an
@@ -324,25 +332,25 @@ var KeyringController = class extends _basecontroller.BaseController {
324
332
  * @param fn - The function to execute while the vault mutex is locked.
325
333
  * @returns The result of the function.
326
334
  */
327
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _withVaultLock);
328
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _controllerOperationMutex, new (0, _asyncmutex.Mutex)());
329
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _vaultOperationMutex, new (0, _asyncmutex.Mutex)());
330
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _keyringBuilders, void 0);
331
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _keyrings, void 0);
332
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _unsupportedKeyrings, void 0);
333
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _password, void 0);
334
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _encryptor, void 0);
335
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _cacheEncryptionKey, void 0);
336
- _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _qrKeyringStateListener, void 0);
337
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyringBuilders, keyringBuilders ? defaultKeyringBuilders.concat(keyringBuilders) : defaultKeyringBuilders);
338
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _encryptor, encryptor);
339
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, []);
340
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _unsupportedKeyrings, []);
341
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _cacheEncryptionKey, Boolean(options.cacheEncryptionKey));
342
- if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
335
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _withVaultLock);
336
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _controllerOperationMutex, new (0, _asyncmutex.Mutex)());
337
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _vaultOperationMutex, new (0, _asyncmutex.Mutex)());
338
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _keyringBuilders, void 0);
339
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _keyrings, void 0);
340
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _unsupportedKeyrings, void 0);
341
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _password, void 0);
342
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _encryptor, void 0);
343
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _cacheEncryptionKey, void 0);
344
+ _chunkNOCGQCUMjs.__privateAdd.call(void 0, this, _qrKeyringStateListener, void 0);
345
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _keyringBuilders, keyringBuilders ? defaultKeyringBuilders.concat(keyringBuilders) : defaultKeyringBuilders);
346
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _encryptor, encryptor);
347
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _keyrings, []);
348
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _unsupportedKeyrings, []);
349
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _cacheEncryptionKey, Boolean(options.cacheEncryptionKey));
350
+ if (_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
343
351
  assertIsExportableKeyEncryptor(encryptor);
344
352
  }
345
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
353
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
346
354
  }
347
355
  /**
348
356
  * Adds a new account to the default (first) HD seed phrase keyring.
@@ -352,7 +360,7 @@ var KeyringController = class extends _basecontroller.BaseController {
352
360
  * @returns Promise resolving to the added account address.
353
361
  */
354
362
  async addNewAccount(accountCount) {
355
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
363
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
356
364
  const primaryKeyring = this.getKeyringsByType("HD Key Tree")[0];
357
365
  if (!primaryKeyring) {
358
366
  throw new Error("No HD keyring found");
@@ -381,8 +389,8 @@ var KeyringController = class extends _basecontroller.BaseController {
381
389
  * @returns Promise resolving to the added account address
382
390
  */
383
391
  async addNewAccountForKeyring(keyring, accountCount) {
384
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
385
- const oldAccounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
392
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
393
+ const oldAccounts = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
386
394
  if (accountCount && oldAccounts.length !== accountCount) {
387
395
  if (accountCount > oldAccounts.length) {
388
396
  throw new Error("Account out of sequence");
@@ -392,7 +400,7 @@ var KeyringController = class extends _basecontroller.BaseController {
392
400
  return existingAccount;
393
401
  }
394
402
  await keyring.addAccounts(1);
395
- const addedAccountAddress = (await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this)).find(
403
+ const addedAccountAddress = (await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this)).find(
396
404
  (selectedAddress) => !oldAccounts.includes(selectedAddress)
397
405
  );
398
406
  _utils.assertIsStrictHexString.call(void 0, addedAccountAddress);
@@ -405,7 +413,7 @@ var KeyringController = class extends _basecontroller.BaseController {
405
413
  * @returns Promise resolving to the added account address.
406
414
  */
407
415
  async addNewAccountWithoutUpdate() {
408
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
416
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
409
417
  const primaryKeyring = this.getKeyringsByType("HD Key Tree")[0];
410
418
  if (!primaryKeyring) {
411
419
  throw new Error("No HD keyring found");
@@ -425,11 +433,9 @@ var KeyringController = class extends _basecontroller.BaseController {
425
433
  * @returns Promise resolving when the operation ends successfully.
426
434
  */
427
435
  async createNewVaultAndRestore(password, seed) {
428
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
429
- if (!password || !password.length) {
430
- throw new Error("Invalid password");
431
- }
432
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
436
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
437
+ assertIsValidPassword(password);
438
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
433
439
  type: "HD Key Tree" /* hd */,
434
440
  opts: {
435
441
  mnemonic: seed,
@@ -445,10 +451,10 @@ var KeyringController = class extends _basecontroller.BaseController {
445
451
  * @returns Promise resolving when the operation ends successfully.
446
452
  */
447
453
  async createNewVaultAndKeychain(password) {
448
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
449
- const accounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
454
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
455
+ const accounts = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
450
456
  if (!accounts.length) {
451
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
457
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
452
458
  type: "HD Key Tree" /* hd */
453
459
  });
454
460
  }
@@ -466,7 +472,7 @@ var KeyringController = class extends _basecontroller.BaseController {
466
472
  if (type === "QR Hardware Wallet Device" /* qr */) {
467
473
  return this.getOrAddQRKeyring();
468
474
  }
469
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts));
475
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts));
470
476
  }
471
477
  /**
472
478
  * Method to verify a given password validity. Throws an
@@ -478,7 +484,7 @@ var KeyringController = class extends _basecontroller.BaseController {
478
484
  if (!this.state.vault) {
479
485
  throw new Error("KeyringController - Cannot unlock without a previous vault." /* VaultError */);
480
486
  }
481
- await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, this.state.vault);
487
+ await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, this.state.vault);
482
488
  }
483
489
  /**
484
490
  * Returns the status of the vault.
@@ -496,8 +502,8 @@ var KeyringController = class extends _basecontroller.BaseController {
496
502
  */
497
503
  async exportSeedPhrase(password) {
498
504
  await this.verifyPassword(password);
499
- assertHasUint8ArrayMnemonic(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings)[0]);
500
- return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings)[0].mnemonic;
505
+ assertHasUint8ArrayMnemonic(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings)[0]);
506
+ return _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings)[0].mnemonic;
501
507
  }
502
508
  /**
503
509
  * Gets the private key from the keyring controlling an address.
@@ -576,7 +582,7 @@ var KeyringController = class extends _basecontroller.BaseController {
576
582
  async getKeyringForAccount(account) {
577
583
  const hexed = _ethsigutil.normalize.call(void 0, account);
578
584
  const candidates = await Promise.all(
579
- _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
585
+ _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
580
586
  return Promise.all([keyring, keyring.getAccounts()]);
581
587
  })
582
588
  );
@@ -609,7 +615,7 @@ var KeyringController = class extends _basecontroller.BaseController {
609
615
  * @returns An array of keyrings of the given type.
610
616
  */
611
617
  getKeyringsByType(type) {
612
- return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).filter((keyring) => keyring.type === type);
618
+ return _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings).filter((keyring) => keyring.type === type);
613
619
  }
614
620
  /**
615
621
  * Persist all serialized keyrings in the vault.
@@ -619,7 +625,7 @@ var KeyringController = class extends _basecontroller.BaseController {
619
625
  * operation completes.
620
626
  */
621
627
  async persistAllKeyrings() {
622
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => true);
628
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => true);
623
629
  }
624
630
  /**
625
631
  * Imports an account with the specified import strategy.
@@ -630,7 +636,7 @@ var KeyringController = class extends _basecontroller.BaseController {
630
636
  * @returns Promise resolving to the imported account address.
631
637
  */
632
638
  async importAccountWithStrategy(strategy, args) {
633
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
639
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
634
640
  let privateKey;
635
641
  switch (strategy) {
636
642
  case "privateKey":
@@ -664,7 +670,7 @@ var KeyringController = class extends _basecontroller.BaseController {
664
670
  default:
665
671
  throw new Error(`Unexpected import strategy: '${strategy}'`);
666
672
  }
667
- const newKeyring = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "Simple Key Pair" /* simple */, [
673
+ const newKeyring = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "Simple Key Pair" /* simple */, [
668
674
  privateKey
669
675
  ]);
670
676
  const accounts = await newKeyring.getAccounts();
@@ -679,7 +685,7 @@ var KeyringController = class extends _basecontroller.BaseController {
679
685
  * @returns Promise resolving when the account is removed.
680
686
  */
681
687
  async removeAccount(address) {
682
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
688
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
683
689
  const keyring = await this.getKeyringForAccount(
684
690
  address
685
691
  );
@@ -689,7 +695,7 @@ var KeyringController = class extends _basecontroller.BaseController {
689
695
  await keyring.removeAccount(address);
690
696
  const accounts = await keyring.getAccounts();
691
697
  if (accounts.length === 0) {
692
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _removeEmptyKeyrings, removeEmptyKeyrings_fn).call(this);
698
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _removeEmptyKeyrings, removeEmptyKeyrings_fn).call(this);
693
699
  }
694
700
  });
695
701
  this.messagingSystem.publish(`${name}:accountRemoved`, address);
@@ -700,10 +706,10 @@ var KeyringController = class extends _basecontroller.BaseController {
700
706
  * @returns Promise resolving when the operation completes.
701
707
  */
702
708
  async setLocked() {
703
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
704
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _unsubscribeFromQRKeyringsEvents, unsubscribeFromQRKeyringsEvents_fn).call(this);
705
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, void 0);
706
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
709
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
710
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _unsubscribeFromQRKeyringsEvents, unsubscribeFromQRKeyringsEvents_fn).call(this);
711
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _password, void 0);
712
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
707
713
  this.update((state) => {
708
714
  state.isUnlocked = false;
709
715
  state.keyrings = [];
@@ -857,6 +863,27 @@ var KeyringController = class extends _basecontroller.BaseController {
857
863
  }
858
864
  return await keyring.signUserOperation(address, userOp, executionContext);
859
865
  }
866
+ /**
867
+ * Changes the password used to encrypt the vault.
868
+ *
869
+ * @param password - The new password.
870
+ * @returns Promise resolving when the operation completes.
871
+ */
872
+ changePassword(password) {
873
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
874
+ if (!this.state.isUnlocked) {
875
+ throw new Error("KeyringController - Cannot persist vault without password and encryption key" /* MissingCredentials */);
876
+ }
877
+ assertIsValidPassword(password);
878
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _password, password);
879
+ if (_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
880
+ this.update((state) => {
881
+ delete state.encryptionKey;
882
+ delete state.encryptionSalt;
883
+ });
884
+ }
885
+ });
886
+ }
860
887
  /**
861
888
  * Attempts to decrypt the current vault and load its keyrings,
862
889
  * using the given encryption key and salt.
@@ -866,9 +893,9 @@ var KeyringController = class extends _basecontroller.BaseController {
866
893
  * @returns Promise resolving when the operation completes.
867
894
  */
868
895
  async submitEncryptionKey(encryptionKey, encryptionSalt) {
869
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
870
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, void 0, encryptionKey, encryptionSalt));
871
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
896
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
897
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _keyrings, await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, void 0, encryptionKey, encryptionSalt));
898
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
872
899
  });
873
900
  }
874
901
  /**
@@ -879,9 +906,9 @@ var KeyringController = class extends _basecontroller.BaseController {
879
906
  * @returns Promise resolving when the operation completes.
880
907
  */
881
908
  async submitPassword(password) {
882
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
883
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, password));
884
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
909
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
910
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _keyrings, await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, password));
911
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
885
912
  });
886
913
  }
887
914
  /**
@@ -900,7 +927,7 @@ var KeyringController = class extends _basecontroller.BaseController {
900
927
  if (accounts.length === 0) {
901
928
  throw new Error("Cannot verify an empty keyring.");
902
929
  }
903
- const hdKeyringBuilder = _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, "HD Key Tree" /* hd */);
930
+ const hdKeyringBuilder = _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, "HD Key Tree" /* hd */);
904
931
  const hdKeyring = hdKeyringBuilder();
905
932
  await hdKeyring.deserialize({
906
933
  mnemonic: seedWords,
@@ -920,14 +947,14 @@ var KeyringController = class extends _basecontroller.BaseController {
920
947
  async withKeyring(selector, operation, options = {
921
948
  createIfMissing: false
922
949
  }) {
923
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
950
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
924
951
  let keyring;
925
952
  if ("address" in selector) {
926
953
  keyring = await this.getKeyringForAccount(selector.address);
927
954
  } else {
928
955
  keyring = this.getKeyringsByType(selector.type)[selector.index || 0];
929
956
  if (!keyring && options.createIfMissing) {
930
- keyring = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, selector.type, options.createWithData);
957
+ keyring = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, selector.type, options.createWithData);
931
958
  }
932
959
  }
933
960
  if (!keyring) {
@@ -955,13 +982,13 @@ var KeyringController = class extends _basecontroller.BaseController {
955
982
  * @returns The added keyring
956
983
  */
957
984
  async getOrAddQRKeyring() {
958
- return this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this));
985
+ return this.getQRKeyring() || await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this));
959
986
  }
960
987
  // TODO: Replace `any` with type
961
988
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
962
989
  async restoreQRKeyring(serialized) {
963
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
964
- const keyring = this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
990
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
991
+ const keyring = this.getQRKeyring() || await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
965
992
  keyring.deserialize(serialized);
966
993
  });
967
994
  }
@@ -990,9 +1017,9 @@ var KeyringController = class extends _basecontroller.BaseController {
990
1017
  (await this.getOrAddQRKeyring()).cancelSync();
991
1018
  }
992
1019
  async connectQRHardware(page) {
993
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1020
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
994
1021
  try {
995
- const keyring = this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
1022
+ const keyring = this.getQRKeyring() || await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
996
1023
  let accounts;
997
1024
  switch (page) {
998
1025
  case -1:
@@ -1016,8 +1043,8 @@ var KeyringController = class extends _basecontroller.BaseController {
1016
1043
  });
1017
1044
  }
1018
1045
  async unlockQRHardwareWalletAccount(index) {
1019
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1020
- const keyring = this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
1046
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1047
+ const keyring = this.getQRKeyring() || await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
1021
1048
  keyring.setAccountToUnlock(index);
1022
1049
  await keyring.addAccounts(1);
1023
1050
  });
@@ -1029,14 +1056,14 @@ var KeyringController = class extends _basecontroller.BaseController {
1029
1056
  return keyring.type;
1030
1057
  }
1031
1058
  async forgetQRDevice() {
1032
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1059
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1033
1060
  const keyring = this.getQRKeyring();
1034
1061
  if (!keyring) {
1035
1062
  return { removedAccounts: [], remainingAccounts: [] };
1036
1063
  }
1037
- const allAccounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1064
+ const allAccounts = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1038
1065
  keyring.forgetDevice();
1039
- const remainingAccounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1066
+ const remainingAccounts = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1040
1067
  const removedAccounts = allAccounts.filter(
1041
1068
  (address) => !remainingAccounts.includes(address)
1042
1069
  );
@@ -1106,21 +1133,21 @@ registerMessageHandlers_fn = function() {
1106
1133
  };
1107
1134
  _getKeyringBuilderForType = new WeakSet();
1108
1135
  getKeyringBuilderForType_fn = function(type) {
1109
- return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyringBuilders).find(
1136
+ return _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyringBuilders).find(
1110
1137
  (keyringBuilder) => keyringBuilder.type === type
1111
1138
  );
1112
1139
  };
1113
1140
  _addQRKeyring = new WeakSet();
1114
1141
  addQRKeyring_fn = async function() {
1115
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1116
- return await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */);
1142
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1143
+ return await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */);
1117
1144
  };
1118
1145
  _subscribeToQRKeyringEvents = new WeakSet();
1119
1146
  subscribeToQRKeyringEvents_fn = function(qrKeyring) {
1120
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _qrKeyringStateListener, (state) => {
1147
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _qrKeyringStateListener, (state) => {
1121
1148
  this.messagingSystem.publish(`${name}:qrKeyringStateChange`, state);
1122
1149
  });
1123
- qrKeyring.getMemStore().subscribe(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1150
+ qrKeyring.getMemStore().subscribe(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1124
1151
  };
1125
1152
  _unsubscribeFromQRKeyringsEvents = new WeakSet();
1126
1153
  unsubscribeFromQRKeyringsEvents_fn = function() {
@@ -1128,32 +1155,32 @@ unsubscribeFromQRKeyringsEvents_fn = function() {
1128
1155
  "QR Hardware Wallet Device" /* qr */
1129
1156
  );
1130
1157
  qrKeyrings.forEach((qrKeyring) => {
1131
- if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _qrKeyringStateListener)) {
1132
- qrKeyring.getMemStore().unsubscribe(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1158
+ if (_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _qrKeyringStateListener)) {
1159
+ qrKeyring.getMemStore().unsubscribe(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1133
1160
  }
1134
1161
  });
1135
1162
  };
1136
1163
  _createNewVaultWithKeyring = new WeakSet();
1137
1164
  createNewVaultWithKeyring_fn = async function(password, keyring) {
1138
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1165
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1139
1166
  if (typeof password !== "string") {
1140
1167
  throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1141
1168
  }
1142
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, password);
1143
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1144
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _createKeyringWithFirstAccount, createKeyringWithFirstAccount_fn).call(this, keyring.type, keyring.opts);
1145
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
1169
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _password, password);
1170
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1171
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _createKeyringWithFirstAccount, createKeyringWithFirstAccount_fn).call(this, keyring.type, keyring.opts);
1172
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
1146
1173
  };
1147
1174
  _getUpdatedKeyrings = new WeakSet();
1148
1175
  getUpdatedKeyrings_fn = async function() {
1149
- return Promise.all(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(displayForKeyring));
1176
+ return Promise.all(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings).map(displayForKeyring));
1150
1177
  };
1151
1178
  _getSerializedKeyrings = new WeakSet();
1152
1179
  getSerializedKeyrings_fn = async function({ includeUnsupported } = {
1153
1180
  includeUnsupported: true
1154
1181
  }) {
1155
1182
  const serializedKeyrings = await Promise.all(
1156
- _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1183
+ _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1157
1184
  const [type, data] = await Promise.all([
1158
1185
  keyring.type,
1159
1186
  keyring.serialize()
@@ -1162,35 +1189,35 @@ getSerializedKeyrings_fn = async function({ includeUnsupported } = {
1162
1189
  })
1163
1190
  );
1164
1191
  if (includeUnsupported) {
1165
- serializedKeyrings.push(..._chunkZGV2QNCGjs.__privateGet.call(void 0, this, _unsupportedKeyrings));
1192
+ serializedKeyrings.push(..._chunkNOCGQCUMjs.__privateGet.call(void 0, this, _unsupportedKeyrings));
1166
1193
  }
1167
1194
  return serializedKeyrings;
1168
1195
  };
1169
1196
  _restoreSerializedKeyrings = new WeakSet();
1170
1197
  restoreSerializedKeyrings_fn = async function(serializedKeyrings) {
1171
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1198
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1172
1199
  for (const serializedKeyring of serializedKeyrings) {
1173
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _restoreKeyring, restoreKeyring_fn).call(this, serializedKeyring);
1200
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _restoreKeyring, restoreKeyring_fn).call(this, serializedKeyring);
1174
1201
  }
1175
1202
  };
1176
1203
  _unlockKeyrings = new WeakSet();
1177
1204
  unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1178
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async ({ releaseLock }) => {
1205
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async ({ releaseLock }) => {
1179
1206
  const encryptedVault = this.state.vault;
1180
1207
  if (!encryptedVault) {
1181
1208
  throw new Error("KeyringController - Cannot unlock without a previous vault." /* VaultError */);
1182
1209
  }
1183
1210
  let vault;
1184
1211
  const updatedState = {};
1185
- if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1186
- assertIsExportableKeyEncryptor(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor));
1212
+ if (_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1213
+ assertIsExportableKeyEncryptor(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor));
1187
1214
  if (password) {
1188
- const result = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decryptWithDetail(
1215
+ const result = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).decryptWithDetail(
1189
1216
  password,
1190
1217
  encryptedVault
1191
1218
  );
1192
1219
  vault = result.vault;
1193
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, password);
1220
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _password, password);
1194
1221
  updatedState.encryptionKey = result.exportedKeyString;
1195
1222
  updatedState.encryptionSalt = result.salt;
1196
1223
  } else {
@@ -1201,8 +1228,8 @@ unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1201
1228
  if (typeof encryptionKey !== "string") {
1202
1229
  throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1203
1230
  }
1204
- const key = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1205
- vault = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decryptWithKey(
1231
+ const key = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1232
+ vault = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).decryptWithKey(
1206
1233
  key,
1207
1234
  parsedEncryptedVault
1208
1235
  );
@@ -1213,14 +1240,14 @@ unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1213
1240
  if (typeof password !== "string") {
1214
1241
  throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1215
1242
  }
1216
- vault = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, encryptedVault);
1217
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, password);
1243
+ vault = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, encryptedVault);
1244
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _password, password);
1218
1245
  }
1219
1246
  if (!isSerializedKeyringsArray(vault)) {
1220
1247
  throw new Error("KeyringController - The decrypted vault has an unexpected shape." /* VaultDataError */);
1221
1248
  }
1222
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, vault);
1223
- const updatedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1249
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, vault);
1250
+ const updatedKeyrings = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1224
1251
  this.update((state) => {
1225
1252
  state.keyrings = updatedKeyrings;
1226
1253
  if (updatedState.encryptionKey || updatedState.encryptionSalt) {
@@ -1228,56 +1255,54 @@ unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1228
1255
  state.encryptionSalt = updatedState.encryptionSalt;
1229
1256
  }
1230
1257
  });
1231
- if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password) && (!_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey) || !encryptionKey) && _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated && !_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated(encryptedVault)) {
1258
+ if (_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _password) && (!_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _cacheEncryptionKey) || !encryptionKey) && _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated && !_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated(encryptedVault)) {
1232
1259
  releaseLock();
1233
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1260
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1234
1261
  }
1235
- return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings);
1262
+ return _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings);
1236
1263
  });
1237
1264
  };
1238
1265
  _updateVault = new WeakSet();
1239
1266
  updateVault_fn = function() {
1240
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async () => {
1267
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async () => {
1241
1268
  const { encryptionKey, encryptionSalt } = this.state;
1242
- if (!_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password) && !encryptionKey) {
1269
+ if (!_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _password) && !encryptionKey) {
1243
1270
  throw new Error("KeyringController - Cannot persist vault without password and encryption key" /* MissingCredentials */);
1244
1271
  }
1245
- const serializedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1272
+ const serializedKeyrings = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1246
1273
  if (!serializedKeyrings.some((keyring) => keyring.type === "HD Key Tree" /* hd */)) {
1247
1274
  throw new Error("KeyringController - No HD Keyring found" /* NoHdKeyring */);
1248
1275
  }
1249
1276
  const updatedState = {};
1250
- if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1251
- assertIsExportableKeyEncryptor(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor));
1277
+ if (_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1278
+ assertIsExportableKeyEncryptor(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor));
1252
1279
  if (encryptionKey) {
1253
- const key = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1254
- const vaultJSON = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).encryptWithKey(
1280
+ const key = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1281
+ const vaultJSON = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).encryptWithKey(
1255
1282
  key,
1256
1283
  serializedKeyrings
1257
1284
  );
1258
1285
  vaultJSON.salt = encryptionSalt;
1259
1286
  updatedState.vault = JSON.stringify(vaultJSON);
1260
- } else if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password)) {
1261
- const { vault: newVault, exportedKeyString } = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).encryptWithDetail(
1262
- _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password),
1287
+ } else if (_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _password)) {
1288
+ const { vault: newVault, exportedKeyString } = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).encryptWithDetail(
1289
+ _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _password),
1263
1290
  serializedKeyrings
1264
1291
  );
1265
1292
  updatedState.vault = newVault;
1266
1293
  updatedState.encryptionKey = exportedKeyString;
1267
1294
  }
1268
1295
  } else {
1269
- if (typeof _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password) !== "string") {
1270
- throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1271
- }
1272
- updatedState.vault = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).encrypt(
1273
- _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password),
1296
+ assertIsValidPassword(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _password));
1297
+ updatedState.vault = await _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _encryptor).encrypt(
1298
+ _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _password),
1274
1299
  serializedKeyrings
1275
1300
  );
1276
1301
  }
1277
1302
  if (!updatedState.vault) {
1278
1303
  throw new Error("KeyringController - Cannot persist vault without vault information" /* MissingVaultData */);
1279
1304
  }
1280
- const updatedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1305
+ const updatedKeyrings = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1281
1306
  this.update((state) => {
1282
1307
  state.vault = updatedState.vault;
1283
1308
  state.keyrings = updatedKeyrings;
@@ -1291,7 +1316,7 @@ updateVault_fn = function() {
1291
1316
  };
1292
1317
  _getAccountsFromKeyrings = new WeakSet();
1293
1318
  getAccountsFromKeyrings_fn = async function() {
1294
- const keyrings = _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings);
1319
+ const keyrings = _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings);
1295
1320
  const keyringArrays = await Promise.all(
1296
1321
  keyrings.map(async (keyring) => keyring.getAccounts())
1297
1322
  );
@@ -1302,8 +1327,8 @@ getAccountsFromKeyrings_fn = async function() {
1302
1327
  };
1303
1328
  _createKeyringWithFirstAccount = new WeakSet();
1304
1329
  createKeyringWithFirstAccount_fn = async function(type, opts) {
1305
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1306
- const keyring = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts);
1330
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1331
+ const keyring = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts);
1307
1332
  const [firstAccount] = await keyring.getAccounts();
1308
1333
  if (!firstAccount) {
1309
1334
  throw new Error("KeyringController - First Account not found." /* NoFirstAccount */);
@@ -1311,8 +1336,8 @@ createKeyringWithFirstAccount_fn = async function(type, opts) {
1311
1336
  };
1312
1337
  _newKeyring = new WeakSet();
1313
1338
  newKeyring_fn = async function(type, data) {
1314
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1315
- const keyringBuilder = _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, type);
1339
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1340
+ const keyringBuilder = _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, type);
1316
1341
  if (!keyringBuilder) {
1317
1342
  throw new Error(
1318
1343
  `${"KeyringController - No keyringBuilder found for keyring" /* NoKeyringBuilder */}. Keyring type: ${type}`
@@ -1332,29 +1357,29 @@ newKeyring_fn = async function(type, data) {
1332
1357
  keyring.generateRandomMnemonic();
1333
1358
  await keyring.addAccounts(1);
1334
1359
  }
1335
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _checkForDuplicate, checkForDuplicate_fn).call(this, type, await keyring.getAccounts());
1360
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _checkForDuplicate, checkForDuplicate_fn).call(this, type, await keyring.getAccounts());
1336
1361
  if (type === "QR Hardware Wallet Device" /* qr */) {
1337
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _subscribeToQRKeyringEvents, subscribeToQRKeyringEvents_fn).call(this, keyring);
1362
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _subscribeToQRKeyringEvents, subscribeToQRKeyringEvents_fn).call(this, keyring);
1338
1363
  }
1339
- _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).push(keyring);
1364
+ _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings).push(keyring);
1340
1365
  return keyring;
1341
1366
  };
1342
1367
  _clearKeyrings = new WeakSet();
1343
1368
  clearKeyrings_fn = async function() {
1344
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1345
- for (const keyring of _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings)) {
1346
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1369
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1370
+ for (const keyring of _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings)) {
1371
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1347
1372
  }
1348
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, []);
1373
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _keyrings, []);
1349
1374
  };
1350
1375
  _restoreKeyring = new WeakSet();
1351
1376
  restoreKeyring_fn = async function(serialized) {
1352
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1377
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1353
1378
  try {
1354
1379
  const { type, data } = serialized;
1355
- return await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, data);
1380
+ return await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, data);
1356
1381
  } catch (_) {
1357
- _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _unsupportedKeyrings).push(serialized);
1382
+ _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _unsupportedKeyrings).push(serialized);
1358
1383
  return void 0;
1359
1384
  }
1360
1385
  };
@@ -1364,23 +1389,23 @@ destroyKeyring_fn = async function(keyring) {
1364
1389
  };
1365
1390
  _removeEmptyKeyrings = new WeakSet();
1366
1391
  removeEmptyKeyrings_fn = async function() {
1367
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1392
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1368
1393
  const validKeyrings = [];
1369
1394
  await Promise.all(
1370
- _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1395
+ _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1371
1396
  const accounts = await keyring.getAccounts();
1372
1397
  if (accounts.length > 0) {
1373
1398
  validKeyrings.push(keyring);
1374
1399
  } else {
1375
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1400
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1376
1401
  }
1377
1402
  })
1378
1403
  );
1379
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, validKeyrings);
1404
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _keyrings, validKeyrings);
1380
1405
  };
1381
1406
  _checkForDuplicate = new WeakSet();
1382
1407
  checkForDuplicate_fn = async function(type, newAccountArray) {
1383
- const accounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1408
+ const accounts = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1384
1409
  switch (type) {
1385
1410
  case "Simple Key Pair" /* simple */: {
1386
1411
  const isIncluded = Boolean(
@@ -1400,7 +1425,7 @@ checkForDuplicate_fn = async function(type, newAccountArray) {
1400
1425
  };
1401
1426
  _setUnlocked = new WeakSet();
1402
1427
  setUnlocked_fn = function() {
1403
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1428
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1404
1429
  this.update((state) => {
1405
1430
  state.isUnlocked = true;
1406
1431
  });
@@ -1408,40 +1433,40 @@ setUnlocked_fn = function() {
1408
1433
  };
1409
1434
  _persistOrRollback = new WeakSet();
1410
1435
  persistOrRollback_fn = async function(fn) {
1411
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async ({ releaseLock }) => {
1436
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async ({ releaseLock }) => {
1412
1437
  const callbackResult = await fn({ releaseLock });
1413
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1438
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1414
1439
  return callbackResult;
1415
1440
  });
1416
1441
  };
1417
1442
  _withRollback = new WeakSet();
1418
1443
  withRollback_fn = async function(fn) {
1419
- return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withControllerLock, withControllerLock_fn).call(this, async ({ releaseLock }) => {
1420
- const currentSerializedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1421
- const currentPassword = _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password);
1444
+ return _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _withControllerLock, withControllerLock_fn).call(this, async ({ releaseLock }) => {
1445
+ const currentSerializedKeyrings = await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1446
+ const currentPassword = _chunkNOCGQCUMjs.__privateGet.call(void 0, this, _password);
1422
1447
  try {
1423
1448
  return await fn({ releaseLock });
1424
1449
  } catch (e) {
1425
- await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, currentSerializedKeyrings);
1426
- _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, currentPassword);
1450
+ await _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, currentSerializedKeyrings);
1451
+ _chunkNOCGQCUMjs.__privateSet.call(void 0, this, _password, currentPassword);
1427
1452
  throw e;
1428
1453
  }
1429
1454
  });
1430
1455
  };
1431
1456
  _assertControllerMutexIsLocked = new WeakSet();
1432
1457
  assertControllerMutexIsLocked_fn = function() {
1433
- if (!_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _controllerOperationMutex).isLocked()) {
1458
+ if (!_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _controllerOperationMutex).isLocked()) {
1434
1459
  throw new Error("KeyringController - attempt to update vault during a non mutually exclusive operation" /* ControllerLockRequired */);
1435
1460
  }
1436
1461
  };
1437
1462
  _withControllerLock = new WeakSet();
1438
1463
  withControllerLock_fn = async function(fn) {
1439
- return withLock(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _controllerOperationMutex), fn);
1464
+ return withLock(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _controllerOperationMutex), fn);
1440
1465
  };
1441
1466
  _withVaultLock = new WeakSet();
1442
1467
  withVaultLock_fn = async function(fn) {
1443
- _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1444
- return withLock(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _vaultOperationMutex), fn);
1468
+ _chunkNOCGQCUMjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1469
+ return withLock(_chunkNOCGQCUMjs.__privateGet.call(void 0, this, _vaultOperationMutex), fn);
1445
1470
  };
1446
1471
  async function withLock(mutex, fn) {
1447
1472
  const releaseLock = await mutex.acquire();
@@ -1463,4 +1488,4 @@ var KeyringController_default = KeyringController;
1463
1488
 
1464
1489
 
1465
1490
  exports.KeyringTypes = KeyringTypes; exports.isCustodyKeyring = isCustodyKeyring; exports.AccountImportStrategy = AccountImportStrategy; exports.SignTypedDataVersion = SignTypedDataVersion; exports.keyringBuilderFactory = keyringBuilderFactory; exports.getDefaultKeyringState = getDefaultKeyringState; exports.KeyringController = KeyringController; exports.KeyringController_default = KeyringController_default;
1466
- //# sourceMappingURL=chunk-7SZS2WCD.js.map
1491
+ //# sourceMappingURL=chunk-ORDHI6BF.js.map