@metamask-previews/profile-sync-controller 15.0.0-preview-e7141654 → 15.0.0-preview-ae04854

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +0 -4
  2. package/dist/controllers/user-storage/UserStorageController.cjs +3 -68
  3. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
  4. package/dist/controllers/user-storage/UserStorageController.d.cts +2 -40
  5. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
  6. package/dist/controllers/user-storage/UserStorageController.d.mts +2 -40
  7. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
  8. package/dist/controllers/user-storage/UserStorageController.mjs +0 -65
  9. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
  10. package/dist/controllers/user-storage/constants.cjs +0 -1
  11. package/dist/controllers/user-storage/constants.cjs.map +1 -1
  12. package/dist/controllers/user-storage/constants.d.cts +0 -1
  13. package/dist/controllers/user-storage/constants.d.cts.map +1 -1
  14. package/dist/controllers/user-storage/constants.d.mts +0 -1
  15. package/dist/controllers/user-storage/constants.d.mts.map +1 -1
  16. package/dist/controllers/user-storage/constants.mjs +0 -1
  17. package/dist/controllers/user-storage/constants.mjs.map +1 -1
  18. package/dist/shared/storage-schema.cjs +1 -3
  19. package/dist/shared/storage-schema.cjs.map +1 -1
  20. package/dist/shared/storage-schema.d.cts +0 -2
  21. package/dist/shared/storage-schema.d.cts.map +1 -1
  22. package/dist/shared/storage-schema.d.mts +0 -2
  23. package/dist/shared/storage-schema.d.mts.map +1 -1
  24. package/dist/shared/storage-schema.mjs +1 -3
  25. package/dist/shared/storage-schema.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/controllers/user-storage/contact-syncing/constants.cjs +0 -12
  28. package/dist/controllers/user-storage/contact-syncing/constants.cjs.map +0 -1
  29. package/dist/controllers/user-storage/contact-syncing/constants.d.cts +0 -9
  30. package/dist/controllers/user-storage/contact-syncing/constants.d.cts.map +0 -1
  31. package/dist/controllers/user-storage/contact-syncing/constants.d.mts +0 -9
  32. package/dist/controllers/user-storage/contact-syncing/constants.d.mts.map +0 -1
  33. package/dist/controllers/user-storage/contact-syncing/constants.mjs +0 -9
  34. package/dist/controllers/user-storage/contact-syncing/constants.mjs.map +0 -1
  35. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +0 -376
  36. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +0 -1
  37. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts +0 -45
  38. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +0 -1
  39. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts +0 -45
  40. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +0 -1
  41. package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs +0 -370
  42. package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +0 -1
  43. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +0 -57
  44. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +0 -1
  45. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts +0 -8
  46. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +0 -1
  47. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts +0 -8
  48. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +0 -1
  49. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs +0 -53
  50. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +0 -1
  51. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs +0 -23
  52. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +0 -1
  53. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts +0 -9
  54. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +0 -1
  55. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts +0 -9
  56. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +0 -1
  57. package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs +0 -19
  58. package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +0 -1
  59. package/dist/controllers/user-storage/contact-syncing/types.cjs +0 -3
  60. package/dist/controllers/user-storage/contact-syncing/types.cjs.map +0 -1
  61. package/dist/controllers/user-storage/contact-syncing/types.d.cts +0 -35
  62. package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +0 -1
  63. package/dist/controllers/user-storage/contact-syncing/types.d.mts +0 -35
  64. package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +0 -1
  65. package/dist/controllers/user-storage/contact-syncing/types.mjs +0 -2
  66. package/dist/controllers/user-storage/contact-syncing/types.mjs.map +0 -1
  67. package/dist/controllers/user-storage/contact-syncing/utils.cjs +0 -68
  68. package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +0 -1
  69. package/dist/controllers/user-storage/contact-syncing/utils.d.cts +0 -29
  70. package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +0 -1
  71. package/dist/controllers/user-storage/contact-syncing/utils.d.mts +0 -29
  72. package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +0 -1
  73. package/dist/controllers/user-storage/contact-syncing/utils.mjs +0 -63
  74. package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add contact syncing capability with conflict resolution b/w local and remote storage ([#5776](https://github.com/MetaMask/core/pull/5776))
13
-
14
10
  ## [15.0.0]
15
11
 
16
12
  ### Changed
@@ -17,9 +17,7 @@ const base_controller_1 = require("@metamask/base-controller");
17
17
  const controller_integration_1 = require("./account-syncing/controller-integration.cjs");
18
18
  const setup_subscriptions_1 = require("./account-syncing/setup-subscriptions.cjs");
19
19
  const constants_1 = require("./constants.cjs");
20
- const controller_integration_2 = require("./contact-syncing/controller-integration.cjs");
21
- const setup_subscriptions_2 = require("./contact-syncing/setup-subscriptions.cjs");
22
- const controller_integration_3 = require("./network-syncing/controller-integration.cjs");
20
+ const controller_integration_2 = require("./network-syncing/controller-integration.cjs");
23
21
  const sdk_1 = require("../../sdk/index.cjs");
24
22
  const auth_snap_requests_1 = require("../authentication/auth-snap-requests.cjs");
25
23
  const controllerName = 'UserStorageController';
@@ -27,8 +25,6 @@ exports.defaultState = {
27
25
  isBackupAndSyncEnabled: true,
28
26
  isBackupAndSyncUpdateLoading: false,
29
27
  isAccountSyncingEnabled: true,
30
- isContactSyncingEnabled: true,
31
- isContactSyncingInProgress: false,
32
28
  hasAccountSyncingSyncedAtLeastOnce: false,
33
29
  isAccountSyncingReadyToBeDispatched: false,
34
30
  isAccountSyncingInProgress: false,
@@ -46,14 +42,6 @@ const metadata = {
46
42
  persist: true,
47
43
  anonymous: true,
48
44
  },
49
- isContactSyncingEnabled: {
50
- persist: true,
51
- anonymous: true,
52
- },
53
- isContactSyncingInProgress: {
54
- persist: false,
55
- anonymous: false,
56
- },
57
45
  hasAccountSyncingSyncedAtLeastOnce: {
58
46
  persist: true,
59
47
  anonymous: false,
@@ -150,14 +138,9 @@ class UserStorageController extends base_controller_1.BaseController {
150
138
  getUserStorageControllerInstance: () => this,
151
139
  getMessenger: () => this.messagingSystem,
152
140
  });
153
- // Contact Syncing
154
- (0, setup_subscriptions_2.setupContactSyncingSubscriptions)({
155
- getUserStorageControllerInstance: () => this,
156
- getMessenger: () => this.messagingSystem,
157
- });
158
141
  // Network Syncing
159
142
  if (__classPrivateFieldGet(this, _UserStorageController_env, "f").isNetworkSyncingEnabled) {
160
- (0, controller_integration_3.startNetworkSyncing)({
143
+ (0, controller_integration_2.startNetworkSyncing)({
161
144
  messenger,
162
145
  getUserStorageControllerInstance: () => this,
163
146
  isMutationSyncBlocked: () => !this.state.hasNetworkSyncingSyncedAtLeastOnce,
@@ -284,9 +267,6 @@ class UserStorageController extends base_controller_1.BaseController {
284
267
  if (feature === constants_1.BACKUPANDSYNC_FEATURES.accountSyncing) {
285
268
  state.isAccountSyncingEnabled = enabled;
286
269
  }
287
- if (feature === constants_1.BACKUPANDSYNC_FEATURES.contactSyncing) {
288
- state.isContactSyncingEnabled = enabled;
289
- }
290
270
  });
291
271
  }
292
272
  catch (e) {
@@ -316,16 +296,6 @@ class UserStorageController extends base_controller_1.BaseController {
316
296
  state.isAccountSyncingInProgress = isAccountSyncingInProgress;
317
297
  });
318
298
  }
319
- /**
320
- * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
321
- *
322
- * @param isContactSyncingInProgress - Whether contact syncing is in progress
323
- */
324
- async setIsContactSyncingInProgress(isContactSyncingInProgress) {
325
- this.update((state) => {
326
- state.isContactSyncingInProgress = isContactSyncingInProgress;
327
- });
328
- }
329
299
  /**
330
300
  * Syncs the internal accounts list with the user storage accounts list.
331
301
  * This method is used to make sure that the internal accounts list is up-to-date with the user storage accounts list and vice-versa.
@@ -359,7 +329,7 @@ class UserStorageController extends base_controller_1.BaseController {
359
329
  return;
360
330
  }
361
331
  const profileId = await __classPrivateFieldGet(this, _UserStorageController_auth, "f").getProfileId();
362
- await (0, controller_integration_3.performMainNetworkSync)({
332
+ await (0, controller_integration_2.performMainNetworkSync)({
363
333
  messenger: this.messagingSystem,
364
334
  getUserStorageControllerInstance: () => this,
365
335
  maxNetworksToAdd: __classPrivateFieldGet(this, _UserStorageController_config, "f")?.networkSyncing?.maxNumberOfNetworksToAdd,
@@ -371,41 +341,6 @@ class UserStorageController extends base_controller_1.BaseController {
371
341
  s.hasNetworkSyncingSyncedAtLeastOnce = true;
372
342
  });
373
343
  }
374
- /**
375
- * Syncs the address book list with the user storage address book list.
376
- * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.
377
- * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.
378
- */
379
- async syncContactsWithUserStorage() {
380
- console.log('📓 Contact Sync: Starting in UserStorageController.syncContactsWithUserStorage');
381
- try {
382
- const profileId = await __classPrivateFieldGet(this, _UserStorageController_auth, "f").getProfileId();
383
- console.log('📓 Contact Sync: Got profileId', profileId);
384
- const config = {
385
- onContactUpdated: () => {
386
- console.log('📓 Contact Sync: Contact updated callback triggered');
387
- __classPrivateFieldGet(this, _UserStorageController_config, "f")?.contactSyncing?.onContactUpdated?.(profileId);
388
- },
389
- onContactDeleted: () => {
390
- console.log('📓 Contact Sync: Contact deleted callback triggered');
391
- __classPrivateFieldGet(this, _UserStorageController_config, "f")?.contactSyncing?.onContactDeleted?.(profileId);
392
- },
393
- onContactSyncErroneousSituation: (errorMessage, sentryContext) => {
394
- console.log('📓 Contact Sync: Error callback triggered', errorMessage);
395
- __classPrivateFieldGet(this, _UserStorageController_config, "f")?.contactSyncing?.onContactSyncErroneousSituation?.(profileId, errorMessage, sentryContext);
396
- },
397
- };
398
- await (0, controller_integration_2.syncContactsWithUserStorage)(config, {
399
- getMessenger: () => this.messagingSystem,
400
- getUserStorageControllerInstance: () => this,
401
- });
402
- console.log('📓 Contact Sync: Completed successfully in UserStorageController');
403
- }
404
- catch (error) {
405
- console.error('📓 Contact Sync: Error in UserStorageController', error);
406
- throw error;
407
- }
408
- }
409
344
  }
410
345
  _UserStorageController_env = new WeakMap(), _UserStorageController_userStorage = new WeakMap(), _UserStorageController_auth = new WeakMap(), _UserStorageController_config = new WeakMap(), _UserStorageController_isUnlocked = new WeakMap(), _UserStorageController_storageKeyCache = new WeakMap(), _UserStorageController_keyringController = new WeakMap(), _UserStorageController_nativeScryptCrypto = new WeakMap(), _UserStorageController__snapSignMessageCache = new WeakMap(), _UserStorageController_instances = new WeakSet(), _UserStorageController_registerMessageHandlers = function _UserStorageController_registerMessageHandlers() {
411
346
  this.messagingSystem.registerActionHandler('UserStorageController:performGetStorage', this.performGetStorage.bind(this));
@@ -1 +1 @@
1
- {"version":3,"file":"UserStorageController.cjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAoBA,+DAA2D;AAiB3D,yFAGkD;AAClD,mFAAyF;AACzF,+CAAqD;AACrD,yFAAuF;AACvF,mFAAyF;AACzF,yFAGkD;AAClD,6CAA6C;AAO7C,iFAAoF;AAQpF,MAAM,cAAc,GAAG,uBAAuB,CAAC;AA4ClC,QAAA,YAAY,GAA+B;IACtD,sBAAsB,EAAE,IAAI;IAC5B,4BAA4B,EAAE,KAAK;IACnC,uBAAuB,EAAE,IAAI;IAC7B,uBAAuB,EAAE,IAAI;IAC7B,0BAA0B,EAAE,KAAK;IACjC,kCAAkC,EAAE,KAAK;IACzC,mCAAmC,EAAE,KAAK;IAC1C,0BAA0B,EAAE,KAAK;CAClC,CAAC;AAEF,MAAM,QAAQ,GAA8C;IAC1D,sBAAsB,EAAE;QACtB,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;KAChB;IACD,4BAA4B,EAAE;QAC5B,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,KAAK;KACjB;IACD,uBAAuB,EAAE;QACvB,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;KAChB;IACD,uBAAuB,EAAE;QACvB,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;KAChB;IACD,0BAA0B,EAAE;QAC1B,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,KAAK;KACjB;IACD,kCAAkC,EAAE;QAClC,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,KAAK;KACjB;IACD,mCAAmC,EAAE;QACnC,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,KAAK;KACjB;IACD,0BAA0B,EAAE;QAC1B,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,KAAK;KACjB;IACD,kCAAkC,EAAE;QAClC,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,KAAK;KACjB;CACF,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AE9C,OAAO,MAAM,CAAC;AAChB,CAAC,2HA2CC,4BAAqC;IAErC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACpB,KAAK,CAAC,4BAA4B,GAAG,4BAA4B,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC;kBAhYkB,qBAAqB","sourcesContent":["import type {\n AccountsControllerListAccountsAction,\n AccountsControllerUpdateAccountMetadataAction,\n AccountsControllerAccountRenamedEvent,\n AccountsControllerAccountAddedEvent,\n} from '@metamask/accounts-controller';\nimport type {\n AddressBookControllerContactUpdatedEvent,\n AddressBookControllerContactDeletedEvent,\n AddressBookControllerActions,\n AddressBookControllerListAction,\n AddressBookControllerSetAction,\n AddressBookControllerDeleteAction,\n} from '@metamask/address-book-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport {\n type KeyringControllerGetStateAction,\n type KeyringControllerLockEvent,\n type KeyringControllerUnlockEvent,\n type KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type {\n NetworkControllerAddNetworkAction,\n NetworkControllerGetStateAction,\n NetworkControllerNetworkRemovedEvent,\n NetworkControllerRemoveNetworkAction,\n NetworkControllerUpdateNetworkAction,\n} from '@metamask/network-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\n\nimport {\n saveInternalAccountToUserStorage,\n syncInternalAccountsWithUserStorage,\n} from './account-syncing/controller-integration';\nimport { setupAccountSyncingSubscriptions } from './account-syncing/setup-subscriptions';\nimport { BACKUPANDSYNC_FEATURES } from './constants';\nimport { syncContactsWithUserStorage } from './contact-syncing/controller-integration';\nimport { setupContactSyncingSubscriptions } from './contact-syncing/setup-subscriptions';\nimport {\n performMainNetworkSync,\n startNetworkSyncing,\n} from './network-syncing/controller-integration';\nimport { Env, UserStorage } from '../../sdk';\nimport type { UserStorageFeatureKeys } from '../../shared/storage-schema';\nimport {\n type UserStoragePathWithFeatureAndKey,\n type UserStoragePathWithFeatureOnly,\n} from '../../shared/storage-schema';\nimport type { NativeScrypt } from '../../shared/types/encryption';\nimport { createSnapSignMessageRequest } from '../authentication/auth-snap-requests';\nimport type {\n AuthenticationControllerGetBearerToken,\n AuthenticationControllerGetSessionProfile,\n AuthenticationControllerIsSignedIn,\n AuthenticationControllerPerformSignIn,\n} from '../authentication/AuthenticationController';\n\nconst controllerName = 'UserStorageController';\n\n// State\nexport type UserStorageControllerState = {\n /**\n * Condition used by UI and to determine if we can use some of the User Storage methods.\n */\n isBackupAndSyncEnabled: boolean;\n /**\n * Loading state for the backup and sync update\n */\n isBackupAndSyncUpdateLoading: boolean;\n /**\n * Condition used by UI to determine if account syncing is enabled.\n */\n isAccountSyncingEnabled: boolean;\n /**\n * Condition used by UI to determine if contact syncing is enabled.\n */\n isContactSyncingEnabled: boolean;\n /**\n * Condition used by UI to determine if contact syncing is in progress.\n */\n isContactSyncingInProgress: boolean;\n /**\n * Condition used to determine if account syncing has been dispatched at least once.\n * This is used for event listeners to determine if they should be triggered.\n * This is also used in E2E tests for verification purposes.\n */\n hasAccountSyncingSyncedAtLeastOnce: boolean;\n /**\n * Condition used by UI to determine if account syncing is ready to be dispatched.\n */\n isAccountSyncingReadyToBeDispatched: boolean;\n /**\n * Condition used by UI to determine if account syncing is in progress.\n */\n isAccountSyncingInProgress: boolean;\n /**\n * Condition used to ensure that we do not perform any network sync mutations until we have synced at least once\n */\n hasNetworkSyncingSyncedAtLeastOnce?: boolean;\n};\n\nexport const defaultState: UserStorageControllerState = {\n isBackupAndSyncEnabled: true,\n isBackupAndSyncUpdateLoading: false,\n isAccountSyncingEnabled: true,\n isContactSyncingEnabled: true,\n isContactSyncingInProgress: false,\n hasAccountSyncingSyncedAtLeastOnce: false,\n isAccountSyncingReadyToBeDispatched: false,\n isAccountSyncingInProgress: false,\n};\n\nconst metadata: StateMetadata<UserStorageControllerState> = {\n isBackupAndSyncEnabled: {\n persist: true,\n anonymous: true,\n },\n isBackupAndSyncUpdateLoading: {\n persist: false,\n anonymous: false,\n },\n isAccountSyncingEnabled: {\n persist: true,\n anonymous: true,\n },\n isContactSyncingEnabled: {\n persist: true,\n anonymous: true,\n },\n isContactSyncingInProgress: {\n persist: false,\n anonymous: false,\n },\n hasAccountSyncingSyncedAtLeastOnce: {\n persist: true,\n anonymous: false,\n },\n isAccountSyncingReadyToBeDispatched: {\n persist: true,\n anonymous: false,\n },\n isAccountSyncingInProgress: {\n persist: false,\n anonymous: false,\n },\n hasNetworkSyncingSyncedAtLeastOnce: {\n persist: true,\n anonymous: false,\n },\n};\n\ntype ControllerConfig = {\n accountSyncing?: {\n maxNumberOfAccountsToAdd?: number;\n /**\n * Callback that fires when account sync adds an account.\n * This is used for analytics.\n */\n onAccountAdded?: (profileId: string) => void;\n\n /**\n * Callback that fires when account sync updates the name of an account.\n * This is used for analytics.\n */\n onAccountNameUpdated?: (profileId: string) => void;\n\n /**\n * Callback that fires when an erroneous situation happens during account sync.\n * This is used for analytics.\n */\n onAccountSyncErroneousSituation?: (\n profileId: string,\n situationMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => void;\n };\n contactSyncing?: {\n /**\n * Callback that fires when contact sync updates a contact.\n * This is used for analytics.\n */\n onContactUpdated?: (profileId: string) => void;\n\n /**\n * Callback that fires when contact sync deletes a contact.\n * This is used for analytics.\n */\n onContactDeleted?: (profileId: string) => void;\n\n /**\n * Callback that fires when an erroneous situation happens during contact sync.\n * This is used for analytics.\n */\n onContactSyncErroneousSituation?: (\n profileId: string,\n situationMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => void;\n };\n networkSyncing?: {\n maxNumberOfNetworksToAdd?: number;\n /**\n * Callback that fires when network sync adds a network\n * This is used for analytics.\n *\n * @param profileId - ID for a given User (shared cross devices once authenticated)\n * @param chainId - Chain ID for the network added (in hex)\n */\n onNetworkAdded?: (profileId: string, chainId: string) => void;\n /**\n * Callback that fires when network sync updates a network\n * This is used for analytics.\n *\n * @param profileId - ID for a given User (shared cross devices once authenticated)\n * @param chainId - Chain ID for the network added (in hex)\n */\n onNetworkUpdated?: (profileId: string, chainId: string) => void;\n /**\n * Callback that fires when network sync deletes a network\n * This is used for analytics.\n *\n * @param profileId - ID for a given User (shared cross devices once authenticated)\n * @param chainId - Chain ID for the network added (in hex)\n */\n onNetworkRemoved?: (profileId: string, chainId: string) => void;\n };\n};\n\n// Messenger Actions\ntype CreateActionsObj<Controller extends keyof UserStorageController> = {\n [K in Controller]: {\n type: `${typeof controllerName}:${K}`;\n handler: UserStorageController[K];\n };\n};\ntype ActionsObj = CreateActionsObj<\n | 'performGetStorage'\n | 'performGetStorageAllFeatureEntries'\n | 'performSetStorage'\n | 'performBatchSetStorage'\n | 'performDeleteStorage'\n | 'performBatchDeleteStorage'\n | 'getStorageKey'\n>;\nexport type UserStorageControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n UserStorageControllerState\n>;\nexport type Actions =\n | ActionsObj[keyof ActionsObj]\n | UserStorageControllerGetStateAction;\nexport type UserStorageControllerPerformGetStorage =\n ActionsObj['performGetStorage'];\nexport type UserStorageControllerPerformGetStorageAllFeatureEntries =\n ActionsObj['performGetStorageAllFeatureEntries'];\nexport type UserStorageControllerPerformSetStorage =\n ActionsObj['performSetStorage'];\nexport type UserStorageControllerPerformBatchSetStorage =\n ActionsObj['performBatchSetStorage'];\nexport type UserStorageControllerPerformDeleteStorage =\n ActionsObj['performDeleteStorage'];\nexport type UserStorageControllerPerformBatchDeleteStorage =\n ActionsObj['performBatchDeleteStorage'];\nexport type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];\n\nexport type AllowedActions =\n // Keyring Requests\n | KeyringControllerGetStateAction\n // Snap Requests\n | HandleSnapRequest\n // Auth Requests\n | AuthenticationControllerGetBearerToken\n | AuthenticationControllerGetSessionProfile\n | AuthenticationControllerPerformSignIn\n | AuthenticationControllerIsSignedIn\n // Account Syncing\n | AccountsControllerListAccountsAction\n | AccountsControllerUpdateAccountMetadataAction\n | KeyringControllerWithKeyringAction\n // Network Syncing\n | NetworkControllerGetStateAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerUpdateNetworkAction\n // Contact Syncing\n | AddressBookControllerListAction\n | AddressBookControllerSetAction\n | AddressBookControllerDeleteAction\n | AddressBookControllerActions;\n\n// Messenger events\nexport type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n UserStorageControllerState\n>;\n\nexport type Events = UserStorageControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | UserStorageControllerStateChangeEvent\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent\n // Account Syncing Events\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRenamedEvent\n // Network Syncing Events\n | NetworkControllerNetworkRemovedEvent\n // Address Book Events\n | AddressBookControllerContactUpdatedEvent\n | AddressBookControllerContactDeletedEvent;\n\n// Messenger\nexport type UserStorageControllerMessenger = RestrictedMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Reusable controller that allows any team to store synchronized data for a given user.\n * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.\n *\n * NOTE:\n * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.\n * - No one can access this data unless they are have the SRP and are able to run the signing snap.\n */\nexport default class UserStorageController extends BaseController<\n typeof controllerName,\n UserStorageControllerState,\n UserStorageControllerMessenger\n> {\n // This is replaced with the actual value in the constructor\n // We will remove this once the feature will be released\n readonly #env = {\n isNetworkSyncingEnabled: false,\n };\n\n readonly #userStorage: UserStorage;\n\n readonly #auth = {\n getProfileId: async () => {\n const sessionProfile = await this.messagingSystem.call(\n 'AuthenticationController:getSessionProfile',\n );\n return sessionProfile?.profileId;\n },\n isSignedIn: () => {\n return this.messagingSystem.call('AuthenticationController:isSignedIn');\n },\n signIn: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:performSignIn',\n );\n },\n };\n\n readonly #config?: ControllerConfig;\n\n #isUnlocked = false;\n\n #storageKeyCache: Record<`metamask:${string}`, string> = {};\n\n readonly #keyringController = {\n setupLockedStateSubscriptions: () => {\n const { isUnlocked } = this.messagingSystem.call(\n 'KeyringController:getState',\n );\n this.#isUnlocked = isUnlocked;\n\n this.messagingSystem.subscribe('KeyringController:unlock', () => {\n this.#isUnlocked = true;\n });\n\n this.messagingSystem.subscribe('KeyringController:lock', () => {\n this.#isUnlocked = false;\n });\n },\n };\n\n readonly #nativeScryptCrypto: NativeScrypt | undefined = undefined;\n\n constructor({\n messenger,\n state,\n env,\n config,\n nativeScryptCrypto,\n }: {\n messenger: UserStorageControllerMessenger;\n state?: UserStorageControllerState;\n config?: ControllerConfig;\n env?: {\n isNetworkSyncingEnabled?: boolean;\n };\n nativeScryptCrypto?: NativeScrypt;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#env.isNetworkSyncingEnabled = Boolean(env?.isNetworkSyncingEnabled);\n this.#config = config;\n\n this.#userStorage = new UserStorage(\n {\n env: Env.PRD,\n auth: {\n getAccessToken: () =>\n this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n ),\n getUserProfile: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:getSessionProfile',\n );\n },\n signMessage: (message) =>\n this.#snapSignMessage(message as `metamask:${string}`),\n },\n },\n {\n storage: {\n getStorageKey: async (message) =>\n this.#storageKeyCache[message] ?? null,\n setStorageKey: async (message, key) => {\n this.#storageKeyCache[message] = key;\n },\n },\n },\n );\n\n this.#keyringController.setupLockedStateSubscriptions();\n this.#registerMessageHandlers();\n this.#nativeScryptCrypto = nativeScryptCrypto;\n\n // Account Syncing\n setupAccountSyncingSubscriptions({\n getUserStorageControllerInstance: () => this,\n getMessenger: () => this.messagingSystem,\n });\n\n // Contact Syncing\n setupContactSyncingSubscriptions({\n getUserStorageControllerInstance: () => this,\n getMessenger: () => this.messagingSystem,\n });\n\n // Network Syncing\n if (this.#env.isNetworkSyncingEnabled) {\n startNetworkSyncing({\n messenger,\n getUserStorageControllerInstance: () => this,\n isMutationSyncBlocked: () =>\n !this.state.hasNetworkSyncingSyncedAtLeastOnce,\n });\n }\n }\n\n /**\n * Constructor helper for registering this controller's messaging system\n * actions.\n */\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performGetStorage',\n this.performGetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performGetStorageAllFeatureEntries',\n this.performGetStorageAllFeatureEntries.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performSetStorage',\n this.performSetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performBatchSetStorage',\n this.performBatchSetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performDeleteStorage',\n this.performDeleteStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performBatchDeleteStorage',\n this.performBatchDeleteStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:getStorageKey',\n this.getStorageKey.bind(this),\n );\n }\n\n /**\n * Allows retrieval of stored data. Data stored is string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @returns the decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorage(\n path: UserStoragePathWithFeatureAndKey,\n ): Promise<string | null> {\n return await this.#userStorage.getItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @returns the array of decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorageAllFeatureEntries(\n path: UserStoragePathWithFeatureOnly,\n ): Promise<string[] | null> {\n return await this.#userStorage.getAllFeatureItems(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows storage of user data. Data stored must be string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param value - The string data you want to store.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performSetStorage(\n path: UserStoragePathWithFeatureAndKey,\n value: string,\n ): Promise<void> {\n return await this.#userStorage.setItem(path, value, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchSetStorage<\n FeatureName extends UserStoragePathWithFeatureOnly,\n >(\n path: FeatureName,\n values: [UserStorageFeatureKeys<FeatureName>, string][],\n ): Promise<void> {\n return await this.#userStorage.batchSetItems(path, values, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorage(\n path: UserStoragePathWithFeatureAndKey,\n ): Promise<void> {\n return await this.#userStorage.deleteItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows deletion of all user data entries for a specific feature.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorageAllFeatureEntries(\n path: UserStoragePathWithFeatureOnly,\n ): Promise<void> {\n return await this.#userStorage.deleteAllFeatureItems(path);\n }\n\n /**\n * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of entryKey[]\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchDeleteStorage<\n FeatureName extends UserStoragePathWithFeatureOnly,\n >(\n path: FeatureName,\n values: UserStorageFeatureKeys<FeatureName>[],\n ): Promise<void> {\n return await this.#userStorage.batchDeleteItems(path, values);\n }\n\n /**\n * Retrieves the storage key, for internal use only!\n *\n * @returns the storage key\n */\n public async getStorageKey(): Promise<string> {\n return await this.#userStorage.getStorageKey();\n }\n\n /**\n * Flushes the storage key cache.\n * CAUTION: This is only public for testing purposes.\n * It should not be used in production code.\n */\n public flushStorageKeyCache(): void {\n this.#storageKeyCache = {};\n }\n\n #_snapSignMessageCache: Record<`metamask:${string}`, string> = {};\n\n /**\n * Signs a specific message using an underlying auth snap.\n *\n * @param message - A specific tagged message to sign.\n * @returns A Signature created by the snap.\n */\n async #snapSignMessage(message: `metamask:${string}`): Promise<string> {\n if (this.#_snapSignMessageCache[message]) {\n return this.#_snapSignMessageCache[message];\n }\n\n if (!this.#isUnlocked) {\n throw new Error(\n '#snapSignMessage - unable to call snap, wallet is locked',\n );\n }\n\n const result = (await this.messagingSystem.call(\n 'SnapController:handleRequest',\n createSnapSignMessageRequest(message),\n )) as string;\n\n this.#_snapSignMessageCache[message] = result;\n\n return result;\n }\n\n public async setIsBackupAndSyncFeatureEnabled(\n feature: keyof typeof BACKUPANDSYNC_FEATURES,\n enabled: boolean,\n ): Promise<void> {\n try {\n this.#setIsBackupAndSyncUpdateLoading(true);\n\n if (enabled) {\n // If any of the features are enabled, we need to ensure the user is signed in\n const isSignedIn = this.#auth.isSignedIn();\n if (!isSignedIn) {\n await this.#auth.signIn();\n }\n }\n\n this.update((state) => {\n if (feature === BACKUPANDSYNC_FEATURES.main) {\n state.isBackupAndSyncEnabled = enabled;\n }\n\n if (feature === BACKUPANDSYNC_FEATURES.accountSyncing) {\n state.isAccountSyncingEnabled = enabled;\n }\n\n if (feature === BACKUPANDSYNC_FEATURES.contactSyncing) {\n state.isContactSyncingEnabled = enabled;\n }\n });\n } catch (e) {\n // istanbul ignore next\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n // istanbul ignore next\n throw new Error(\n `${controllerName} - failed to ${enabled ? 'enable' : 'disable'} ${feature} - ${errorMessage}`,\n );\n } finally {\n this.#setIsBackupAndSyncUpdateLoading(false);\n }\n }\n\n #setIsBackupAndSyncUpdateLoading(\n isBackupAndSyncUpdateLoading: boolean,\n ): void {\n this.update((state) => {\n state.isBackupAndSyncUpdateLoading = isBackupAndSyncUpdateLoading;\n });\n }\n\n async setHasAccountSyncingSyncedAtLeastOnce(\n hasAccountSyncingSyncedAtLeastOnce: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.hasAccountSyncingSyncedAtLeastOnce =\n hasAccountSyncingSyncedAtLeastOnce;\n });\n }\n\n async setIsAccountSyncingReadyToBeDispatched(\n isAccountSyncingReadyToBeDispatched: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isAccountSyncingReadyToBeDispatched =\n isAccountSyncingReadyToBeDispatched;\n });\n }\n\n async setIsAccountSyncingInProgress(\n isAccountSyncingInProgress: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isAccountSyncingInProgress = isAccountSyncingInProgress;\n });\n }\n\n /**\n * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization\n *\n * @param isContactSyncingInProgress - Whether contact syncing is in progress\n */\n async setIsContactSyncingInProgress(\n isContactSyncingInProgress: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isContactSyncingInProgress = isContactSyncingInProgress;\n });\n }\n\n /**\n * Syncs the internal accounts list with the user storage accounts list.\n * This method is used to make sure that the internal accounts list is up-to-date with the user storage accounts list and vice-versa.\n * It will add new accounts to the internal accounts list, update/merge conflicting names and re-upload the results in some cases to the user storage.\n */\n async syncInternalAccountsWithUserStorage(): Promise<void> {\n const profileId = await this.#auth.getProfileId();\n\n await syncInternalAccountsWithUserStorage(\n {\n maxNumberOfAccountsToAdd:\n this.#config?.accountSyncing?.maxNumberOfAccountsToAdd,\n onAccountAdded: () =>\n this.#config?.accountSyncing?.onAccountAdded?.(profileId),\n onAccountNameUpdated: () =>\n this.#config?.accountSyncing?.onAccountNameUpdated?.(profileId),\n onAccountSyncErroneousSituation: (situationMessage, sentryContext) =>\n this.#config?.accountSyncing?.onAccountSyncErroneousSituation?.(\n profileId,\n situationMessage,\n sentryContext,\n ),\n },\n {\n getMessenger: () => this.messagingSystem,\n getUserStorageControllerInstance: () => this,\n },\n );\n }\n\n /**\n * Saves an individual internal account to the user storage.\n *\n * @param internalAccount - The internal account to save\n */\n async saveInternalAccountToUserStorage(\n internalAccount: InternalAccount,\n ): Promise<void> {\n await saveInternalAccountToUserStorage(internalAccount, {\n getMessenger: () => this.messagingSystem,\n getUserStorageControllerInstance: () => this,\n });\n }\n\n async syncNetworks() {\n if (!this.#env.isNetworkSyncingEnabled) {\n return;\n }\n\n const profileId = await this.#auth.getProfileId();\n\n await performMainNetworkSync({\n messenger: this.messagingSystem,\n getUserStorageControllerInstance: () => this,\n maxNetworksToAdd: this.#config?.networkSyncing?.maxNumberOfNetworksToAdd,\n onNetworkAdded: (cId) =>\n this.#config?.networkSyncing?.onNetworkAdded?.(profileId, cId),\n onNetworkUpdated: (cId) =>\n this.#config?.networkSyncing?.onNetworkUpdated?.(profileId, cId),\n onNetworkRemoved: (cId) =>\n this.#config?.networkSyncing?.onNetworkRemoved?.(profileId, cId),\n });\n\n this.update((s) => {\n s.hasNetworkSyncingSyncedAtLeastOnce = true;\n });\n }\n\n /**\n * Syncs the address book list with the user storage address book list.\n * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.\n * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.\n */\n async syncContactsWithUserStorage(): Promise<void> {\n console.log(\n '📓 Contact Sync: Starting in UserStorageController.syncContactsWithUserStorage',\n );\n try {\n const profileId = await this.#auth.getProfileId();\n console.log('📓 Contact Sync: Got profileId', profileId);\n\n const config = {\n onContactUpdated: () => {\n console.log('📓 Contact Sync: Contact updated callback triggered');\n this.#config?.contactSyncing?.onContactUpdated?.(profileId);\n },\n onContactDeleted: () => {\n console.log('📓 Contact Sync: Contact deleted callback triggered');\n this.#config?.contactSyncing?.onContactDeleted?.(profileId);\n },\n onContactSyncErroneousSituation: (\n errorMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => {\n console.log(\n '📓 Contact Sync: Error callback triggered',\n errorMessage,\n );\n this.#config?.contactSyncing?.onContactSyncErroneousSituation?.(\n profileId,\n errorMessage,\n sentryContext,\n );\n },\n };\n\n await syncContactsWithUserStorage(config, {\n getMessenger: () => this.messagingSystem,\n getUserStorageControllerInstance: () => this,\n });\n\n console.log(\n '📓 Contact Sync: Completed successfully in UserStorageController',\n );\n } catch (error) {\n console.error('📓 Contact Sync: Error in UserStorageController', error);\n throw error;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"UserStorageController.cjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAYA,+DAA2D;AAiB3D,yFAGkD;AAClD,mFAAyF;AACzF,+CAAqD;AACrD,yFAGkD;AAClD,6CAA6C;AAO7C,iFAAoF;AAQpF,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAoClC,QAAA,YAAY,GAA+B;IACtD,sBAAsB,EAAE,IAAI;IAC5B,4BAA4B,EAAE,KAAK;IACnC,uBAAuB,EAAE,IAAI;IAC7B,kCAAkC,EAAE,KAAK;IACzC,mCAAmC,EAAE,KAAK;IAC1C,0BAA0B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B,IAAA,iDAA4B,EAAC,OAAO,CAAC,CACtC,CAAW,CAAC;IAEb,uBAAA,IAAI,oDAAuB,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;IAE9C,OAAO,MAAM,CAAC;AAChB,CAAC,2HAuCC,4BAAqC;IAErC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACpB,KAAK,CAAC,4BAA4B,GAAG,4BAA4B,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC;kBAtXkB,qBAAqB","sourcesContent":["import type {\n AccountsControllerListAccountsAction,\n AccountsControllerUpdateAccountMetadataAction,\n AccountsControllerAccountRenamedEvent,\n AccountsControllerAccountAddedEvent,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport {\n type KeyringControllerGetStateAction,\n type KeyringControllerLockEvent,\n type KeyringControllerUnlockEvent,\n type KeyringControllerWithKeyringAction,\n} from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type {\n NetworkControllerAddNetworkAction,\n NetworkControllerGetStateAction,\n NetworkControllerNetworkRemovedEvent,\n NetworkControllerRemoveNetworkAction,\n NetworkControllerUpdateNetworkAction,\n} from '@metamask/network-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\n\nimport {\n saveInternalAccountToUserStorage,\n syncInternalAccountsWithUserStorage,\n} from './account-syncing/controller-integration';\nimport { setupAccountSyncingSubscriptions } from './account-syncing/setup-subscriptions';\nimport { BACKUPANDSYNC_FEATURES } from './constants';\nimport {\n performMainNetworkSync,\n startNetworkSyncing,\n} from './network-syncing/controller-integration';\nimport { Env, UserStorage } from '../../sdk';\nimport type { UserStorageFeatureKeys } from '../../shared/storage-schema';\nimport {\n type UserStoragePathWithFeatureAndKey,\n type UserStoragePathWithFeatureOnly,\n} from '../../shared/storage-schema';\nimport type { NativeScrypt } from '../../shared/types/encryption';\nimport { createSnapSignMessageRequest } from '../authentication/auth-snap-requests';\nimport type {\n AuthenticationControllerGetBearerToken,\n AuthenticationControllerGetSessionProfile,\n AuthenticationControllerIsSignedIn,\n AuthenticationControllerPerformSignIn,\n} from '../authentication/AuthenticationController';\n\nconst controllerName = 'UserStorageController';\n\n// State\nexport type UserStorageControllerState = {\n /**\n * Condition used by UI and to determine if we can use some of the User Storage methods.\n */\n isBackupAndSyncEnabled: boolean;\n /**\n * Loading state for the backup and sync update\n */\n isBackupAndSyncUpdateLoading: boolean;\n /**\n * Condition used by UI to determine if account syncing is enabled.\n */\n isAccountSyncingEnabled: boolean;\n /**\n * Condition used to determine if account syncing has been dispatched at least once.\n * This is used for event listeners to determine if they should be triggered.\n * This is also used in E2E tests for verification purposes.\n */\n hasAccountSyncingSyncedAtLeastOnce: boolean;\n /**\n * Condition used by UI to determine if account syncing is ready to be dispatched.\n */\n isAccountSyncingReadyToBeDispatched: boolean;\n /**\n * Condition used by UI to determine if account syncing is in progress.\n */\n isAccountSyncingInProgress: boolean;\n /**\n * Condition used to ensure that we do not perform any network sync mutations until we have synced at least once\n */\n hasNetworkSyncingSyncedAtLeastOnce?: boolean;\n};\n\nexport const defaultState: UserStorageControllerState = {\n isBackupAndSyncEnabled: true,\n isBackupAndSyncUpdateLoading: false,\n isAccountSyncingEnabled: true,\n hasAccountSyncingSyncedAtLeastOnce: false,\n isAccountSyncingReadyToBeDispatched: false,\n isAccountSyncingInProgress: false,\n};\n\nconst metadata: StateMetadata<UserStorageControllerState> = {\n isBackupAndSyncEnabled: {\n persist: true,\n anonymous: true,\n },\n isBackupAndSyncUpdateLoading: {\n persist: false,\n anonymous: false,\n },\n isAccountSyncingEnabled: {\n persist: true,\n anonymous: true,\n },\n hasAccountSyncingSyncedAtLeastOnce: {\n persist: true,\n anonymous: false,\n },\n isAccountSyncingReadyToBeDispatched: {\n persist: true,\n anonymous: false,\n },\n isAccountSyncingInProgress: {\n persist: false,\n anonymous: false,\n },\n hasNetworkSyncingSyncedAtLeastOnce: {\n persist: true,\n anonymous: false,\n },\n};\n\ntype ControllerConfig = {\n accountSyncing?: {\n maxNumberOfAccountsToAdd?: number;\n /**\n * Callback that fires when account sync adds an account.\n * This is used for analytics.\n */\n onAccountAdded?: (profileId: string) => void;\n\n /**\n * Callback that fires when account sync updates the name of an account.\n * This is used for analytics.\n */\n onAccountNameUpdated?: (profileId: string) => void;\n\n /**\n * Callback that fires when an erroneous situation happens during account sync.\n * This is used for analytics.\n */\n onAccountSyncErroneousSituation?: (\n profileId: string,\n situationMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => void;\n };\n\n networkSyncing?: {\n maxNumberOfNetworksToAdd?: number;\n /**\n * Callback that fires when network sync adds a network\n * This is used for analytics.\n *\n * @param profileId - ID for a given User (shared cross devices once authenticated)\n * @param chainId - Chain ID for the network added (in hex)\n */\n onNetworkAdded?: (profileId: string, chainId: string) => void;\n /**\n * Callback that fires when network sync updates a network\n * This is used for analytics.\n *\n * @param profileId - ID for a given User (shared cross devices once authenticated)\n * @param chainId - Chain ID for the network added (in hex)\n */\n onNetworkUpdated?: (profileId: string, chainId: string) => void;\n /**\n * Callback that fires when network sync deletes a network\n * This is used for analytics.\n *\n * @param profileId - ID for a given User (shared cross devices once authenticated)\n * @param chainId - Chain ID for the network added (in hex)\n */\n onNetworkRemoved?: (profileId: string, chainId: string) => void;\n };\n};\n\n// Messenger Actions\ntype CreateActionsObj<Controller extends keyof UserStorageController> = {\n [K in Controller]: {\n type: `${typeof controllerName}:${K}`;\n handler: UserStorageController[K];\n };\n};\ntype ActionsObj = CreateActionsObj<\n | 'performGetStorage'\n | 'performGetStorageAllFeatureEntries'\n | 'performSetStorage'\n | 'performBatchSetStorage'\n | 'performDeleteStorage'\n | 'performBatchDeleteStorage'\n | 'getStorageKey'\n>;\nexport type UserStorageControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n UserStorageControllerState\n>;\nexport type Actions =\n | ActionsObj[keyof ActionsObj]\n | UserStorageControllerGetStateAction;\nexport type UserStorageControllerPerformGetStorage =\n ActionsObj['performGetStorage'];\nexport type UserStorageControllerPerformGetStorageAllFeatureEntries =\n ActionsObj['performGetStorageAllFeatureEntries'];\nexport type UserStorageControllerPerformSetStorage =\n ActionsObj['performSetStorage'];\nexport type UserStorageControllerPerformBatchSetStorage =\n ActionsObj['performBatchSetStorage'];\nexport type UserStorageControllerPerformDeleteStorage =\n ActionsObj['performDeleteStorage'];\nexport type UserStorageControllerPerformBatchDeleteStorage =\n ActionsObj['performBatchDeleteStorage'];\nexport type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];\n\nexport type AllowedActions =\n // Keyring Requests\n | KeyringControllerGetStateAction\n // Snap Requests\n | HandleSnapRequest\n // Auth Requests\n | AuthenticationControllerGetBearerToken\n | AuthenticationControllerGetSessionProfile\n | AuthenticationControllerPerformSignIn\n | AuthenticationControllerIsSignedIn\n // Account Syncing\n | AccountsControllerListAccountsAction\n | AccountsControllerUpdateAccountMetadataAction\n | KeyringControllerWithKeyringAction\n // Network Syncing\n | NetworkControllerGetStateAction\n | NetworkControllerAddNetworkAction\n | NetworkControllerRemoveNetworkAction\n | NetworkControllerUpdateNetworkAction;\n\n// Messenger events\nexport type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n UserStorageControllerState\n>;\n\nexport type Events = UserStorageControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | UserStorageControllerStateChangeEvent\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent\n // Account Syncing Events\n | AccountsControllerAccountAddedEvent\n | AccountsControllerAccountRenamedEvent\n // Network Syncing Events\n | NetworkControllerNetworkRemovedEvent;\n\n// Messenger\nexport type UserStorageControllerMessenger = RestrictedMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Reusable controller that allows any team to store synchronized data for a given user.\n * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.\n *\n * NOTE:\n * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.\n * - No one can access this data unless they are have the SRP and are able to run the signing snap.\n */\nexport default class UserStorageController extends BaseController<\n typeof controllerName,\n UserStorageControllerState,\n UserStorageControllerMessenger\n> {\n // This is replaced with the actual value in the constructor\n // We will remove this once the feature will be released\n readonly #env = {\n isNetworkSyncingEnabled: false,\n };\n\n readonly #userStorage: UserStorage;\n\n readonly #auth = {\n getProfileId: async () => {\n const sessionProfile = await this.messagingSystem.call(\n 'AuthenticationController:getSessionProfile',\n );\n return sessionProfile?.profileId;\n },\n isSignedIn: () => {\n return this.messagingSystem.call('AuthenticationController:isSignedIn');\n },\n signIn: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:performSignIn',\n );\n },\n };\n\n readonly #config?: ControllerConfig;\n\n #isUnlocked = false;\n\n #storageKeyCache: Record<`metamask:${string}`, string> = {};\n\n readonly #keyringController = {\n setupLockedStateSubscriptions: () => {\n const { isUnlocked } = this.messagingSystem.call(\n 'KeyringController:getState',\n );\n this.#isUnlocked = isUnlocked;\n\n this.messagingSystem.subscribe('KeyringController:unlock', () => {\n this.#isUnlocked = true;\n });\n\n this.messagingSystem.subscribe('KeyringController:lock', () => {\n this.#isUnlocked = false;\n });\n },\n };\n\n readonly #nativeScryptCrypto: NativeScrypt | undefined = undefined;\n\n constructor({\n messenger,\n state,\n env,\n config,\n nativeScryptCrypto,\n }: {\n messenger: UserStorageControllerMessenger;\n state?: UserStorageControllerState;\n config?: ControllerConfig;\n env?: {\n isNetworkSyncingEnabled?: boolean;\n };\n nativeScryptCrypto?: NativeScrypt;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#env.isNetworkSyncingEnabled = Boolean(env?.isNetworkSyncingEnabled);\n this.#config = config;\n\n this.#userStorage = new UserStorage(\n {\n env: Env.PRD,\n auth: {\n getAccessToken: () =>\n this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n ),\n getUserProfile: async () => {\n return await this.messagingSystem.call(\n 'AuthenticationController:getSessionProfile',\n );\n },\n signMessage: (message) =>\n this.#snapSignMessage(message as `metamask:${string}`),\n },\n },\n {\n storage: {\n getStorageKey: async (message) =>\n this.#storageKeyCache[message] ?? null,\n setStorageKey: async (message, key) => {\n this.#storageKeyCache[message] = key;\n },\n },\n },\n );\n\n this.#keyringController.setupLockedStateSubscriptions();\n this.#registerMessageHandlers();\n this.#nativeScryptCrypto = nativeScryptCrypto;\n\n // Account Syncing\n setupAccountSyncingSubscriptions({\n getUserStorageControllerInstance: () => this,\n getMessenger: () => this.messagingSystem,\n });\n\n // Network Syncing\n if (this.#env.isNetworkSyncingEnabled) {\n startNetworkSyncing({\n messenger,\n getUserStorageControllerInstance: () => this,\n isMutationSyncBlocked: () =>\n !this.state.hasNetworkSyncingSyncedAtLeastOnce,\n });\n }\n }\n\n /**\n * Constructor helper for registering this controller's messaging system\n * actions.\n */\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performGetStorage',\n this.performGetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performGetStorageAllFeatureEntries',\n this.performGetStorageAllFeatureEntries.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performSetStorage',\n this.performSetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performBatchSetStorage',\n this.performBatchSetStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performDeleteStorage',\n this.performDeleteStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:performBatchDeleteStorage',\n this.performBatchDeleteStorage.bind(this),\n );\n\n this.messagingSystem.registerActionHandler(\n 'UserStorageController:getStorageKey',\n this.getStorageKey.bind(this),\n );\n }\n\n /**\n * Allows retrieval of stored data. Data stored is string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @returns the decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorage(\n path: UserStoragePathWithFeatureAndKey,\n ): Promise<string | null> {\n return await this.#userStorage.getItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @returns the array of decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorageAllFeatureEntries(\n path: UserStoragePathWithFeatureOnly,\n ): Promise<string[] | null> {\n return await this.#userStorage.getAllFeatureItems(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows storage of user data. Data stored must be string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param value - The string data you want to store.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performSetStorage(\n path: UserStoragePathWithFeatureAndKey,\n value: string,\n ): Promise<void> {\n return await this.#userStorage.setItem(path, value, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchSetStorage<\n FeatureName extends UserStoragePathWithFeatureOnly,\n >(\n path: FeatureName,\n values: [UserStorageFeatureKeys<FeatureName>, string][],\n ): Promise<void> {\n return await this.#userStorage.batchSetItems(path, values, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorage(\n path: UserStoragePathWithFeatureAndKey,\n ): Promise<void> {\n return await this.#userStorage.deleteItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n validateAgainstSchema: true,\n });\n }\n\n /**\n * Allows deletion of all user data entries for a specific feature.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorageAllFeatureEntries(\n path: UserStoragePathWithFeatureOnly,\n ): Promise<void> {\n return await this.#userStorage.deleteAllFeatureItems(path);\n }\n\n /**\n * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of entryKey[]\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchDeleteStorage<\n FeatureName extends UserStoragePathWithFeatureOnly,\n >(\n path: FeatureName,\n values: UserStorageFeatureKeys<FeatureName>[],\n ): Promise<void> {\n return await this.#userStorage.batchDeleteItems(path, values);\n }\n\n /**\n * Retrieves the storage key, for internal use only!\n *\n * @returns the storage key\n */\n public async getStorageKey(): Promise<string> {\n return await this.#userStorage.getStorageKey();\n }\n\n /**\n * Flushes the storage key cache.\n * CAUTION: This is only public for testing purposes.\n * It should not be used in production code.\n */\n public flushStorageKeyCache(): void {\n this.#storageKeyCache = {};\n }\n\n #_snapSignMessageCache: Record<`metamask:${string}`, string> = {};\n\n /**\n * Signs a specific message using an underlying auth snap.\n *\n * @param message - A specific tagged message to sign.\n * @returns A Signature created by the snap.\n */\n async #snapSignMessage(message: `metamask:${string}`): Promise<string> {\n if (this.#_snapSignMessageCache[message]) {\n return this.#_snapSignMessageCache[message];\n }\n\n if (!this.#isUnlocked) {\n throw new Error(\n '#snapSignMessage - unable to call snap, wallet is locked',\n );\n }\n\n const result = (await this.messagingSystem.call(\n 'SnapController:handleRequest',\n createSnapSignMessageRequest(message),\n )) as string;\n\n this.#_snapSignMessageCache[message] = result;\n\n return result;\n }\n\n public async setIsBackupAndSyncFeatureEnabled(\n feature: keyof typeof BACKUPANDSYNC_FEATURES,\n enabled: boolean,\n ): Promise<void> {\n try {\n this.#setIsBackupAndSyncUpdateLoading(true);\n\n if (enabled) {\n // If any of the features are enabled, we need to ensure the user is signed in\n const isSignedIn = this.#auth.isSignedIn();\n if (!isSignedIn) {\n await this.#auth.signIn();\n }\n }\n\n this.update((state) => {\n if (feature === BACKUPANDSYNC_FEATURES.main) {\n state.isBackupAndSyncEnabled = enabled;\n }\n\n if (feature === BACKUPANDSYNC_FEATURES.accountSyncing) {\n state.isAccountSyncingEnabled = enabled;\n }\n });\n } catch (e) {\n // istanbul ignore next\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n // istanbul ignore next\n throw new Error(\n `${controllerName} - failed to ${enabled ? 'enable' : 'disable'} ${feature} - ${errorMessage}`,\n );\n } finally {\n this.#setIsBackupAndSyncUpdateLoading(false);\n }\n }\n\n #setIsBackupAndSyncUpdateLoading(\n isBackupAndSyncUpdateLoading: boolean,\n ): void {\n this.update((state) => {\n state.isBackupAndSyncUpdateLoading = isBackupAndSyncUpdateLoading;\n });\n }\n\n async setHasAccountSyncingSyncedAtLeastOnce(\n hasAccountSyncingSyncedAtLeastOnce: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.hasAccountSyncingSyncedAtLeastOnce =\n hasAccountSyncingSyncedAtLeastOnce;\n });\n }\n\n async setIsAccountSyncingReadyToBeDispatched(\n isAccountSyncingReadyToBeDispatched: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isAccountSyncingReadyToBeDispatched =\n isAccountSyncingReadyToBeDispatched;\n });\n }\n\n async setIsAccountSyncingInProgress(\n isAccountSyncingInProgress: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isAccountSyncingInProgress = isAccountSyncingInProgress;\n });\n }\n\n /**\n * Syncs the internal accounts list with the user storage accounts list.\n * This method is used to make sure that the internal accounts list is up-to-date with the user storage accounts list and vice-versa.\n * It will add new accounts to the internal accounts list, update/merge conflicting names and re-upload the results in some cases to the user storage.\n */\n async syncInternalAccountsWithUserStorage(): Promise<void> {\n const profileId = await this.#auth.getProfileId();\n\n await syncInternalAccountsWithUserStorage(\n {\n maxNumberOfAccountsToAdd:\n this.#config?.accountSyncing?.maxNumberOfAccountsToAdd,\n onAccountAdded: () =>\n this.#config?.accountSyncing?.onAccountAdded?.(profileId),\n onAccountNameUpdated: () =>\n this.#config?.accountSyncing?.onAccountNameUpdated?.(profileId),\n onAccountSyncErroneousSituation: (situationMessage, sentryContext) =>\n this.#config?.accountSyncing?.onAccountSyncErroneousSituation?.(\n profileId,\n situationMessage,\n sentryContext,\n ),\n },\n {\n getMessenger: () => this.messagingSystem,\n getUserStorageControllerInstance: () => this,\n },\n );\n }\n\n /**\n * Saves an individual internal account to the user storage.\n *\n * @param internalAccount - The internal account to save\n */\n async saveInternalAccountToUserStorage(\n internalAccount: InternalAccount,\n ): Promise<void> {\n await saveInternalAccountToUserStorage(internalAccount, {\n getMessenger: () => this.messagingSystem,\n getUserStorageControllerInstance: () => this,\n });\n }\n\n async syncNetworks() {\n if (!this.#env.isNetworkSyncingEnabled) {\n return;\n }\n\n const profileId = await this.#auth.getProfileId();\n\n await performMainNetworkSync({\n messenger: this.messagingSystem,\n getUserStorageControllerInstance: () => this,\n maxNetworksToAdd: this.#config?.networkSyncing?.maxNumberOfNetworksToAdd,\n onNetworkAdded: (cId) =>\n this.#config?.networkSyncing?.onNetworkAdded?.(profileId, cId),\n onNetworkUpdated: (cId) =>\n this.#config?.networkSyncing?.onNetworkUpdated?.(profileId, cId),\n onNetworkRemoved: (cId) =>\n this.#config?.networkSyncing?.onNetworkRemoved?.(profileId, cId),\n });\n\n this.update((s) => {\n s.hasNetworkSyncingSyncedAtLeastOnce = true;\n });\n }\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerAccountAddedEvent } from "@metamask/accounts-controller";
2
- import type { AddressBookControllerContactUpdatedEvent, AddressBookControllerContactDeletedEvent, AddressBookControllerActions, AddressBookControllerListAction, AddressBookControllerSetAction, AddressBookControllerDeleteAction } from "@metamask/address-book-controller";
3
2
  import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
4
3
  import { BaseController } from "@metamask/base-controller";
5
4
  import { type KeyringControllerGetStateAction, type KeyringControllerLockEvent, type KeyringControllerUnlockEvent, type KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
@@ -25,14 +24,6 @@ export type UserStorageControllerState = {
25
24
  * Condition used by UI to determine if account syncing is enabled.
26
25
  */
27
26
  isAccountSyncingEnabled: boolean;
28
- /**
29
- * Condition used by UI to determine if contact syncing is enabled.
30
- */
31
- isContactSyncingEnabled: boolean;
32
- /**
33
- * Condition used by UI to determine if contact syncing is in progress.
34
- */
35
- isContactSyncingInProgress: boolean;
36
27
  /**
37
28
  * Condition used to determine if account syncing has been dispatched at least once.
38
29
  * This is used for event listeners to determine if they should be triggered.
@@ -72,23 +63,6 @@ type ControllerConfig = {
72
63
  */
73
64
  onAccountSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
74
65
  };
75
- contactSyncing?: {
76
- /**
77
- * Callback that fires when contact sync updates a contact.
78
- * This is used for analytics.
79
- */
80
- onContactUpdated?: (profileId: string) => void;
81
- /**
82
- * Callback that fires when contact sync deletes a contact.
83
- * This is used for analytics.
84
- */
85
- onContactDeleted?: (profileId: string) => void;
86
- /**
87
- * Callback that fires when an erroneous situation happens during contact sync.
88
- * This is used for analytics.
89
- */
90
- onContactSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
91
- };
92
66
  networkSyncing?: {
93
67
  maxNumberOfNetworksToAdd?: number;
94
68
  /**
@@ -133,10 +107,10 @@ export type UserStorageControllerPerformBatchSetStorage = ActionsObj['performBat
133
107
  export type UserStorageControllerPerformDeleteStorage = ActionsObj['performDeleteStorage'];
134
108
  export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage'];
135
109
  export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
136
- export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction | AddressBookControllerListAction | AddressBookControllerSetAction | AddressBookControllerDeleteAction | AddressBookControllerActions;
110
+ export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
137
111
  export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
138
112
  export type Events = UserStorageControllerStateChangeEvent;
139
- export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent | AddressBookControllerContactUpdatedEvent | AddressBookControllerContactDeletedEvent;
113
+ export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent;
140
114
  export type UserStorageControllerMessenger = RestrictedMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
141
115
  /**
142
116
  * Reusable controller that allows any team to store synchronized data for a given user.
@@ -231,12 +205,6 @@ export default class UserStorageController extends BaseController<typeof control
231
205
  setHasAccountSyncingSyncedAtLeastOnce(hasAccountSyncingSyncedAtLeastOnce: boolean): Promise<void>;
232
206
  setIsAccountSyncingReadyToBeDispatched(isAccountSyncingReadyToBeDispatched: boolean): Promise<void>;
233
207
  setIsAccountSyncingInProgress(isAccountSyncingInProgress: boolean): Promise<void>;
234
- /**
235
- * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
236
- *
237
- * @param isContactSyncingInProgress - Whether contact syncing is in progress
238
- */
239
- setIsContactSyncingInProgress(isContactSyncingInProgress: boolean): Promise<void>;
240
208
  /**
241
209
  * Syncs the internal accounts list with the user storage accounts list.
242
210
  * This method is used to make sure that the internal accounts list is up-to-date with the user storage accounts list and vice-versa.
@@ -250,12 +218,6 @@ export default class UserStorageController extends BaseController<typeof control
250
218
  */
251
219
  saveInternalAccountToUserStorage(internalAccount: InternalAccount): Promise<void>;
252
220
  syncNetworks(): Promise<void>;
253
- /**
254
- * Syncs the address book list with the user storage address book list.
255
- * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.
256
- * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.
257
- */
258
- syncContactsWithUserStorage(): Promise<void>;
259
221
  }
260
222
  export {};
261
223
  //# sourceMappingURL=UserStorageController.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserStorageController.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAC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AAO,GAClC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IACG,mCAAmC,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB1D;;;;OAIG;IACG,gCAAgC,CACpC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,IAAI,CAAC;IAOV,YAAY;IAwBlB;;;;OAIG;IACG,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;CA8CnD"}
1
+ {"version":3,"file":"UserStorageController.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,mCAAmC,EACpC,sCAAsC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EAEpB,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACxC,qCAAqC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,oCAAoC,EACpC,oCAAoC,EACrC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAOrE,OAAO,EAAE,sBAAsB,EAAE,wBAAoB;AAMrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAoC;AAC1E,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,wCAAoC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,0CAAsC;AAElE,OAAO,KAAK,EACV,sCAAsC,EACtC,yCAAyC,EACzC,kCAAkC,EAClC,qCAAqC,EACtC,uDAAmD;AAEpD,QAAA,MAAM,cAAc,0BAA0B,CAAC;AAG/C,MAAM,MAAM,0BAA0B,GAAG;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AAE,WAAW,EACjB,MAAM,EAAE,CAAC,sBAAsB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,GACtD,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;;OAKG;IACU,oBAAoB,CAC/B,IAAI,EAAE,gCAAgC,GACrC,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;;;OAMG;IACU,qCAAqC,CAChD,IAAI,EAAE,8BAA8B,GACnC,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;;;OAOG;IACU,yBAAyB,CACpC,WAAW,SAAS,8BAA8B,EAElD,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,EAAE,GAC5C,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7C;;;;OAIG;IACI,oBAAoB,IAAI,IAAI;IAiCtB,gCAAgC,CAC3C,OAAO,EAAE,MAAM,OAAO,sBAAsB,EAC5C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IAyCV,qCAAqC,CACzC,kCAAkC,EAAE,OAAO,GAC1C,OAAO,CAAC,IAAI,CAAC;IAOV,sCAAsC,CAC1C,mCAAmC,EAAE,OAAO,GAC3C,OAAO,CAAC,IAAI,CAAC;IAOV,6BAA6B,CACjC,0BAA0B,EAAE,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IACG,mCAAmC,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB1D;;;;OAIG;IACG,gCAAgC,CACpC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,IAAI,CAAC;IAOV,YAAY;CAuBnB"}
@@ -1,5 +1,4 @@
1
1
  import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerAccountRenamedEvent, AccountsControllerAccountAddedEvent } from "@metamask/accounts-controller";
2
- import type { AddressBookControllerContactUpdatedEvent, AddressBookControllerContactDeletedEvent, AddressBookControllerActions, AddressBookControllerListAction, AddressBookControllerSetAction, AddressBookControllerDeleteAction } from "@metamask/address-book-controller";
3
2
  import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
4
3
  import { BaseController } from "@metamask/base-controller";
5
4
  import { type KeyringControllerGetStateAction, type KeyringControllerLockEvent, type KeyringControllerUnlockEvent, type KeyringControllerWithKeyringAction } from "@metamask/keyring-controller";
@@ -25,14 +24,6 @@ export type UserStorageControllerState = {
25
24
  * Condition used by UI to determine if account syncing is enabled.
26
25
  */
27
26
  isAccountSyncingEnabled: boolean;
28
- /**
29
- * Condition used by UI to determine if contact syncing is enabled.
30
- */
31
- isContactSyncingEnabled: boolean;
32
- /**
33
- * Condition used by UI to determine if contact syncing is in progress.
34
- */
35
- isContactSyncingInProgress: boolean;
36
27
  /**
37
28
  * Condition used to determine if account syncing has been dispatched at least once.
38
29
  * This is used for event listeners to determine if they should be triggered.
@@ -72,23 +63,6 @@ type ControllerConfig = {
72
63
  */
73
64
  onAccountSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
74
65
  };
75
- contactSyncing?: {
76
- /**
77
- * Callback that fires when contact sync updates a contact.
78
- * This is used for analytics.
79
- */
80
- onContactUpdated?: (profileId: string) => void;
81
- /**
82
- * Callback that fires when contact sync deletes a contact.
83
- * This is used for analytics.
84
- */
85
- onContactDeleted?: (profileId: string) => void;
86
- /**
87
- * Callback that fires when an erroneous situation happens during contact sync.
88
- * This is used for analytics.
89
- */
90
- onContactSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
91
- };
92
66
  networkSyncing?: {
93
67
  maxNumberOfNetworksToAdd?: number;
94
68
  /**
@@ -133,10 +107,10 @@ export type UserStorageControllerPerformBatchSetStorage = ActionsObj['performBat
133
107
  export type UserStorageControllerPerformDeleteStorage = ActionsObj['performDeleteStorage'];
134
108
  export type UserStorageControllerPerformBatchDeleteStorage = ActionsObj['performBatchDeleteStorage'];
135
109
  export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
136
- export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction | AddressBookControllerListAction | AddressBookControllerSetAction | AddressBookControllerDeleteAction | AddressBookControllerActions;
110
+ export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AccountsControllerListAccountsAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerWithKeyringAction | NetworkControllerGetStateAction | NetworkControllerAddNetworkAction | NetworkControllerRemoveNetworkAction | NetworkControllerUpdateNetworkAction;
137
111
  export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
138
112
  export type Events = UserStorageControllerStateChangeEvent;
139
- export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent | AddressBookControllerContactUpdatedEvent | AddressBookControllerContactDeletedEvent;
113
+ export type AllowedEvents = UserStorageControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | AccountsControllerAccountAddedEvent | AccountsControllerAccountRenamedEvent | NetworkControllerNetworkRemovedEvent;
140
114
  export type UserStorageControllerMessenger = RestrictedMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
141
115
  /**
142
116
  * Reusable controller that allows any team to store synchronized data for a given user.
@@ -231,12 +205,6 @@ export default class UserStorageController extends BaseController<typeof control
231
205
  setHasAccountSyncingSyncedAtLeastOnce(hasAccountSyncingSyncedAtLeastOnce: boolean): Promise<void>;
232
206
  setIsAccountSyncingReadyToBeDispatched(isAccountSyncingReadyToBeDispatched: boolean): Promise<void>;
233
207
  setIsAccountSyncingInProgress(isAccountSyncingInProgress: boolean): Promise<void>;
234
- /**
235
- * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
236
- *
237
- * @param isContactSyncingInProgress - Whether contact syncing is in progress
238
- */
239
- setIsContactSyncingInProgress(isContactSyncingInProgress: boolean): Promise<void>;
240
208
  /**
241
209
  * Syncs the internal accounts list with the user storage accounts list.
242
210
  * This method is used to make sure that the internal accounts list is up-to-date with the user storage accounts list and vice-versa.
@@ -250,12 +218,6 @@ export default class UserStorageController extends BaseController<typeof control
250
218
  */
251
219
  saveInternalAccountToUserStorage(internalAccount: InternalAccount): Promise<void>;
252
220
  syncNetworks(): Promise<void>;
253
- /**
254
- * Syncs the address book list with the user storage address book list.
255
- * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.
256
- * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.
257
- */
258
- syncContactsWithUserStorage(): Promise<void>;
259
221
  }
260
222
  export {};
261
223
  //# sourceMappingURL=UserStorageController.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserStorageController.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,mCAAmC,EACpC,sCAAsC;AACvC,OAAO,KAAK,EACV,wCAAwC,EACxC,wCAAwC,EACxC,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EAClC,0CAA0C;AAC3C,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,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AI,CAAC;CA8CnD"}
1
+ {"version":3,"file":"UserStorageController.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,qCAAqC,EACrC,mCAAmC,EACpC,sCAAsC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EAEpB,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,kCAAkC,EACxC,qCAAqC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,oCAAoC,EACpC,oCAAoC,EACrC,qCAAqC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAOrE,OAAO,EAAE,sBAAsB,EAAE,wBAAoB;AAMrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAoC;AAC1E,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,wCAAoC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,0CAAsC;AAElE,OAAO,KAAK,EACV,sCAAsC,EACtC,yCAAyC,EACzC,kCAAkC,EAClC,qCAAqC,EACtC,uDAAmD;AAEpD,QAAA,MAAM,cAAc,0BAA0B,CAAC;AAG/C,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,4BAA4B,EAAE,OAAO,CAAC;IACtC;;OAEG;IACH,uBAAuB,EAAE,OAAO,CAAC;IACjC;;;;OAIG;IACH,kCAAkC,EAAE,OAAO,CAAC;IAC5C;;OAEG;IACH,mCAAmC,EAAE,OAAO,CAAC;IAC7C;;OAEG;IACH,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