@metamask-previews/keyring-controller 14.0.1-preview-f04be62f → 15.0.0-preview-fb52b9eb

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 @@ import type { MetaMaskKeyring as QRKeyring, IKeyringState as IQRKeyringState } f
3
3
  import type { RestrictedControllerMessenger } from '@metamask/base-controller';
4
4
  import { BaseController } from '@metamask/base-controller';
5
5
  import * as encryptorUtils from '@metamask/browser-passworder';
6
- import type { EthBaseTransaction, EthBaseUserOperation, EthKeyring, EthUserOperation, EthUserOperationPatch } from '@metamask/keyring-api';
6
+ import type { EthBaseTransaction, EthBaseUserOperation, EthKeyring, EthUserOperation, EthUserOperationPatch, KeyringExecutionContext } from '@metamask/keyring-api';
7
7
  import type { PersonalMessageParams, TypedMessageParams } from '@metamask/message-manager';
8
8
  import type { Eip1024EncryptedData, Hex, Json, KeyringClass } from '@metamask/utils';
9
9
  import type { Patch } from 'immer';
@@ -277,7 +277,6 @@ export declare const getDefaultKeyringState: () => KeyringControllerState;
277
277
  */
278
278
  export declare class KeyringController extends BaseController<typeof name, KeyringControllerState, KeyringControllerMessenger> {
279
279
  #private;
280
- private readonly mutex;
281
280
  /**
282
281
  * Creates a KeyringController instance.
283
282
  *
@@ -294,27 +293,23 @@ export declare class KeyringController extends BaseController<typeof name, Keyri
294
293
  *
295
294
  * @param accountCount - Number of accounts before adding a new one, used to
296
295
  * make the method idempotent.
297
- * @returns Promise resolving to keyring current state and added account
298
- * address.
296
+ * @returns Promise resolving to the added account address.
299
297
  */
300
- addNewAccount(accountCount?: number): Promise<{
301
- keyringState: KeyringControllerMemState;
302
- addedAccountAddress: string;
303
- }>;
298
+ addNewAccount(accountCount?: number): Promise<string>;
304
299
  /**
305
300
  * Adds a new account to the specified keyring.
306
301
  *
307
302
  * @param keyring - Keyring to add the account to.
308
303
  * @param accountCount - Number of accounts before adding a new one, used to make the method idempotent.
309
- * @returns Promise resolving to keyring current state and added account
304
+ * @returns Promise resolving to the added account address
310
305
  */
311
306
  addNewAccountForKeyring(keyring: EthKeyring<Json>, accountCount?: number): Promise<Hex>;
312
307
  /**
313
308
  * Adds a new account to the default (first) HD seed phrase keyring without updating identities in preferences.
314
309
  *
315
- * @returns Promise resolving to current state when the account is added.
310
+ * @returns Promise resolving to the added account address.
316
311
  */
317
- addNewAccountWithoutUpdate(): Promise<KeyringControllerMemState>;
312
+ addNewAccountWithoutUpdate(): Promise<string>;
318
313
  /**
319
314
  * Effectively the same as creating a new keychain then populating it
320
315
  * using the given seed phrase.
@@ -322,16 +317,16 @@ export declare class KeyringController extends BaseController<typeof name, Keyri
322
317
  * @param password - Password to unlock keychain.
323
318
  * @param seed - A BIP39-compliant seed phrase as Uint8Array,
324
319
  * either as a string or an array of UTF-8 bytes that represent the string.
325
- * @returns Promise resolving to the restored keychain object.
320
+ * @returns Promise resolving when the operation ends successfully.
326
321
  */
327
- createNewVaultAndRestore(password: string, seed: Uint8Array): Promise<KeyringControllerMemState>;
322
+ createNewVaultAndRestore(password: string, seed: Uint8Array): Promise<void>;
328
323
  /**
329
324
  * Create a new primary keychain and wipe any previous keychains.
330
325
  *
331
326
  * @param password - Password to unlock the new vault.
332
- * @returns Newly-created keychain object.
327
+ * @returns Promise resolving when the operation ends successfully.
333
328
  */
334
- createNewVaultAndKeychain(password: string): Promise<KeyringControllerMemState>;
329
+ createNewVaultAndKeychain(password: string): Promise<void>;
335
330
  /**
336
331
  * Adds a new keyring of the given `type`.
337
332
  *
@@ -370,7 +365,7 @@ export declare class KeyringController extends BaseController<typeof name, Keyri
370
365
  */
371
366
  exportAccount(password: string, address: string): Promise<string>;
372
367
  /**
373
- * Returns the public addresses of all accounts for the current keyring.
368
+ * Returns the public addresses of all accounts from every keyring.
374
369
  *
375
370
  * @returns A promise resolving to an array of addresses.
376
371
  */
@@ -430,27 +425,23 @@ export declare class KeyringController extends BaseController<typeof name, Keyri
430
425
  * @param strategy - Import strategy name.
431
426
  * @param args - Array of arguments to pass to the underlying stategy.
432
427
  * @throws Will throw when passed an unrecognized strategy.
433
- * @returns Promise resolving to keyring current state and imported account
434
- * address.
428
+ * @returns Promise resolving to the imported account address.
435
429
  */
436
- importAccountWithStrategy(strategy: AccountImportStrategy, args: any[]): Promise<{
437
- keyringState: KeyringControllerMemState;
438
- importedAccountAddress: string;
439
- }>;
430
+ importAccountWithStrategy(strategy: AccountImportStrategy, args: any[]): Promise<string>;
440
431
  /**
441
432
  * Removes an account from keyring state.
442
433
  *
443
434
  * @param address - Address of the account to remove.
444
435
  * @fires KeyringController:accountRemoved
445
- * @returns Promise resolving current state when this account removal completes.
436
+ * @returns Promise resolving when the account is removed.
446
437
  */
447
- removeAccount(address: Hex): Promise<KeyringControllerMemState>;
438
+ removeAccount(address: Hex): Promise<void>;
448
439
  /**
449
440
  * Deallocates all secrets and locks the wallet.
450
441
  *
451
- * @returns Promise resolving to current state.
442
+ * @returns Promise resolving when the operation completes.
452
443
  */
453
- setLocked(): Promise<KeyringControllerMemState>;
444
+ setLocked(): Promise<void>;
454
445
  /**
455
446
  * Signs message by calling down into a specific keyring.
456
447
  *
@@ -488,43 +479,46 @@ export declare class KeyringController extends BaseController<typeof name, Keyri
488
479
  *
489
480
  * @param from - Address of the sender.
490
481
  * @param transactions - Base transactions to include in the UserOperation.
482
+ * @param executionContext - The execution context to use for the UserOperation.
491
483
  * @returns A pseudo-UserOperation that can be used to construct a real.
492
484
  */
493
- prepareUserOperation(from: string, transactions: EthBaseTransaction[]): Promise<EthBaseUserOperation>;
485
+ prepareUserOperation(from: string, transactions: EthBaseTransaction[], executionContext: KeyringExecutionContext): Promise<EthBaseUserOperation>;
494
486
  /**
495
487
  * Patches properties of a UserOperation. Currently, only the
496
488
  * `paymasterAndData` can be patched.
497
489
  *
498
490
  * @param from - Address of the sender.
499
491
  * @param userOp - UserOperation to patch.
492
+ * @param executionContext - The execution context to use for the UserOperation.
500
493
  * @returns A patch to apply to the UserOperation.
501
494
  */
502
- patchUserOperation(from: string, userOp: EthUserOperation): Promise<EthUserOperationPatch>;
495
+ patchUserOperation(from: string, userOp: EthUserOperation, executionContext: KeyringExecutionContext): Promise<EthUserOperationPatch>;
503
496
  /**
504
497
  * Signs an UserOperation.
505
498
  *
506
499
  * @param from - Address of the sender.
507
500
  * @param userOp - UserOperation to sign.
501
+ * @param executionContext - The execution context to use for the UserOperation.
508
502
  * @returns The signature of the UserOperation.
509
503
  */
510
- signUserOperation(from: string, userOp: EthUserOperation): Promise<string>;
504
+ signUserOperation(from: string, userOp: EthUserOperation, executionContext: KeyringExecutionContext): Promise<string>;
511
505
  /**
512
506
  * Attempts to decrypt the current vault and load its keyrings,
513
507
  * using the given encryption key and salt.
514
508
  *
515
509
  * @param encryptionKey - Key to unlock the keychain.
516
510
  * @param encryptionSalt - Salt to unlock the keychain.
517
- * @returns Promise resolving to the current state.
511
+ * @returns Promise resolving when the operation completes.
518
512
  */
519
- submitEncryptionKey(encryptionKey: string, encryptionSalt: string): Promise<KeyringControllerMemState>;
513
+ submitEncryptionKey(encryptionKey: string, encryptionSalt: string): Promise<void>;
520
514
  /**
521
515
  * Attempts to decrypt the current vault and load its keyrings,
522
516
  * using the given password.
523
517
  *
524
518
  * @param password - Password to unlock the keychain.
525
- * @returns Promise resolving to the current state.
519
+ * @returns Promise resolving when the operation completes.
526
520
  */
527
- submitPassword(password: string): Promise<KeyringControllerMemState>;
521
+ submitPassword(password: string): Promise<void>;
528
522
  /**
529
523
  * Verifies the that the seed phrase restores the current keychain's accounts.
530
524
  *
@@ -1 +1 @@
1
- {"version":3,"file":"KeyringController.d.ts","sourceRoot":"","sources":["../../src/KeyringController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,IAAI,SAAS,EAC5B,aAAa,IAAI,eAAe,EACjC,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,6BA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QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IA+B3D,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3D,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOvD,cAAc,IAAI,OAAO,CAAC;QAC9B,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAC;KAC7B,CAAC;CAwqBH;AAwBD,eAAe,iBAAiB,CAAC"}
@@ -25,6 +25,8 @@ export declare enum KeyringControllerError {
25
25
  MissingVaultData = "KeyringController - Cannot persist vault without vault information",
26
26
  ExpiredCredentials = "KeyringController - Encryption key and salt provided are expired",
27
27
  NoKeyringBuilder = "KeyringController - No keyringBuilder found for keyring",
28
- DataType = "KeyringController - Incorrect data type provided"
28
+ DataType = "KeyringController - Incorrect data type provided",
29
+ NoHdKeyring = "KeyringController - No HD Keyring found",
30
+ ControllerLockRequired = "KeyringController - attempt to update vault during a non mutually exclusive operation"
29
31
  }
30
32
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAChC,SAAS,yCAAyC;IAClD,iBAAiB,yDAAyD;IAC1E,cAAc,iDAAiD;IAC/D,iBAAiB,4EAA4E;IAC7F,UAAU,gEAAgE;IAC1E,cAAc,qEAAqE;IACnF,8BAA8B,8EAA8E;IAC5G,iCAAiC,gGAAgG;IACjI,wBAAwB,uGAAuG;IAC/H,wBAAwB,uGAAuG;IAC/H,0BAA0B,yGAAyG;IACnI,sBAAsB,qGAAqG;IAC3H,8BAA8B,6GAA6G;IAC3I,iCAAiC,gHAAgH;IACjJ,yBAAyB,wGAAwG;IACjI,2BAA2B,0GAA0G;IACrI,2BAA2B,0GAA0G;IACrI,iCAAiC,gHAAgH;IACjJ,+BAA+B,8GAA8G;IAC7I,6BAA6B,4GAA4G;IACzI,4BAA4B,2GAA2G;IACvI,mBAAmB,4DAA4D;IAC/E,kBAAkB,iFAAiF;IACnG,gBAAgB,uEAAuE;IACvF,kBAAkB,qEAAqE;IACvF,gBAAgB,4DAA4D;IAC5E,QAAQ,qDAAqD;CAC9D"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAChC,SAAS,yCAAyC;IAClD,iBAAiB,yDAAyD;IAC1E,cAAc,iDAAiD;IAC/D,iBAAiB,4EAA4E;IAC7F,UAAU,gEAAgE;IAC1E,cAAc,qEAAqE;IACnF,8BAA8B,8EAA8E;IAC5G,iCAAiC,gGAAgG;IACjI,wBAAwB,uGAAuG;IAC/H,wBAAwB,uGAAuG;IAC/H,0BAA0B,yGAAyG;IACnI,sBAAsB,qGAAqG;IAC3H,8BAA8B,6GAA6G;IAC3I,iCAAiC,gHAAgH;IACjJ,yBAAyB,wGAAwG;IACjI,2BAA2B,0GAA0G;IACrI,2BAA2B,0GAA0G;IACrI,iCAAiC,gHAAgH;IACjJ,+BAA+B,8GAA8G;IAC7I,6BAA6B,4GAA4G;IACzI,4BAA4B,2GAA2G;IACvI,mBAAmB,4DAA4D;IAC/E,kBAAkB,iFAAiF;IACnG,gBAAgB,uEAAuE;IACvF,kBAAkB,qEAAqE;IACvF,gBAAgB,4DAA4D;IAC5E,QAAQ,qDAAqD;IAC7D,WAAW,4CAA4C;IACvD,sBAAsB,0FAA0F;CACjH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/keyring-controller",
3
- "version": "14.0.1-preview-f04be62f",
3
+ "version": "15.0.0-preview-fb52b9eb",
4
4
  "description": "Stores identities seen in the wallet and manages interactions such as signing",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -48,7 +48,7 @@
48
48
  "@metamask/eth-hd-keyring": "^7.0.1",
49
49
  "@metamask/eth-sig-util": "^7.0.1",
50
50
  "@metamask/eth-simple-keyring": "^6.0.1",
51
- "@metamask/keyring-api": "^3.0.0",
51
+ "@metamask/keyring-api": "^6.0.0",
52
52
  "@metamask/message-manager": "^8.0.1",
53
53
  "@metamask/utils": "^8.3.0",
54
54
  "async-mutex": "^0.2.6",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/KeyringController.ts"],"sourcesContent":["import type { TxData, TypedTransaction } from '@ethereumjs/tx';\nimport { isValidPrivate, toBuffer, getBinarySize } from '@ethereumjs/util';\nimport type {\n MetaMaskKeyring as QRKeyring,\n IKeyringState as IQRKeyringState,\n} from '@keystonehq/metamask-airgapped-keyring';\nimport type { RestrictedControllerMessenger } from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport * as encryptorUtils from '@metamask/browser-passworder';\nimport HDKeyring from '@metamask/eth-hd-keyring';\nimport { normalize } from '@metamask/eth-sig-util';\nimport SimpleKeyring from '@metamask/eth-simple-keyring';\nimport type {\n EthBaseTransaction,\n EthBaseUserOperation,\n EthKeyring,\n EthUserOperation,\n EthUserOperationPatch,\n} from '@metamask/keyring-api';\nimport type {\n PersonalMessageParams,\n TypedMessageParams,\n} from '@metamask/message-manager';\nimport type {\n Eip1024EncryptedData,\n Hex,\n Json,\n KeyringClass,\n} from '@metamask/utils';\nimport {\n add0x,\n assertIsStrictHexString,\n bytesToHex,\n hasProperty,\n isObject,\n isValidHexAddress,\n isValidJson,\n remove0x,\n} from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\nimport Wallet, { thirdparty as importers } from 'ethereumjs-wallet';\nimport type { Patch } from 'immer';\n\nimport { KeyringControllerError } from './constants';\n\nconst name = 'KeyringController';\n\n/**\n * Available keyring types\n */\nexport enum KeyringTypes {\n simple = 'Simple Key Pair',\n hd = 'HD Key Tree',\n qr = 'QR Hardware Wallet Device',\n trezor = 'Trezor Hardware',\n ledger = 'Ledger Hardware',\n lattice = 'Lattice Hardware',\n snap = 'Snap Keyring',\n}\n\n/**\n * Custody keyring types are a special case, as they are not a single type\n * but they all start with the prefix \"Custody\".\n * @param keyringType - The type of the keyring.\n * @returns Whether the keyring type is a custody keyring.\n */\nexport const isCustodyKeyring = (keyringType: string): boolean => {\n return keyringType.startsWith('Custody');\n};\n\n/**\n * @type KeyringControllerState\n *\n * Keyring controller state\n * @property vault - Encrypted string representing keyring data\n * @property isUnlocked - Whether vault is unlocked\n * @property keyringTypes - Account types\n * @property keyrings - Group of accounts\n * @property encryptionKey - Keyring encryption key\n * @property encryptionSalt - Keyring encryption salt\n */\nexport type KeyringControllerState = {\n vault?: string;\n isUnlocked: boolean;\n keyrings: KeyringObject[];\n encryptionKey?: string;\n encryptionSalt?: string;\n};\n\nexport type KeyringControllerMemState = Omit<\n KeyringControllerState,\n 'vault' | 'encryptionKey' | 'encryptionSalt'\n>;\n\nexport type KeyringControllerGetStateAction = {\n type: `${typeof name}:getState`;\n handler: () => KeyringControllerState;\n};\n\nexport type KeyringControllerSignMessageAction = {\n type: `${typeof name}:signMessage`;\n handler: KeyringController['signMessage'];\n};\n\nexport type KeyringControllerSignPersonalMessageAction = {\n type: `${typeof name}:signPersonalMessage`;\n handler: KeyringController['signPersonalMessage'];\n};\n\nexport type KeyringControllerSignTypedMessageAction = {\n type: `${typeof name}:signTypedMessage`;\n handler: KeyringController['signTypedMessage'];\n};\n\nexport type KeyringControllerDecryptMessageAction = {\n type: `${typeof name}:decryptMessage`;\n handler: KeyringController['decryptMessage'];\n};\n\nexport type KeyringControllerGetEncryptionPublicKeyAction = {\n type: `${typeof name}:getEncryptionPublicKey`;\n handler: KeyringController['getEncryptionPublicKey'];\n};\n\nexport type KeyringControllerGetKeyringsByTypeAction = {\n type: `${typeof name}:getKeyringsByType`;\n handler: KeyringController['getKeyringsByType'];\n};\n\nexport type KeyringControllerGetKeyringForAccountAction = {\n type: `${typeof name}:getKeyringForAccount`;\n handler: KeyringController['getKeyringForAccount'];\n};\n\nexport type KeyringControllerGetAccountsAction = {\n type: `${typeof name}:getAccounts`;\n handler: KeyringController['getAccounts'];\n};\n\nexport type KeyringControllerPersistAllKeyringsAction = {\n type: `${typeof name}:persistAllKeyrings`;\n handler: KeyringController['persistAllKeyrings'];\n};\n\nexport type KeyringControllerPrepareUserOperationAction = {\n type: `${typeof name}:prepareUserOperation`;\n handler: KeyringController['prepareUserOperation'];\n};\n\nexport type KeyringControllerPatchUserOperationAction = {\n type: `${typeof name}:patchUserOperation`;\n handler: KeyringController['patchUserOperation'];\n};\n\nexport type KeyringControllerSignUserOperationAction = {\n type: `${typeof name}:signUserOperation`;\n handler: KeyringController['signUserOperation'];\n};\n\nexport type KeyringControllerStateChangeEvent = {\n type: `${typeof name}:stateChange`;\n payload: [KeyringControllerState, Patch[]];\n};\n\nexport type KeyringControllerAccountRemovedEvent = {\n type: `${typeof name}:accountRemoved`;\n payload: [string];\n};\n\nexport type KeyringControllerLockEvent = {\n type: `${typeof name}:lock`;\n payload: [];\n};\n\nexport type KeyringControllerUnlockEvent = {\n type: `${typeof name}:unlock`;\n payload: [];\n};\n\nexport type KeyringControllerQRKeyringStateChangeEvent = {\n type: `${typeof name}:qrKeyringStateChange`;\n payload: [ReturnType<IQRKeyringState['getState']>];\n};\n\nexport type KeyringControllerActions =\n | KeyringControllerGetStateAction\n | KeyringControllerSignMessageAction\n | KeyringControllerSignPersonalMessageAction\n | KeyringControllerSignTypedMessageAction\n | KeyringControllerDecryptMessageAction\n | KeyringControllerGetEncryptionPublicKeyAction\n | KeyringControllerGetAccountsAction\n | KeyringControllerGetKeyringsByTypeAction\n | KeyringControllerGetKeyringForAccountAction\n | KeyringControllerPersistAllKeyringsAction\n | KeyringControllerPrepareUserOperationAction\n | KeyringControllerPatchUserOperationAction\n | KeyringControllerSignUserOperationAction;\n\nexport type KeyringControllerEvents =\n | KeyringControllerStateChangeEvent\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent\n | KeyringControllerAccountRemovedEvent\n | KeyringControllerQRKeyringStateChangeEvent;\n\nexport type KeyringControllerMessenger = RestrictedControllerMessenger<\n typeof name,\n KeyringControllerActions,\n KeyringControllerEvents,\n never,\n never\n>;\n\nexport type KeyringControllerOptions = {\n keyringBuilders?: { (): EthKeyring<Json>; type: string }[];\n messenger: KeyringControllerMessenger;\n state?: { vault?: string };\n} & (\n | {\n cacheEncryptionKey: true;\n encryptor?: ExportableKeyEncryptor;\n }\n | {\n cacheEncryptionKey?: false;\n encryptor?: GenericEncryptor | ExportableKeyEncryptor;\n }\n);\n\n/**\n * @type KeyringObject\n *\n * Keyring object to return in fullUpdate\n * @property type - Keyring type\n * @property accounts - Associated accounts\n */\nexport type KeyringObject = {\n accounts: string[];\n type: string;\n};\n\n/**\n * A strategy for importing an account\n */\nexport enum AccountImportStrategy {\n privateKey = 'privateKey',\n json = 'json',\n}\n\n/**\n * The `signTypedMessage` version\n *\n * @see https://docs.metamask.io/guide/signing-data.html\n */\nexport enum SignTypedDataVersion {\n V1 = 'V1',\n V3 = 'V3',\n V4 = 'V4',\n}\n\n/**\n * A serialized keyring object.\n */\nexport type SerializedKeyring = {\n type: string;\n data: Json;\n};\n\n/**\n * A generic encryptor interface that supports encrypting and decrypting\n * serializable data with a password.\n */\nexport type GenericEncryptor = {\n /**\n * Encrypts the given object with the given password.\n *\n * @param password - The password to encrypt with.\n * @param object - The object to encrypt.\n * @returns The encrypted string.\n */\n encrypt: (password: string, object: Json) => Promise<string>;\n /**\n * Decrypts the given encrypted string with the given password.\n *\n * @param password - The password to decrypt with.\n * @param encryptedString - The encrypted string to decrypt.\n * @returns The decrypted object.\n */\n decrypt: (password: string, encryptedString: string) => Promise<unknown>;\n /**\n * Optional vault migration helper. Checks if the provided vault is up to date\n * with the desired encryption algorithm.\n *\n * @param vault - The encrypted string to check.\n * @param targetDerivationParams - The desired target derivation params.\n * @returns The updated encrypted string.\n */\n isVaultUpdated?: (\n vault: string,\n targetDerivationParams?: encryptorUtils.KeyDerivationOptions,\n ) => boolean;\n};\n\n/**\n * An encryptor interface that supports encrypting and decrypting\n * serializable data with a password, and exporting and importing keys.\n */\nexport type ExportableKeyEncryptor = GenericEncryptor & {\n /**\n * Encrypts the given object with the given encryption key.\n *\n * @param key - The encryption key to encrypt with.\n * @param object - The object to encrypt.\n * @returns The encryption result.\n */\n encryptWithKey: (\n key: unknown,\n object: Json,\n ) => Promise<encryptorUtils.EncryptionResult>;\n /**\n * Encrypts the given object with the given password, and returns the\n * encryption result and the exported key string.\n *\n * @param password - The password to encrypt with.\n * @param object - The object to encrypt.\n * @param salt - The optional salt to use for encryption.\n * @returns The encrypted string and the exported key string.\n */\n encryptWithDetail: (\n password: string,\n object: Json,\n salt?: string,\n ) => Promise<encryptorUtils.DetailedEncryptionResult>;\n /**\n * Decrypts the given encrypted string with the given encryption key.\n *\n * @param key - The encryption key to decrypt with.\n * @param encryptedString - The encrypted string to decrypt.\n * @returns The decrypted object.\n */\n decryptWithKey: (key: unknown, encryptedString: string) => Promise<unknown>;\n /**\n * Decrypts the given encrypted string with the given password, and returns\n * the decrypted object and the salt and exported key string used for\n * encryption.\n *\n * @param password - The password to decrypt with.\n * @param encryptedString - The encrypted string to decrypt.\n * @returns The decrypted object and the salt and exported key string used for\n * encryption.\n */\n decryptWithDetail: (\n password: string,\n encryptedString: string,\n ) => Promise<encryptorUtils.DetailedDecryptResult>;\n /**\n * Generates an encryption key from exported key string.\n *\n * @param key - The exported key string.\n * @returns The encryption key.\n */\n importKey: (key: string) => Promise<unknown>;\n};\n\n/**\n * Get builder function for `Keyring`\n *\n * Returns a builder function for `Keyring` with a `type` property.\n *\n * @param KeyringConstructor - The Keyring class for the builder.\n * @returns A builder function for the given Keyring.\n */\nexport function keyringBuilderFactory(KeyringConstructor: KeyringClass<Json>) {\n const builder = () => new KeyringConstructor();\n\n builder.type = KeyringConstructor.type;\n\n return builder;\n}\n\nconst defaultKeyringBuilders = [\n keyringBuilderFactory(SimpleKeyring),\n keyringBuilderFactory(HDKeyring),\n];\n\nexport const getDefaultKeyringState = (): KeyringControllerState => {\n return {\n isUnlocked: false,\n keyrings: [],\n };\n};\n\n/**\n * Assert that the given keyring has an exportable\n * mnemonic.\n *\n * @param keyring - The keyring to check\n * @throws When the keyring does not have a mnemonic\n */\nfunction assertHasUint8ArrayMnemonic(\n keyring: EthKeyring<Json>,\n): asserts keyring is EthKeyring<Json> & { mnemonic: Uint8Array } {\n if (\n !(\n hasProperty(keyring, 'mnemonic') && keyring.mnemonic instanceof Uint8Array\n )\n ) {\n throw new Error(\"Can't get mnemonic bytes from keyring\");\n }\n}\n\n/**\n * Assert that the provided encryptor supports\n * encryption and encryption key export.\n *\n * @param encryptor - The encryptor to check.\n * @throws If the encryptor does not support key encryption.\n */\nfunction assertIsExportableKeyEncryptor(\n encryptor: GenericEncryptor | ExportableKeyEncryptor,\n): asserts encryptor is ExportableKeyEncryptor {\n if (\n !(\n 'importKey' in encryptor &&\n typeof encryptor.importKey === 'function' &&\n 'decryptWithKey' in encryptor &&\n typeof encryptor.decryptWithKey === 'function' &&\n 'encryptWithKey' in encryptor &&\n typeof encryptor.encryptWithKey === 'function'\n )\n ) {\n throw new Error(KeyringControllerError.UnsupportedEncryptionKeyExport);\n }\n}\n\n/**\n * Checks if the provided value is a serialized keyrings array.\n *\n * @param array - The value to check.\n * @returns True if the value is a serialized keyrings array.\n */\nfunction isSerializedKeyringsArray(\n array: unknown,\n): array is SerializedKeyring[] {\n return (\n typeof array === 'object' &&\n Array.isArray(array) &&\n array.every((value) => value.type && isValidJson(value.data))\n );\n}\n\n/**\n * Display For Keyring\n *\n * Is used for adding the current keyrings to the state object.\n *\n * @param keyring - The keyring to display.\n * @returns A keyring display object, with type and accounts properties.\n */\nasync function displayForKeyring(\n keyring: EthKeyring<Json>,\n): Promise<{ type: string; accounts: string[] }> {\n const accounts = await keyring.getAccounts();\n\n return {\n type: keyring.type,\n // Cast to `Hex[]` here is safe here because `accounts` has no nullish\n // values, and `normalize` returns `Hex` unless given a nullish value\n accounts: accounts.map(normalize) as Hex[],\n };\n}\n\n/**\n * Controller responsible for establishing and managing user identity.\n *\n * This class is a wrapper around the `eth-keyring-controller` package. The\n * `eth-keyring-controller` manages the \"vault\", which is an encrypted store of private keys, and\n * it manages the wallet \"lock\" state. This wrapper class has convenience methods for interacting\n * with the internal keyring controller and handling certain complex operations that involve the\n * keyrings.\n */\nexport class KeyringController extends BaseController<\n typeof name,\n KeyringControllerState,\n KeyringControllerMessenger\n> {\n private readonly mutex = new Mutex();\n\n #keyringBuilders: { (): EthKeyring<Json>; type: string }[];\n\n #keyrings: EthKeyring<Json>[];\n\n #unsupportedKeyrings: SerializedKeyring[];\n\n #password?: string;\n\n #encryptor: GenericEncryptor | ExportableKeyEncryptor;\n\n #cacheEncryptionKey: boolean;\n\n #qrKeyringStateListener?: (\n state: ReturnType<IQRKeyringState['getState']>,\n ) => void;\n\n /**\n * Creates a KeyringController instance.\n *\n * @param options - Initial options used to configure this controller\n * @param options.encryptor - An optional object for defining encryption schemes.\n * @param options.keyringBuilders - Set a new name for account.\n * @param options.cacheEncryptionKey - Whether to cache or not encryption key.\n * @param options.messenger - A restricted controller messenger.\n * @param options.state - Initial state to set on this controller.\n */\n constructor(options: KeyringControllerOptions) {\n const {\n encryptor = encryptorUtils,\n keyringBuilders,\n messenger,\n state,\n } = options;\n\n super({\n name,\n metadata: {\n vault: { persist: true, anonymous: false },\n isUnlocked: { persist: false, anonymous: true },\n keyrings: { persist: false, anonymous: false },\n encryptionKey: { persist: false, anonymous: false },\n encryptionSalt: { persist: false, anonymous: false },\n },\n messenger,\n state: {\n ...getDefaultKeyringState(),\n ...state,\n },\n });\n\n this.#keyringBuilders = keyringBuilders\n ? defaultKeyringBuilders.concat(keyringBuilders)\n : defaultKeyringBuilders;\n\n this.#encryptor = encryptor;\n this.#keyrings = [];\n this.#unsupportedKeyrings = [];\n\n // This option allows the controller to cache an exported key\n // for use in decrypting and encrypting data without password\n this.#cacheEncryptionKey = Boolean(options.cacheEncryptionKey);\n if (this.#cacheEncryptionKey) {\n assertIsExportableKeyEncryptor(encryptor);\n }\n\n this.#registerMessageHandlers();\n }\n\n /**\n * Adds a new account to the default (first) HD seed phrase keyring.\n *\n * @param accountCount - Number of accounts before adding a new one, used to\n * make the method idempotent.\n * @returns Promise resolving to keyring current state and added account\n * address.\n */\n async addNewAccount(accountCount?: number): Promise<{\n keyringState: KeyringControllerMemState;\n addedAccountAddress: string;\n }> {\n const primaryKeyring = this.getKeyringsByType('HD Key Tree')[0] as\n | EthKeyring<Json>\n | undefined;\n if (!primaryKeyring) {\n throw new Error('No HD keyring found');\n }\n const oldAccounts = await this.getAccounts();\n\n if (accountCount && oldAccounts.length !== accountCount) {\n if (accountCount > oldAccounts.length) {\n throw new Error('Account out of sequence');\n }\n // we return the account already existing at index `accountCount`\n const primaryKeyringAccounts = await primaryKeyring.getAccounts();\n return {\n keyringState: this.#getMemState(),\n addedAccountAddress: primaryKeyringAccounts[accountCount],\n };\n }\n\n const addedAccountAddress = await this.addNewAccountForKeyring(\n primaryKeyring,\n );\n await this.verifySeedPhrase();\n\n return {\n keyringState: this.#getMemState(),\n addedAccountAddress,\n };\n }\n\n /**\n * Adds a new account to the specified keyring.\n *\n * @param keyring - Keyring to add the account to.\n * @param accountCount - Number of accounts before adding a new one, used to make the method idempotent.\n * @returns Promise resolving to keyring current state and added account\n */\n async addNewAccountForKeyring(\n keyring: EthKeyring<Json>,\n accountCount?: number,\n ): Promise<Hex> {\n const oldAccounts = await this.getAccounts();\n\n if (accountCount && oldAccounts.length !== accountCount) {\n if (accountCount > oldAccounts.length) {\n throw new Error('Account out of sequence');\n }\n\n const existingAccount = oldAccounts[accountCount];\n assertIsStrictHexString(existingAccount);\n\n return existingAccount;\n }\n\n await keyring.addAccounts(1);\n await this.persistAllKeyrings();\n\n const addedAccountAddress = (await this.getAccounts()).find(\n (selectedAddress) => !oldAccounts.includes(selectedAddress),\n );\n assertIsStrictHexString(addedAccountAddress);\n\n return addedAccountAddress;\n }\n\n /**\n * Adds a new account to the default (first) HD seed phrase keyring without updating identities in preferences.\n *\n * @returns Promise resolving to current state when the account is added.\n */\n async addNewAccountWithoutUpdate(): Promise<KeyringControllerMemState> {\n const primaryKeyring = this.getKeyringsByType('HD Key Tree')[0] as\n | EthKeyring<Json>\n | undefined;\n if (!primaryKeyring) {\n throw new Error('No HD keyring found');\n }\n await primaryKeyring.addAccounts(1);\n await this.persistAllKeyrings();\n await this.verifySeedPhrase();\n return this.#getMemState();\n }\n\n /**\n * Effectively the same as creating a new keychain then populating it\n * using the given seed phrase.\n *\n * @param password - Password to unlock keychain.\n * @param seed - A BIP39-compliant seed phrase as Uint8Array,\n * either as a string or an array of UTF-8 bytes that represent the string.\n * @returns Promise resolving to the restored keychain object.\n */\n async createNewVaultAndRestore(\n password: string,\n seed: Uint8Array,\n ): Promise<KeyringControllerMemState> {\n const releaseLock = await this.mutex.acquire();\n if (!password || !password.length) {\n throw new Error('Invalid password');\n }\n\n try {\n await this.#createNewVaultWithKeyring(password, {\n type: KeyringTypes.hd,\n opts: {\n mnemonic: seed,\n numberOfAccounts: 1,\n },\n });\n return this.#getMemState();\n } finally {\n releaseLock();\n }\n }\n\n /**\n * Create a new primary keychain and wipe any previous keychains.\n *\n * @param password - Password to unlock the new vault.\n * @returns Newly-created keychain object.\n */\n async createNewVaultAndKeychain(password: string) {\n const releaseLock = await this.mutex.acquire();\n try {\n const accounts = await this.getAccounts();\n if (!accounts.length) {\n await this.#createNewVaultWithKeyring(password, {\n type: KeyringTypes.hd,\n });\n }\n return this.#getMemState();\n } finally {\n releaseLock();\n }\n }\n\n /**\n * Adds a new keyring of the given `type`.\n *\n * @param type - Keyring type name.\n * @param opts - Keyring options.\n * @throws If a builder for the given `type` does not exist.\n * @returns Promise resolving to the added keyring.\n */\n async addNewKeyring(\n type: KeyringTypes | string,\n opts?: unknown,\n ): Promise<unknown> {\n if (type === KeyringTypes.qr) {\n return this.getOrAddQRKeyring();\n }\n\n const keyring = await this.#newKeyring(type, opts);\n\n if (type === KeyringTypes.hd && (!isObject(opts) || !opts.mnemonic)) {\n if (!keyring.generateRandomMnemonic) {\n throw new Error(\n KeyringControllerError.UnsupportedGenerateRandomMnemonic,\n );\n }\n\n keyring.generateRandomMnemonic();\n await keyring.addAccounts(1);\n }\n\n const accounts = await keyring.getAccounts();\n await this.#checkForDuplicate(type, accounts);\n\n this.#keyrings.push(keyring);\n await this.persistAllKeyrings();\n\n return keyring;\n }\n\n /**\n * Method to verify a given password validity. Throws an\n * error if the password is invalid.\n *\n * @param password - Password of the keyring.\n */\n async verifyPassword(password: string) {\n if (!this.state.vault) {\n throw new Error(KeyringControllerError.VaultError);\n }\n await this.#encryptor.decrypt(password, this.state.vault);\n }\n\n /**\n * Returns the status of the vault.\n *\n * @returns Boolean returning true if the vault is unlocked.\n */\n isUnlocked(): boolean {\n return this.state.isUnlocked;\n }\n\n /**\n * Gets the seed phrase of the HD keyring.\n *\n * @param password - Password of the keyring.\n * @returns Promise resolving to the seed phrase.\n */\n async exportSeedPhrase(password: string): Promise<Uint8Array> {\n await this.verifyPassword(password);\n assertHasUint8ArrayMnemonic(this.#keyrings[0]);\n return this.#keyrings[0].mnemonic;\n }\n\n /**\n * Gets the private key from the keyring controlling an address.\n *\n * @param password - Password of the keyring.\n * @param address - Address to export.\n * @returns Promise resolving to the private key for an address.\n */\n async exportAccount(password: string, address: string): Promise<string> {\n await this.verifyPassword(password);\n\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n if (!keyring.exportAccount) {\n throw new Error(KeyringControllerError.UnsupportedExportAccount);\n }\n\n return await keyring.exportAccount(normalize(address) as Hex);\n }\n\n /**\n * Returns the public addresses of all accounts for the current keyring.\n *\n * @returns A promise resolving to an array of addresses.\n */\n async getAccounts(): Promise<string[]> {\n const keyrings = this.#keyrings;\n\n const keyringArrays = await Promise.all(\n keyrings.map(async (keyring) => keyring.getAccounts()),\n );\n const addresses = keyringArrays.reduce((res, arr) => {\n return res.concat(arr);\n }, []);\n\n // Cast to `Hex[]` here is safe here because `addresses` has no nullish\n // values, and `normalize` returns `Hex` unless given a nullish value\n return addresses.map(normalize) as Hex[];\n }\n\n /**\n * Get encryption public key.\n *\n * @param account - An account address.\n * @param opts - Additional encryption options.\n * @throws If the `account` does not exist or does not support the `getEncryptionPublicKey` method\n * @returns Promise resolving to encyption public key of the `account` if one exists.\n */\n async getEncryptionPublicKey(\n account: string,\n opts?: Record<string, unknown>,\n ): Promise<string> {\n const normalizedAddress = normalize(account) as Hex;\n const keyring = (await this.getKeyringForAccount(\n account,\n )) as EthKeyring<Json>;\n if (!keyring.getEncryptionPublicKey) {\n throw new Error(KeyringControllerError.UnsupportedGetEncryptionPublicKey);\n }\n\n return await keyring.getEncryptionPublicKey(normalizedAddress, opts);\n }\n\n /**\n * Attempts to decrypt the provided message parameters.\n *\n * @param messageParams - The decryption message parameters.\n * @param messageParams.from - The address of the account you want to use to decrypt the message.\n * @param messageParams.data - The encrypted data that you want to decrypt.\n * @returns The raw decryption result.\n */\n async decryptMessage(messageParams: {\n from: string;\n data: Eip1024EncryptedData;\n }): Promise<string> {\n const address = normalize(messageParams.from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n if (!keyring.decryptMessage) {\n throw new Error(KeyringControllerError.UnsupportedDecryptMessage);\n }\n\n return keyring.decryptMessage(address, messageParams.data);\n }\n\n /**\n * Returns the currently initialized keyring that manages\n * the specified `address` if one exists.\n *\n * @deprecated Use of this method is discouraged as actions executed directly on\n * keyrings are not being reflected in the KeyringController state and not\n * persisted in the vault.\n * @param account - An account address.\n * @returns Promise resolving to keyring of the `account` if one exists.\n */\n async getKeyringForAccount(account: string): Promise<unknown> {\n // Cast to `Hex` here is safe here because `address` is not nullish.\n // `normalizeToHex` returns `Hex` unless given a nullish value.\n const hexed = normalize(account) as Hex;\n\n const candidates = await Promise.all(\n this.#keyrings.map(async (keyring) => {\n return Promise.all([keyring, keyring.getAccounts()]);\n }),\n );\n\n const winners = candidates.filter((candidate) => {\n const accounts = candidate[1].map(normalize);\n return accounts.includes(hexed);\n });\n\n if (winners.length && winners[0]?.length) {\n return winners[0][0];\n }\n\n // Adding more info to the error\n let errorInfo = '';\n if (!isValidHexAddress(hexed)) {\n errorInfo = 'The address passed in is invalid/empty';\n } else if (!candidates.length) {\n errorInfo = 'There are no keyrings';\n } else if (!winners.length) {\n errorInfo = 'There are keyrings, but none match the address';\n }\n throw new Error(\n `${KeyringControllerError.NoKeyring}. Error info: ${errorInfo}`,\n );\n }\n\n /**\n * Returns all keyrings of the given type.\n *\n * @deprecated Use of this method is discouraged as actions executed directly on\n * keyrings are not being reflected in the KeyringController state and not\n * persisted in the vault.\n * @param type - Keyring type name.\n * @returns An array of keyrings of the given type.\n */\n getKeyringsByType(type: KeyringTypes | string): unknown[] {\n return this.#keyrings.filter((keyring) => keyring.type === type);\n }\n\n /**\n * Persist all serialized keyrings in the vault.\n *\n * @returns Promise resolving with `true` value when the\n * operation completes.\n */\n async persistAllKeyrings(): Promise<boolean> {\n const { encryptionKey, encryptionSalt } = this.state;\n\n if (!this.#password && !encryptionKey) {\n throw new Error(KeyringControllerError.MissingCredentials);\n }\n\n const serializedKeyrings = await Promise.all(\n this.#keyrings.map(async (keyring) => {\n const [type, data] = await Promise.all([\n keyring.type,\n keyring.serialize(),\n ]);\n return { type, data };\n }),\n );\n\n serializedKeyrings.push(...this.#unsupportedKeyrings);\n\n let vault: string | undefined;\n let newEncryptionKey: string | undefined;\n\n if (this.#cacheEncryptionKey) {\n assertIsExportableKeyEncryptor(this.#encryptor);\n\n if (encryptionKey) {\n const key = await this.#encryptor.importKey(encryptionKey);\n const vaultJSON = await this.#encryptor.encryptWithKey(\n key,\n serializedKeyrings,\n );\n vaultJSON.salt = encryptionSalt;\n vault = JSON.stringify(vaultJSON);\n } else if (this.#password) {\n const { vault: newVault, exportedKeyString } =\n await this.#encryptor.encryptWithDetail(\n this.#password,\n serializedKeyrings,\n );\n\n vault = newVault;\n newEncryptionKey = exportedKeyString;\n }\n } else {\n if (typeof this.#password !== 'string') {\n throw new TypeError(KeyringControllerError.WrongPasswordType);\n }\n vault = await this.#encryptor.encrypt(this.#password, serializedKeyrings);\n }\n\n if (!vault) {\n throw new Error(KeyringControllerError.MissingVaultData);\n }\n\n this.update((state) => {\n state.vault = vault;\n });\n\n // The keyring updates need to be announced before updating the encryptionKey\n // so that the updated keyring gets propagated to the extension first.\n // Not calling {@link updateKeyringsInState} results in the wrong account being selected\n // in the extension.\n await this.#updateKeyringsInState();\n if (newEncryptionKey) {\n this.update((state) => {\n state.encryptionKey = newEncryptionKey;\n state.encryptionSalt = JSON.parse(vault as string).salt;\n });\n }\n\n return true;\n }\n\n /**\n * Imports an account with the specified import strategy.\n *\n * @param strategy - Import strategy name.\n * @param args - Array of arguments to pass to the underlying stategy.\n * @throws Will throw when passed an unrecognized strategy.\n * @returns Promise resolving to keyring current state and imported account\n * address.\n */\n async importAccountWithStrategy(\n strategy: AccountImportStrategy,\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any[],\n ): Promise<{\n keyringState: KeyringControllerMemState;\n importedAccountAddress: string;\n }> {\n let privateKey;\n switch (strategy) {\n case 'privateKey':\n const [importedKey] = args;\n if (!importedKey) {\n throw new Error('Cannot import an empty key.');\n }\n const prefixed = add0x(importedKey);\n\n let bufferedPrivateKey;\n try {\n bufferedPrivateKey = toBuffer(prefixed);\n } catch {\n throw new Error('Cannot import invalid private key.');\n }\n\n if (\n !isValidPrivate(bufferedPrivateKey) ||\n // ensures that the key is 64 bytes long\n getBinarySize(prefixed) !== 64 + '0x'.length\n ) {\n throw new Error('Cannot import invalid private key.');\n }\n\n privateKey = remove0x(prefixed);\n break;\n case 'json':\n let wallet;\n const [input, password] = args;\n try {\n wallet = importers.fromEtherWallet(input, password);\n } catch (e) {\n wallet = wallet || (await Wallet.fromV3(input, password, true));\n }\n privateKey = bytesToHex(wallet.getPrivateKey());\n break;\n default:\n throw new Error(`Unexpected import strategy: '${strategy}'`);\n }\n const newKeyring = (await this.addNewKeyring(KeyringTypes.simple, [\n privateKey,\n ])) as EthKeyring<Json>;\n const accounts = await newKeyring.getAccounts();\n return {\n keyringState: this.#getMemState(),\n importedAccountAddress: accounts[0],\n };\n }\n\n /**\n * Removes an account from keyring state.\n *\n * @param address - Address of the account to remove.\n * @fires KeyringController:accountRemoved\n * @returns Promise resolving current state when this account removal completes.\n */\n async removeAccount(address: Hex): Promise<KeyringControllerMemState> {\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n\n // Not all the keyrings support this, so we have to check\n if (!keyring.removeAccount) {\n throw new Error(KeyringControllerError.UnsupportedRemoveAccount);\n }\n\n // The `removeAccount` method of snaps keyring is async. We have to update\n // the interface of the other keyrings to be async as well.\n // eslint-disable-next-line @typescript-eslint/await-thenable\n await keyring.removeAccount(address);\n\n const accounts = await keyring.getAccounts();\n // Check if this was the last/only account\n if (accounts.length === 0) {\n await this.#removeEmptyKeyrings();\n }\n\n await this.persistAllKeyrings();\n\n this.messagingSystem.publish(`${name}:accountRemoved`, address);\n return this.#getMemState();\n }\n\n /**\n * Deallocates all secrets and locks the wallet.\n *\n * @returns Promise resolving to current state.\n */\n async setLocked(): Promise<KeyringControllerMemState> {\n this.#unsubscribeFromQRKeyringsEvents();\n\n this.#password = undefined;\n this.update((state) => {\n state.isUnlocked = false;\n state.keyrings = [];\n });\n await this.#clearKeyrings();\n\n this.messagingSystem.publish(`${name}:lock`);\n\n return this.#getMemState();\n }\n\n /**\n * Signs message by calling down into a specific keyring.\n *\n * @param messageParams - PersonalMessageParams object to sign.\n * @returns Promise resolving to a signed message string.\n */\n async signMessage(messageParams: PersonalMessageParams): Promise<string> {\n if (!messageParams.data) {\n throw new Error(\"Can't sign an empty message\");\n }\n\n const address = normalize(messageParams.from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n if (!keyring.signMessage) {\n throw new Error(KeyringControllerError.UnsupportedSignMessage);\n }\n\n return await keyring.signMessage(address, messageParams.data);\n }\n\n /**\n * Signs personal message by calling down into a specific keyring.\n *\n * @param messageParams - PersonalMessageParams object to sign.\n * @returns Promise resolving to a signed message string.\n */\n async signPersonalMessage(messageParams: PersonalMessageParams) {\n const address = normalize(messageParams.from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n if (!keyring.signPersonalMessage) {\n throw new Error(KeyringControllerError.UnsupportedSignPersonalMessage);\n }\n\n const normalizedData = normalize(messageParams.data) as Hex;\n\n return await keyring.signPersonalMessage(address, normalizedData);\n }\n\n /**\n * Signs typed message by calling down into a specific keyring.\n *\n * @param messageParams - TypedMessageParams object to sign.\n * @param version - Compatibility version EIP712.\n * @throws Will throw when passed an unrecognized version.\n * @returns Promise resolving to a signed message string or an error if any.\n */\n async signTypedMessage(\n messageParams: TypedMessageParams,\n version: SignTypedDataVersion,\n ): Promise<string> {\n try {\n if (\n ![\n SignTypedDataVersion.V1,\n SignTypedDataVersion.V3,\n SignTypedDataVersion.V4,\n ].includes(version)\n ) {\n throw new Error(`Unexpected signTypedMessage version: '${version}'`);\n }\n\n // Cast to `Hex` here is safe here because `messageParams.from` is not nullish.\n // `normalize` returns `Hex` unless given a nullish value.\n const address = normalize(messageParams.from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n if (!keyring.signTypedData) {\n throw new Error(KeyringControllerError.UnsupportedSignTypedMessage);\n }\n\n return await keyring.signTypedData(\n address,\n version !== SignTypedDataVersion.V1 &&\n typeof messageParams.data === 'string'\n ? JSON.parse(messageParams.data)\n : messageParams.data,\n { version },\n );\n } catch (error) {\n throw new Error(`Keyring Controller signTypedMessage: ${error}`);\n }\n }\n\n /**\n * Signs a transaction by calling down into a specific keyring.\n *\n * @param transaction - Transaction object to sign. Must be a `ethereumjs-tx` transaction instance.\n * @param from - Address to sign from, should be in keychain.\n * @param opts - An optional options object.\n * @returns Promise resolving to a signed transaction string.\n */\n async signTransaction(\n transaction: TypedTransaction,\n from: string,\n opts?: Record<string, unknown>,\n ): Promise<TxData> {\n const address = normalize(from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n if (!keyring.signTransaction) {\n throw new Error(KeyringControllerError.UnsupportedSignTransaction);\n }\n\n return await keyring.signTransaction(address, transaction, opts);\n }\n\n /**\n * Convert a base transaction to a base UserOperation.\n *\n * @param from - Address of the sender.\n * @param transactions - Base transactions to include in the UserOperation.\n * @returns A pseudo-UserOperation that can be used to construct a real.\n */\n async prepareUserOperation(\n from: string,\n transactions: EthBaseTransaction[],\n ): Promise<EthBaseUserOperation> {\n const address = normalize(from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n\n if (!keyring.prepareUserOperation) {\n throw new Error(KeyringControllerError.UnsupportedPrepareUserOperation);\n }\n\n return await keyring.prepareUserOperation(address, transactions);\n }\n\n /**\n * Patches properties of a UserOperation. Currently, only the\n * `paymasterAndData` can be patched.\n *\n * @param from - Address of the sender.\n * @param userOp - UserOperation to patch.\n * @returns A patch to apply to the UserOperation.\n */\n async patchUserOperation(\n from: string,\n userOp: EthUserOperation,\n ): Promise<EthUserOperationPatch> {\n const address = normalize(from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n\n if (!keyring.patchUserOperation) {\n throw new Error(KeyringControllerError.UnsupportedPatchUserOperation);\n }\n\n return await keyring.patchUserOperation(address, userOp);\n }\n\n /**\n * Signs an UserOperation.\n *\n * @param from - Address of the sender.\n * @param userOp - UserOperation to sign.\n * @returns The signature of the UserOperation.\n */\n async signUserOperation(\n from: string,\n userOp: EthUserOperation,\n ): Promise<string> {\n const address = normalize(from) as Hex;\n const keyring = (await this.getKeyringForAccount(\n address,\n )) as EthKeyring<Json>;\n\n if (!keyring.signUserOperation) {\n throw new Error(KeyringControllerError.UnsupportedSignUserOperation);\n }\n\n return await keyring.signUserOperation(address, userOp);\n }\n\n /**\n * Attempts to decrypt the current vault and load its keyrings,\n * using the given encryption key and salt.\n *\n * @param encryptionKey - Key to unlock the keychain.\n * @param encryptionSalt - Salt to unlock the keychain.\n * @returns Promise resolving to the current state.\n */\n async submitEncryptionKey(\n encryptionKey: string,\n encryptionSalt: string,\n ): Promise<KeyringControllerMemState> {\n this.#keyrings = await this.#unlockKeyrings(\n undefined,\n encryptionKey,\n encryptionSalt,\n );\n this.#setUnlocked();\n\n const qrKeyring = this.getQRKeyring();\n if (qrKeyring) {\n // if there is a QR keyring, we need to subscribe\n // to its events after unlocking the vault\n this.#subscribeToQRKeyringEvents(qrKeyring);\n }\n\n return this.#getMemState();\n }\n\n /**\n * Attempts to decrypt the current vault and load its keyrings,\n * using the given password.\n *\n * @param password - Password to unlock the keychain.\n * @returns Promise resolving to the current state.\n */\n async submitPassword(password: string): Promise<KeyringControllerMemState> {\n this.#keyrings = await this.#unlockKeyrings(password);\n this.#setUnlocked();\n\n const qrKeyring = this.getQRKeyring();\n if (qrKeyring) {\n // if there is a QR keyring, we need to subscribe\n // to its events after unlocking the vault\n this.#subscribeToQRKeyringEvents(qrKeyring);\n }\n\n return this.#getMemState();\n }\n\n /**\n * Verifies the that the seed phrase restores the current keychain's accounts.\n *\n * @returns Promise resolving to the seed phrase as Uint8Array.\n */\n async verifySeedPhrase(): Promise<Uint8Array> {\n const primaryKeyring = this.getKeyringsByType(KeyringTypes.hd)[0] as\n | EthKeyring<Json>\n | undefined;\n if (!primaryKeyring) {\n throw new Error('No HD keyring found.');\n }\n\n assertHasUint8ArrayMnemonic(primaryKeyring);\n\n const seedWords = primaryKeyring.mnemonic;\n const accounts = await primaryKeyring.getAccounts();\n /* istanbul ignore if */\n if (accounts.length === 0) {\n throw new Error('Cannot verify an empty keyring.');\n }\n\n // The HD Keyring Builder is a default keyring builder\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const hdKeyringBuilder = this.#getKeyringBuilderForType(KeyringTypes.hd)!;\n\n const hdKeyring = hdKeyringBuilder();\n // @ts-expect-error @metamask/eth-hd-keyring correctly handles\n // Uint8Array seed phrases in the `deserialize` method.\n await hdKeyring.deserialize({\n mnemonic: seedWords,\n numberOfAccounts: accounts.length,\n });\n const testAccounts = await hdKeyring.getAccounts();\n /* istanbul ignore if */\n if (testAccounts.length !== accounts.length) {\n throw new Error('Seed phrase imported incorrect number of accounts.');\n }\n\n testAccounts.forEach((account: string, i: number) => {\n /* istanbul ignore if */\n if (account.toLowerCase() !== accounts[i].toLowerCase()) {\n throw new Error('Seed phrase imported different accounts.');\n }\n });\n\n return seedWords;\n }\n\n // QR Hardware related methods\n\n /**\n * Get QR Hardware keyring.\n *\n * @returns The QR Keyring if defined, otherwise undefined\n */\n getQRKeyring(): QRKeyring | undefined {\n // QRKeyring is not yet compatible with Keyring type from @metamask/utils\n return this.getKeyringsByType(KeyringTypes.qr)[0] as unknown as QRKeyring;\n }\n\n /**\n * Get QR hardware keyring. If it doesn't exist, add it.\n *\n * @returns The added keyring\n */\n async getOrAddQRKeyring(): Promise<QRKeyring> {\n return this.getQRKeyring() || (await this.#addQRKeyring());\n }\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async restoreQRKeyring(serialized: any): Promise<void> {\n (await this.getOrAddQRKeyring()).deserialize(serialized);\n await this.persistAllKeyrings();\n }\n\n async resetQRKeyringState(): Promise<void> {\n (await this.getOrAddQRKeyring()).resetStore();\n }\n\n async getQRKeyringState(): Promise<IQRKeyringState> {\n return (await this.getOrAddQRKeyring()).getMemStore();\n }\n\n async submitQRCryptoHDKey(cryptoHDKey: string): Promise<void> {\n (await this.getOrAddQRKeyring()).submitCryptoHDKey(cryptoHDKey);\n }\n\n async submitQRCryptoAccount(cryptoAccount: string): Promise<void> {\n (await this.getOrAddQRKeyring()).submitCryptoAccount(cryptoAccount);\n }\n\n async submitQRSignature(\n requestId: string,\n ethSignature: string,\n ): Promise<void> {\n (await this.getOrAddQRKeyring()).submitSignature(requestId, ethSignature);\n }\n\n async cancelQRSignRequest(): Promise<void> {\n (await this.getOrAddQRKeyring()).cancelSignRequest();\n }\n\n /**\n * Cancels qr keyring sync.\n */\n async cancelQRSynchronization(): Promise<void> {\n // eslint-disable-next-line n/no-sync\n (await this.getOrAddQRKeyring()).cancelSync();\n }\n\n async connectQRHardware(\n page: number,\n ): Promise<{ balance: string; address: string; index: number }[]> {\n try {\n const keyring = await this.getOrAddQRKeyring();\n let accounts;\n switch (page) {\n case -1:\n accounts = await keyring.getPreviousPage();\n break;\n case 1:\n accounts = await keyring.getNextPage();\n break;\n default:\n accounts = await keyring.getFirstPage();\n }\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return accounts.map((account: any) => {\n return {\n ...account,\n balance: '0x0',\n };\n });\n } catch (e) {\n // TODO: Add test case for when keyring throws\n /* istanbul ignore next */\n throw new Error(`Unspecified error when connect QR Hardware, ${e}`);\n }\n }\n\n async unlockQRHardwareWalletAccount(index: number): Promise<void> {\n const keyring = await this.getOrAddQRKeyring();\n\n keyring.setAccountToUnlock(index);\n // QRKeyring is not yet compatible with Keyring from\n // @metamask/utils, but we can use the `addNewAccount` method\n // as it internally calls `addAccounts` from on the keyring instance,\n // which is supported by QRKeyring API.\n await this.addNewAccountForKeyring(keyring as unknown as EthKeyring<Json>);\n await this.persistAllKeyrings();\n }\n\n async getAccountKeyringType(account: string): Promise<string> {\n const keyring = (await this.getKeyringForAccount(\n account,\n )) as EthKeyring<Json>;\n return keyring.type;\n }\n\n async forgetQRDevice(): Promise<{\n removedAccounts: string[];\n remainingAccounts: string[];\n }> {\n const keyring = await this.getOrAddQRKeyring();\n const allAccounts = (await this.getAccounts()) as string[];\n keyring.forgetDevice();\n const remainingAccounts = (await this.getAccounts()) as string[];\n const removedAccounts = allAccounts.filter(\n (address: string) => !remainingAccounts.includes(address),\n );\n await this.persistAllKeyrings();\n return { removedAccounts, remainingAccounts };\n }\n\n /**\n * Constructor helper for registering this controller's messaging system\n * actions.\n */\n #registerMessageHandlers() {\n this.messagingSystem.registerActionHandler(\n `${name}:signMessage`,\n this.signMessage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:signPersonalMessage`,\n this.signPersonalMessage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:signTypedMessage`,\n this.signTypedMessage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:decryptMessage`,\n this.decryptMessage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:getEncryptionPublicKey`,\n this.getEncryptionPublicKey.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:getAccounts`,\n this.getAccounts.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:getKeyringsByType`,\n this.getKeyringsByType.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:getKeyringForAccount`,\n this.getKeyringForAccount.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:persistAllKeyrings`,\n this.persistAllKeyrings.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:prepareUserOperation`,\n this.prepareUserOperation.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:patchUserOperation`,\n this.patchUserOperation.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n `${name}:signUserOperation`,\n this.signUserOperation.bind(this),\n );\n }\n\n /**\n * Get the keyring builder for the given `type`.\n *\n * @param type - The type of keyring to get the builder for.\n * @returns The keyring builder, or undefined if none exists.\n */\n #getKeyringBuilderForType(\n type: string,\n ): { (): EthKeyring<Json>; type: string } | undefined {\n return this.#keyringBuilders.find(\n (keyringBuilder) => keyringBuilder.type === type,\n );\n }\n\n /**\n * Add qr hardware keyring.\n *\n * @returns The added keyring\n * @throws If a QRKeyring builder is not provided\n * when initializing the controller\n */\n async #addQRKeyring(): Promise<QRKeyring> {\n // QRKeyring is not yet compatible with Keyring type from @metamask/utils\n const qrKeyring = (await this.#newKeyring(KeyringTypes.qr, {\n accounts: [],\n })) as unknown as QRKeyring;\n\n const accounts = await qrKeyring.getAccounts();\n await this.#checkForDuplicate(KeyringTypes.qr, accounts);\n\n this.#keyrings.push(qrKeyring as unknown as EthKeyring<Json>);\n await this.persistAllKeyrings();\n\n this.#subscribeToQRKeyringEvents(qrKeyring);\n\n return qrKeyring;\n }\n\n /**\n * Subscribe to a QRKeyring state change events and\n * forward them through the messaging system.\n *\n * @param qrKeyring - The QRKeyring instance to subscribe to\n */\n #subscribeToQRKeyringEvents(qrKeyring: QRKeyring) {\n this.#qrKeyringStateListener = (state) => {\n this.messagingSystem.publish(`${name}:qrKeyringStateChange`, state);\n };\n\n qrKeyring.getMemStore().subscribe(this.#qrKeyringStateListener);\n }\n\n #unsubscribeFromQRKeyringsEvents() {\n const qrKeyrings = this.getKeyringsByType(\n KeyringTypes.qr,\n ) as unknown as QRKeyring[];\n\n qrKeyrings.forEach((qrKeyring) => {\n if (this.#qrKeyringStateListener) {\n qrKeyring.getMemStore().unsubscribe(this.#qrKeyringStateListener);\n }\n });\n }\n\n /**\n * Create new vault with an initial keyring\n *\n * Destroys any old encrypted storage,\n * creates a new encrypted store with the given password,\n * creates a new wallet with 1 account.\n *\n * @fires KeyringController:unlock\n * @param password - The password to encrypt the vault with.\n * @param keyring - A object containing the params to instantiate a new keyring.\n * @param keyring.type - The keyring type.\n * @param keyring.opts - Optional parameters required to instantiate the keyring.\n * @returns A promise that resolves to the state.\n */\n async #createNewVaultWithKeyring(\n password: string,\n keyring: {\n type: string;\n opts?: unknown;\n },\n ): Promise<KeyringControllerMemState> {\n if (typeof password !== 'string') {\n throw new TypeError(KeyringControllerError.WrongPasswordType);\n }\n this.#password = password;\n\n await this.#clearKeyrings();\n await this.#createKeyringWithFirstAccount(keyring.type, keyring.opts);\n this.#setUnlocked();\n return this.#getMemState();\n }\n\n /**\n * Update the controller state with its current keyrings.\n */\n async #updateKeyringsInState(): Promise<void> {\n const keyrings = await Promise.all(this.#keyrings.map(displayForKeyring));\n this.update((state) => {\n state.keyrings = keyrings;\n });\n }\n\n /**\n * Unlock Keyrings, decrypting the vault and deserializing all\n * keyrings contained in it, using a password or an encryption key with salt.\n *\n * @param password - The keyring controller password.\n * @param encryptionKey - An exported key string to unlock keyrings with.\n * @param encryptionSalt - The salt used to encrypt the vault.\n * @returns A promise resolving to the deserialized keyrings array.\n */\n async #unlockKeyrings(\n password: string | undefined,\n encryptionKey?: string,\n encryptionSalt?: string,\n ): Promise<EthKeyring<Json>[]> {\n const encryptedVault = this.state.vault;\n if (!encryptedVault) {\n throw new Error(KeyringControllerError.VaultError);\n }\n\n await this.#clearKeyrings();\n\n let vault;\n\n if (this.#cacheEncryptionKey) {\n assertIsExportableKeyEncryptor(this.#encryptor);\n\n if (password) {\n const result = await this.#encryptor.decryptWithDetail(\n password,\n encryptedVault,\n );\n vault = result.vault;\n this.#password = password;\n\n this.update((state) => {\n state.encryptionKey = result.exportedKeyString;\n state.encryptionSalt = result.salt;\n });\n } else {\n const parsedEncryptedVault = JSON.parse(encryptedVault);\n\n if (encryptionSalt !== parsedEncryptedVault.salt) {\n throw new Error(KeyringControllerError.ExpiredCredentials);\n }\n\n if (typeof encryptionKey !== 'string') {\n throw new TypeError(KeyringControllerError.WrongPasswordType);\n }\n\n const key = await this.#encryptor.importKey(encryptionKey);\n vault = await this.#encryptor.decryptWithKey(key, parsedEncryptedVault);\n\n // This call is required on the first call because encryptionKey\n // is not yet inside the memStore\n this.update((state) => {\n state.encryptionKey = encryptionKey;\n // we can safely assume that encryptionSalt is defined here\n // because we compare it with the salt from the vault\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n state.encryptionSalt = encryptionSalt!;\n });\n }\n } else {\n if (typeof password !== 'string') {\n throw new TypeError(KeyringControllerError.WrongPasswordType);\n }\n\n vault = await this.#encryptor.decrypt(password, encryptedVault);\n this.#password = password;\n }\n\n if (!isSerializedKeyringsArray(vault)) {\n throw new Error(KeyringControllerError.VaultDataError);\n }\n\n await Promise.all(vault.map(this.#restoreKeyring.bind(this)));\n await this.#updateKeyringsInState();\n\n if (\n this.#password &&\n (!this.#cacheEncryptionKey || !encryptionKey) &&\n this.#encryptor.isVaultUpdated &&\n !this.#encryptor.isVaultUpdated(encryptedVault)\n ) {\n // Re-encrypt the vault with safer method if one is available\n await this.persistAllKeyrings();\n }\n\n return this.#keyrings;\n }\n\n /**\n * Create a new keyring, ensuring that the first account is\n * also created.\n *\n * @param type - Keyring type to instantiate.\n * @param opts - Optional parameters required to instantiate the keyring.\n * @returns A promise that resolves if the operation is successful.\n */\n async #createKeyringWithFirstAccount(type: string, opts?: unknown) {\n const keyring = (await this.addNewKeyring(type, opts)) as EthKeyring<Json>;\n\n const [firstAccount] = await keyring.getAccounts();\n if (!firstAccount) {\n throw new Error(KeyringControllerError.NoFirstAccount);\n }\n }\n\n /**\n * Instantiate, initialize and return a new keyring of the given `type`,\n * using the given `opts`. The keyring is built using the keyring builder\n * registered for the given `type`.\n *\n * @param type - The type of keyring to add.\n * @param data - The data to restore a previously serialized keyring.\n * @returns The new keyring.\n */\n async #newKeyring(type: string, data: unknown): Promise<EthKeyring<Json>> {\n const keyringBuilder = this.#getKeyringBuilderForType(type);\n\n if (!keyringBuilder) {\n throw new Error(\n `${KeyringControllerError.NoKeyringBuilder}. Keyring type: ${type}`,\n );\n }\n\n const keyring = keyringBuilder();\n\n // @ts-expect-error Enforce data type after updating clients\n await keyring.deserialize(data);\n\n if (keyring.init) {\n await keyring.init();\n }\n\n return keyring;\n }\n\n /**\n * Remove all managed keyrings, destroying all their\n * instances in memory.\n */\n async #clearKeyrings() {\n for (const keyring of this.#keyrings) {\n await this.#destroyKeyring(keyring);\n }\n this.#keyrings = [];\n this.update((state) => {\n state.keyrings = [];\n });\n }\n\n /**\n * Restore a Keyring from a provided serialized payload.\n * On success, returns the resulting keyring instance.\n *\n * @param serialized - The serialized keyring.\n * @returns The deserialized keyring or undefined if the keyring type is unsupported.\n */\n async #restoreKeyring(\n serialized: SerializedKeyring,\n ): Promise<EthKeyring<Json> | undefined> {\n try {\n const { type, data } = serialized;\n const keyring = await this.#newKeyring(type, data);\n\n // getAccounts also validates the accounts for some keyrings\n await keyring.getAccounts();\n this.#keyrings.push(keyring);\n\n return keyring;\n } catch (_) {\n this.#unsupportedKeyrings.push(serialized);\n return undefined;\n }\n }\n\n /**\n * Destroy Keyring\n *\n * Some keyrings support a method called `destroy`, that destroys the\n * keyring along with removing all its event listeners and, in some cases,\n * clears the keyring bridge iframe from the DOM.\n *\n * @param keyring - The keyring to destroy.\n */\n async #destroyKeyring(keyring: EthKeyring<Json>) {\n await keyring.destroy?.();\n }\n\n /**\n * Remove empty keyrings.\n *\n * Loops through the keyrings and removes the ones with empty accounts\n * (usually after removing the last / only account) from a keyring.\n */\n async #removeEmptyKeyrings(): Promise<void> {\n const validKeyrings: EthKeyring<Json>[] = [];\n\n // Since getAccounts returns a Promise\n // We need to wait to hear back form each keyring\n // in order to decide which ones are now valid (accounts.length > 0)\n\n await Promise.all(\n this.#keyrings.map(async (keyring: EthKeyring<Json>) => {\n const accounts = await keyring.getAccounts();\n if (accounts.length > 0) {\n validKeyrings.push(keyring);\n } else {\n await this.#destroyKeyring(keyring);\n }\n }),\n );\n this.#keyrings = validKeyrings;\n }\n\n /**\n * Checks for duplicate keypairs, using the the first account in the given\n * array. Rejects if a duplicate is found.\n *\n * Only supports 'Simple Key Pair'.\n *\n * @param type - The key pair type to check for.\n * @param newAccountArray - Array of new accounts.\n * @returns The account, if no duplicate is found.\n */\n async #checkForDuplicate(\n type: string,\n newAccountArray: string[],\n ): Promise<string[]> {\n const accounts = await this.getAccounts();\n\n switch (type) {\n case KeyringTypes.simple: {\n const isIncluded = Boolean(\n accounts.find(\n (key) =>\n newAccountArray[0] &&\n (key === newAccountArray[0] ||\n key === remove0x(newAccountArray[0])),\n ),\n );\n\n if (isIncluded) {\n throw new Error(KeyringControllerError.DuplicatedAccount);\n }\n return newAccountArray;\n }\n\n default: {\n return newAccountArray;\n }\n }\n }\n\n /**\n * Set the `isUnlocked` to true and notify listeners\n * through the messenger.\n *\n * @fires KeyringController:unlock\n */\n #setUnlocked(): void {\n this.update((state) => {\n state.isUnlocked = true;\n });\n this.messagingSystem.publish(`${name}:unlock`);\n }\n\n #getMemState(): KeyringControllerMemState {\n return {\n isUnlocked: this.state.isUnlocked,\n keyrings: this.state.keyrings,\n };\n }\n}\n\nexport default KeyringController;\n"],"mappings":";;;;;;;;AACA,SAAS,gBAAgB,UAAU,qBAAqB;AAMxD,SAAS,sBAAsB;AAC/B,YAAY,oBAAoB;AAChC,OAAO,eAAe;AACtB,SAAS,iBAAiB;AAC1B,OAAO,mBAAmB;AAkB1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,OAAO,UAAU,cAAc,iBAAiB;AAKhD,IAAM,OAAO;AAKN,IAAK,eAAL,kBAAKA,kBAAL;AACL,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,QAAK;AACL,EAAAA,cAAA,QAAK;AACL,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,UAAO;AAPG,SAAAA;AAAA,GAAA;AAgBL,IAAM,mBAAmB,CAAC,gBAAiC;AAChE,SAAO,YAAY,WAAW,SAAS;AACzC;AAgLO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,gBAAa;AACb,EAAAA,uBAAA,UAAO;AAFG,SAAAA;AAAA,GAAA;AAUL,IAAK,uBAAL,kBAAKC,0BAAL;AACL,EAAAA,sBAAA,QAAK;AACL,EAAAA,sBAAA,QAAK;AACL,EAAAA,sBAAA,QAAK;AAHK,SAAAA;AAAA,GAAA;AAsHL,SAAS,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