@metamask-previews/profile-sync-controller 28.3.0-preview-ec4680201 → 28.3.0-preview-40d5fb1e2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.cjs +9 -9
- package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
- package/dist/controllers/authentication/index.cjs +3 -3
- package/dist/controllers/authentication/index.cjs.map +1 -1
- package/dist/controllers/authentication/index.d.cts.map +1 -1
- package/dist/controllers/authentication/index.d.mts.map +1 -1
- package/dist/controllers/authentication/index.mjs.map +1 -1
- package/dist/controllers/authentication/mocks/index.cjs.map +1 -1
- package/dist/controllers/authentication/mocks/index.d.cts.map +1 -1
- package/dist/controllers/authentication/mocks/index.d.mts.map +1 -1
- package/dist/controllers/authentication/mocks/index.mjs.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.cjs +12 -12
- package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
- package/dist/controllers/index.cjs.map +1 -1
- package/dist/controllers/index.d.cts.map +1 -1
- package/dist/controllers/index.d.mts.map +1 -1
- package/dist/controllers/index.mjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.d.mts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController-method-action-types.mjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +15 -15
- package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +23 -23
- package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +9 -9
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/types.cjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/types.mjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/utils.cjs +2 -2
- package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +1 -1
- package/dist/controllers/user-storage/index.cjs +3 -3
- package/dist/controllers/user-storage/index.cjs.map +1 -1
- package/dist/controllers/user-storage/index.d.cts.map +1 -1
- package/dist/controllers/user-storage/index.d.mts.map +1 -1
- package/dist/controllers/user-storage/index.mjs.map +1 -1
- package/dist/controllers/user-storage/mocks/index.cjs.map +1 -1
- package/dist/controllers/user-storage/mocks/index.d.cts.map +1 -1
- package/dist/controllers/user-storage/mocks/index.d.mts.map +1 -1
- package/dist/controllers/user-storage/mocks/index.mjs.map +1 -1
- package/dist/controllers/user-storage/mocks/mockResponses.cjs +15 -15
- package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -1
- package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -1
- package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -1
- package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -1
- package/dist/controllers/user-storage/mocks/mockStorage.cjs +3 -3
- package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +1 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +1 -1
- package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +1 -1
- package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +1 -1
- package/dist/controllers/user-storage/types.cjs.map +1 -1
- package/dist/controllers/user-storage/types.d.cts.map +1 -1
- package/dist/controllers/user-storage/types.d.mts.map +1 -1
- package/dist/controllers/user-storage/types.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +11 -11
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +22 -22
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs +37 -37
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +2 -2
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +1 -1
- package/dist/sdk/authentication.cjs +21 -21
- package/dist/sdk/authentication.cjs.map +1 -1
- package/dist/sdk/authentication.d.cts.map +1 -1
- package/dist/sdk/authentication.d.mts.map +1 -1
- package/dist/sdk/authentication.mjs.map +1 -1
- package/dist/sdk/errors.cjs +3 -3
- package/dist/sdk/errors.cjs.map +1 -1
- package/dist/sdk/errors.mjs.map +1 -1
- package/dist/sdk/index.cjs.map +1 -1
- package/dist/sdk/index.d.cts.map +1 -1
- package/dist/sdk/index.d.mts.map +1 -1
- package/dist/sdk/index.mjs.map +1 -1
- package/dist/sdk/mocks/auth.cjs +12 -12
- package/dist/sdk/mocks/auth.cjs.map +1 -1
- package/dist/sdk/mocks/auth.d.cts.map +1 -1
- package/dist/sdk/mocks/auth.d.mts.map +1 -1
- package/dist/sdk/mocks/auth.mjs.map +1 -1
- package/dist/sdk/mocks/userstorage.cjs +8 -8
- package/dist/sdk/mocks/userstorage.cjs.map +1 -1
- package/dist/sdk/mocks/userstorage.mjs.map +1 -1
- package/dist/sdk/user-storage.cjs +32 -32
- package/dist/sdk/user-storage.cjs.map +1 -1
- package/dist/sdk/user-storage.d.cts.map +1 -1
- package/dist/sdk/user-storage.d.mts.map +1 -1
- package/dist/sdk/user-storage.mjs +1 -1
- package/dist/sdk/user-storage.mjs.map +1 -1
- package/dist/sdk/utils/validate-login-response.cjs.map +1 -1
- package/dist/sdk/utils/validate-login-response.d.cts.map +1 -1
- package/dist/sdk/utils/validate-login-response.d.mts.map +1 -1
- package/dist/sdk/utils/validate-login-response.mjs.map +1 -1
- package/dist/shared/encryption/cache.cjs +6 -6
- package/dist/shared/encryption/cache.cjs.map +1 -1
- package/dist/shared/encryption/cache.mjs.map +1 -1
- package/dist/shared/encryption/encryption.cjs +26 -26
- package/dist/shared/encryption/encryption.cjs.map +1 -1
- package/dist/shared/encryption/encryption.d.cts.map +1 -1
- package/dist/shared/encryption/encryption.d.mts.map +1 -1
- package/dist/shared/encryption/encryption.mjs.map +1 -1
- package/dist/shared/encryption/index.cjs +3 -3
- package/dist/shared/encryption/index.cjs.map +1 -1
- package/dist/shared/encryption/index.d.cts.map +1 -1
- package/dist/shared/encryption/index.d.mts.map +1 -1
- package/dist/shared/encryption/index.mjs.map +1 -1
- package/dist/shared/storage-schema.cjs +2 -2
- package/dist/shared/storage-schema.cjs.map +1 -1
- package/dist/shared/storage-schema.mjs.map +1 -1
- package/dist/shared/types/services.cjs.map +1 -1
- package/dist/shared/types/services.d.cts.map +1 -1
- package/dist/shared/types/services.d.mts.map +1 -1
- package/dist/shared/types/services.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupContactSyncingSubscriptions = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const controller_integration_1 = require("./controller-integration.cjs");
|
|
5
|
+
const sync_utils_1 = require("./sync-utils.cjs");
|
|
6
|
+
const utils_1 = require("./utils.cjs");
|
|
7
7
|
/**
|
|
8
8
|
* Initialize and setup events to listen to for contact syncing
|
|
9
9
|
*
|
|
@@ -15,13 +15,13 @@ function setupContactSyncingSubscriptions(options) {
|
|
|
15
15
|
getMessenger().subscribe('AddressBookController:contactUpdated', (contactEntry) => {
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
17
17
|
(async () => {
|
|
18
|
-
if (!(0,
|
|
19
|
-
(0,
|
|
18
|
+
if (!(0, sync_utils_1.canPerformContactSyncing)(options) ||
|
|
19
|
+
(0, utils_1.isContactBridgedFromAccounts)(contactEntry)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
try {
|
|
23
23
|
// Use the targeted method to update just this contact
|
|
24
|
-
await (0,
|
|
24
|
+
await (0, controller_integration_1.updateContactInRemoteStorage)(contactEntry, options);
|
|
25
25
|
}
|
|
26
26
|
catch (error) {
|
|
27
27
|
console.error('Error updating contact in remote storage:', error);
|
|
@@ -32,13 +32,13 @@ function setupContactSyncingSubscriptions(options) {
|
|
|
32
32
|
getMessenger().subscribe('AddressBookController:contactDeleted', (contactEntry) => {
|
|
33
33
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
34
34
|
(async () => {
|
|
35
|
-
if (!(0,
|
|
36
|
-
(0,
|
|
35
|
+
if (!(0, sync_utils_1.canPerformContactSyncing)(options) ||
|
|
36
|
+
(0, utils_1.isContactBridgedFromAccounts)(contactEntry)) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
try {
|
|
40
40
|
// Use the targeted method to delete just this contact
|
|
41
|
-
await (0,
|
|
41
|
+
await (0, controller_integration_1.deleteContactInRemoteStorage)(contactEntry, options);
|
|
42
42
|
}
|
|
43
43
|
catch (error) {
|
|
44
44
|
console.error('Error deleting contact from remote storage:', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-subscriptions.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"setup-subscriptions.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":";;;AAEA,yEAGkC;AAClC,iDAAwD;AAExD,uCAAuD;AAEvD;;;;GAIG;AACH,SAAgB,gCAAgC,CAC9C,OAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAEjC,yEAAyE;IACzE,YAAY,EAAE,CAAC,SAAS,CACtB,sCAAsC,EACtC,CAAC,YAA8B,EAAE,EAAE;QACjC,mEAAmE;QACnE,CAAC,KAAK,IAAI,EAAE;YACV,IACE,CAAC,IAAA,qCAAwB,EAAC,OAAO,CAAC;gBAClC,IAAA,oCAA4B,EAAC,YAAY,CAAC,EAC1C,CAAC;gBACD,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,sDAAsD;gBACtD,MAAM,IAAA,qDAA4B,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;YACpE,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CACF,CAAC;IAEF,4EAA4E;IAC5E,YAAY,EAAE,CAAC,SAAS,CACtB,sCAAsC,EACtC,CAAC,YAA8B,EAAE,EAAE;QACjC,mEAAmE;QACnE,CAAC,KAAK,IAAI,EAAE;YACV,IACE,CAAC,IAAA,qCAAwB,EAAC,OAAO,CAAC;gBAClC,IAAA,oCAA4B,EAAC,YAAY,CAAC,EAC1C,CAAC;gBACD,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,sDAAsD;gBACtD,MAAM,IAAA,qDAA4B,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;YACtE,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CACF,CAAC;AACJ,CAAC;AAlDD,4EAkDC","sourcesContent":["import type { AddressBookEntry } from '@metamask/address-book-controller';\n\nimport {\n updateContactInRemoteStorage,\n deleteContactInRemoteStorage,\n} from './controller-integration';\nimport { canPerformContactSyncing } from './sync-utils';\nimport type { ContactSyncingOptions } from './types';\nimport { isContactBridgedFromAccounts } from './utils';\n\n/**\n * Initialize and setup events to listen to for contact syncing\n *\n * @param options - parameters used for initializing and enabling contact syncing\n */\nexport function setupContactSyncingSubscriptions(\n options: ContactSyncingOptions,\n): void {\n const { getMessenger } = options;\n\n // Listen for contact updates and immediately sync the individual contact\n getMessenger().subscribe(\n 'AddressBookController:contactUpdated',\n (contactEntry: AddressBookEntry) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (async () => {\n if (\n !canPerformContactSyncing(options) ||\n isContactBridgedFromAccounts(contactEntry)\n ) {\n return;\n }\n\n try {\n // Use the targeted method to update just this contact\n await updateContactInRemoteStorage(contactEntry, options);\n } catch (error) {\n console.error('Error updating contact in remote storage:', error);\n }\n })();\n },\n );\n\n // Listen for contact deletions and immediately sync the individual deletion\n getMessenger().subscribe(\n 'AddressBookController:contactDeleted',\n (contactEntry: AddressBookEntry) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (async () => {\n if (\n !canPerformContactSyncing(options) ||\n isContactBridgedFromAccounts(contactEntry)\n ) {\n return;\n }\n\n try {\n // Use the targeted method to delete just this contact\n await deleteContactInRemoteStorage(contactEntry, options);\n } catch (error) {\n console.error('Error deleting contact from remote storage:', error);\n }\n })();\n },\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-subscriptions.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"setup-subscriptions.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAgB;AAGrD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,qBAAqB,GAC7B,IAAI,CAgDN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-subscriptions.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"setup-subscriptions.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAgB;AAGrD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,qBAAqB,GAC7B,IAAI,CAgDN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-subscriptions.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,
|
|
1
|
+
{"version":3,"file":"setup-subscriptions.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/setup-subscriptions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,qCAAiC;AAClC,OAAO,EAAE,wBAAwB,EAAE,yBAAqB;AAExD,OAAO,EAAE,4BAA4B,EAAE,oBAAgB;AAEvD;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,OAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAEjC,yEAAyE;IACzE,YAAY,EAAE,CAAC,SAAS,CACtB,sCAAsC,EACtC,CAAC,YAA8B,EAAE,EAAE;QACjC,mEAAmE;QACnE,CAAC,KAAK,IAAI,EAAE;YACV,IACE,CAAC,wBAAwB,CAAC,OAAO,CAAC;gBAClC,4BAA4B,CAAC,YAAY,CAAC,EAC1C,CAAC;gBACD,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,sDAAsD;gBACtD,MAAM,4BAA4B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;YACpE,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CACF,CAAC;IAEF,4EAA4E;IAC5E,YAAY,EAAE,CAAC,SAAS,CACtB,sCAAsC,EACtC,CAAC,YAA8B,EAAE,EAAE;QACjC,mEAAmE;QACnE,CAAC,KAAK,IAAI,EAAE;YACV,IACE,CAAC,wBAAwB,CAAC,OAAO,CAAC;gBAClC,4BAA4B,CAAC,YAAY,CAAC,EAC1C,CAAC;gBACD,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,sDAAsD;gBACtD,MAAM,4BAA4B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;YACtE,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AddressBookEntry } from '@metamask/address-book-controller';\n\nimport {\n updateContactInRemoteStorage,\n deleteContactInRemoteStorage,\n} from './controller-integration';\nimport { canPerformContactSyncing } from './sync-utils';\nimport type { ContactSyncingOptions } from './types';\nimport { isContactBridgedFromAccounts } from './utils';\n\n/**\n * Initialize and setup events to listen to for contact syncing\n *\n * @param options - parameters used for initializing and enabling contact syncing\n */\nexport function setupContactSyncingSubscriptions(\n options: ContactSyncingOptions,\n): void {\n const { getMessenger } = options;\n\n // Listen for contact updates and immediately sync the individual contact\n getMessenger().subscribe(\n 'AddressBookController:contactUpdated',\n (contactEntry: AddressBookEntry) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (async () => {\n if (\n !canPerformContactSyncing(options) ||\n isContactBridgedFromAccounts(contactEntry)\n ) {\n return;\n }\n\n try {\n // Use the targeted method to update just this contact\n await updateContactInRemoteStorage(contactEntry, options);\n } catch (error) {\n console.error('Error updating contact in remote storage:', error);\n }\n })();\n },\n );\n\n // Listen for contact deletions and immediately sync the individual deletion\n getMessenger().subscribe(\n 'AddressBookController:contactDeleted',\n (contactEntry: AddressBookEntry) => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (async () => {\n if (\n !canPerformContactSyncing(options) ||\n isContactBridgedFromAccounts(contactEntry)\n ) {\n return;\n }\n\n try {\n // Use the targeted method to delete just this contact\n await deleteContactInRemoteStorage(contactEntry, options);\n } catch (error) {\n console.error('Error deleting contact from remote storage:', error);\n }\n })();\n },\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-utils.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,OAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC;IAEnE,MAAM,EACJ,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,GAC3B,GAAG,gCAAgC,EAAE,CAAC,KAAK,CAAC;IAC7C,MAAM,aAAa,GAAG,YAAY,EAAE,CAAC,IAAI,CACvC,qCAAqC,CACtC,CAAC;IAEF,IACE,CAAC,sBAAsB;QACvB,CAAC,uBAAuB;QACxB,0BAA0B;QAC1B,CAAC,aAAa,EACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAxBD,4DAwBC","sourcesContent":["import type { ContactSyncingOptions } from './types
|
|
1
|
+
{"version":3,"file":"sync-utils.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,OAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC;IAEnE,MAAM,EACJ,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,GAC3B,GAAG,gCAAgC,EAAE,CAAC,KAAK,CAAC;IAC7C,MAAM,aAAa,GAAG,YAAY,EAAE,CAAC,IAAI,CACvC,qCAAqC,CACtC,CAAC;IAEF,IACE,CAAC,sBAAsB;QACvB,CAAC,uBAAuB;QACxB,0BAA0B;QAC1B,CAAC,aAAa,EACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAxBD,4DAwBC","sourcesContent":["import type { ContactSyncingOptions } from './types';\n\n/**\n * Check if we can perform contact syncing\n *\n * @param options - parameters used for checking if we can perform contact syncing\n * @returns whether we can perform contact syncing\n */\nexport function canPerformContactSyncing(\n options: ContactSyncingOptions,\n): boolean {\n const { getMessenger, getUserStorageControllerInstance } = options;\n\n const {\n isBackupAndSyncEnabled,\n isContactSyncingEnabled,\n isContactSyncingInProgress,\n } = getUserStorageControllerInstance().state;\n const isAuthEnabled = getMessenger().call(\n 'AuthenticationController:isSignedIn',\n );\n\n if (\n !isBackupAndSyncEnabled ||\n !isContactSyncingEnabled ||\n isContactSyncingInProgress ||\n !isAuthEnabled\n ) {\n return false;\n }\n\n return true;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-utils.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"sync-utils.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAgB;AAErD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAsBT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-utils.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"sync-utils.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAgB;AAErD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAsBT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-utils.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC;IAEnE,MAAM,EACJ,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,GAC3B,GAAG,gCAAgC,EAAE,CAAC,KAAK,CAAC;IAC7C,MAAM,aAAa,GAAG,YAAY,EAAE,CAAC,IAAI,CACvC,qCAAqC,CACtC,CAAC;IAEF,IACE,CAAC,sBAAsB;QACvB,CAAC,uBAAuB;QACxB,0BAA0B;QAC1B,CAAC,aAAa,EACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ContactSyncingOptions } from './types
|
|
1
|
+
{"version":3,"file":"sync-utils.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/sync-utils.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC;IAEnE,MAAM,EACJ,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,GAC3B,GAAG,gCAAgC,EAAE,CAAC,KAAK,CAAC;IAC7C,MAAM,aAAa,GAAG,YAAY,EAAE,CAAC,IAAI,CACvC,qCAAqC,CACtC,CAAC;IAEF,IACE,CAAC,sBAAsB;QACvB,CAAC,uBAAuB;QACxB,0BAA0B;QAC1B,CAAC,aAAa,EACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ContactSyncingOptions } from './types';\n\n/**\n * Check if we can perform contact syncing\n *\n * @param options - parameters used for checking if we can perform contact syncing\n * @returns whether we can perform contact syncing\n */\nexport function canPerformContactSyncing(\n options: ContactSyncingOptions,\n): boolean {\n const { getMessenger, getUserStorageControllerInstance } = options;\n\n const {\n isBackupAndSyncEnabled,\n isContactSyncingEnabled,\n isContactSyncingInProgress,\n } = getUserStorageControllerInstance().state;\n const isAuthEnabled = getMessenger().call(\n 'AuthenticationController:isSignedIn',\n );\n\n if (\n !isBackupAndSyncEnabled ||\n !isContactSyncingEnabled ||\n isContactSyncingInProgress ||\n !isAuthEnabled\n ) {\n return false;\n }\n\n return true;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceCallback } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport type { UserStorageControllerMessenger } from '../UserStorageController
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceCallback } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport type { UserStorageControllerMessenger } from '../UserStorageController';\nimport type { UserStorageController } from '../UserStorageController';\nimport type {\n USER_STORAGE_VERSION_KEY,\n USER_STORAGE_VERSION,\n} from './constants';\n\nexport type UserStorageContactEntry = {\n /**\n * The Version 'v' of the User Storage.\n * NOTE - will allow us to support upgrade/downgrades in the future\n */\n [USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;\n /** the address 'a' of the contact */\n a: string;\n /** the name 'n' of the contact */\n n: string;\n /** the chainId 'c' of the contact */\n c: Hex;\n /** the memo 'm' of the contact (optional) */\n m?: string;\n /** the addressType 't' of the contact (optional) */\n t?: string;\n /** the isEns flag 'e' of the contact (optional) */\n e?: boolean;\n /** the lastUpdatedAt timestamp 'lu' of the contact */\n lu?: number;\n /** the deletedAt timestamp 'dt' of the contact (optional) */\n dt?: number;\n};\n\n/**\n * Options for contact syncing operations\n */\nexport type ContactSyncingOptions = {\n getUserStorageControllerInstance: () => UserStorageController;\n getMessenger: () => UserStorageControllerMessenger;\n trace?: TraceCallback;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,qCAAiC;AACtE,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACrB,wBAAoB;AAErB,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,CAAC,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACxD,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,qCAAqC;IACrC,CAAC,EAAE,GAAG,CAAC;IACP,6CAA6C;IAC7C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;IAC9D,YAAY,EAAE,MAAM,8BAA8B,CAAC;IACnD,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAiC;AAC/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,qCAAiC;AACtE,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACrB,wBAAoB;AAErB,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,CAAC,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACxD,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,qCAAqC;IACrC,CAAC,EAAE,GAAG,CAAC;IACP,6CAA6C;IAC7C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,sDAAsD;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;IAC9D,YAAY,EAAE,MAAM,8BAA8B,CAAC;IACnD,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceCallback } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport type { UserStorageControllerMessenger } from '../UserStorageController
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TraceCallback } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport type { UserStorageControllerMessenger } from '../UserStorageController';\nimport type { UserStorageController } from '../UserStorageController';\nimport type {\n USER_STORAGE_VERSION_KEY,\n USER_STORAGE_VERSION,\n} from './constants';\n\nexport type UserStorageContactEntry = {\n /**\n * The Version 'v' of the User Storage.\n * NOTE - will allow us to support upgrade/downgrades in the future\n */\n [USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;\n /** the address 'a' of the contact */\n a: string;\n /** the name 'n' of the contact */\n n: string;\n /** the chainId 'c' of the contact */\n c: Hex;\n /** the memo 'm' of the contact (optional) */\n m?: string;\n /** the addressType 't' of the contact (optional) */\n t?: string;\n /** the isEns flag 'e' of the contact (optional) */\n e?: boolean;\n /** the lastUpdatedAt timestamp 'lu' of the contact */\n lu?: number;\n /** the deletedAt timestamp 'dt' of the contact (optional) */\n dt?: number;\n};\n\n/**\n * Options for contact syncing operations\n */\nexport type ContactSyncingOptions = {\n getUserStorageControllerInstance: () => UserStorageController;\n getMessenger: () => UserStorageControllerMessenger;\n trace?: TraceCallback;\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isContactBridgedFromAccounts = exports.mapUserStorageEntryToAddressBookEntry = exports.mapAddressBookEntryToUserStorageEntry = void 0;
|
|
4
|
-
const
|
|
4
|
+
const constants_1 = require("./constants.cjs");
|
|
5
5
|
/**
|
|
6
6
|
* Map an address book entry to a user storage address book entry
|
|
7
7
|
* Always sets a current timestamp for entries going to remote storage
|
|
@@ -13,7 +13,7 @@ const mapAddressBookEntryToUserStorageEntry = (addressBookEntry) => {
|
|
|
13
13
|
const { address, name, chainId, memo, addressType, isEns, lastUpdatedAt, deletedAt, } = addressBookEntry;
|
|
14
14
|
const now = Date.now();
|
|
15
15
|
return {
|
|
16
|
-
[
|
|
16
|
+
[constants_1.USER_STORAGE_VERSION_KEY]: constants_1.USER_STORAGE_VERSION,
|
|
17
17
|
a: address,
|
|
18
18
|
n: name,
|
|
19
19
|
c: chainId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":";;;AAKA
|
|
1
|
+
{"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":";;;AAKA,+CAA6E;AAY7E;;;;;;GAMG;AACI,MAAM,qCAAqC,GAAG,CACnD,gBAAkC,EACT,EAAE;IAC3B,MAAM,EACJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,WAAW,EACX,KAAK,EACL,aAAa,EACb,SAAS,GACV,GAAG,gBAAwC,CAAC;IAE7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEvB,OAAO;QACL,CAAC,oCAAwB,CAAC,EAAE,gCAAoB;QAChD,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,OAAO;QACV,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5B,GAAG,CAAC,WAAW,CAAC,CAAC,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AC1C,YAA8B,EACrB,EAAE;IACX,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC;AAC9C,CAAC,CAAC;AAJW,QAAA,4BAA4B,gCAIvC","sourcesContent":["import type {\n AddressBookEntry,\n AddressType,\n} from '@metamask/address-book-controller';\n\nimport { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from './constants';\nimport type { UserStorageContactEntry } from './types';\n\n/**\n * Extends AddressBookEntry with sync metadata\n * This is only used internally during the sync process and is not stored in AddressBookController\n */\nexport type SyncAddressBookEntry = AddressBookEntry & {\n lastUpdatedAt?: number;\n deletedAt?: number;\n};\n\n/**\n * Map an address book entry to a user storage address book entry\n * Always sets a current timestamp for entries going to remote storage\n *\n * @param addressBookEntry - An address book entry\n * @returns A user storage address book entry\n */\nexport const mapAddressBookEntryToUserStorageEntry = (\n addressBookEntry: AddressBookEntry,\n): UserStorageContactEntry => {\n const {\n address,\n name,\n chainId,\n memo,\n addressType,\n isEns,\n lastUpdatedAt,\n deletedAt,\n } = addressBookEntry as SyncAddressBookEntry;\n\n const now = Date.now();\n\n return {\n [USER_STORAGE_VERSION_KEY]: USER_STORAGE_VERSION,\n a: address,\n n: name,\n c: chainId,\n ...(memo ? { m: memo } : {}),\n ...(addressType ? { t: addressType } : {}),\n ...(isEns ? { e: isEns } : {}),\n lu: lastUpdatedAt || now,\n ...(deletedAt ? { dt: deletedAt } : {}),\n };\n};\n\n/**\n * Map a user storage address book entry to an address book entry\n * Preserves sync metadata from remote storage while keeping the\n * entry compatible with AddressBookController\n *\n * @param userStorageEntry - A user storage address book entry\n * @returns An address book entry with sync metadata for internal use\n */\nexport const mapUserStorageEntryToAddressBookEntry = (\n userStorageEntry: UserStorageContactEntry,\n): SyncAddressBookEntry => {\n const addressBookEntry: SyncAddressBookEntry = {\n address: userStorageEntry.a,\n name: userStorageEntry.n,\n chainId: userStorageEntry.c,\n memo: userStorageEntry.m || '',\n isEns: userStorageEntry.e || false,\n ...(userStorageEntry.t\n ? { addressType: userStorageEntry.t as AddressType }\n : {}),\n // Include remote metadata for sync operation only (not stored in AddressBookController)\n ...(userStorageEntry.dt ? { deletedAt: userStorageEntry.dt } : {}),\n ...(userStorageEntry.lu ? { lastUpdatedAt: userStorageEntry.lu } : {}),\n };\n\n return addressBookEntry;\n};\n\n/**\n * Check if a contact entry is bridged from accounts\n * Contacts with chainId \"*\" are global accounts bridged from the accounts system\n *\n * @param contactEntry - The contact entry to check\n * @returns True if the contact is bridged from accounts\n */\nexport const isContactBridgedFromAccounts = (\n contactEntry: AddressBookEntry,\n): boolean => {\n return String(contactEntry.chainId) === '*';\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEjB,0CAA0C;AAG3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEjB,0CAA0C;AAG3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAgB;AAEvD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,gBAAgB,KACjC,uBAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,uBAAuB,KACxC,oBAgBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iBACzB,gBAAgB,KAC7B,OAEF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEjB,0CAA0C;AAG3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEjB,0CAA0C;AAG3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAgB;AAEvD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,gBAAgB,KACjC,uBAyBF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,qBAC9B,uBAAuB,KACxC,oBAgBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iBACzB,gBAAgB,KAC7B,OAEF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,wBAAoB;AAY7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,gBAAkC,EACT,EAAE;IAC3B,MAAM,EACJ,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,WAAW,EACX,KA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C,CAAC,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,YAA8B,EACrB,EAAE;IACX,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import type {\n AddressBookEntry,\n AddressType,\n} from '@metamask/address-book-controller';\n\nimport { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from './constants';\nimport type { UserStorageContactEntry } from './types';\n\n/**\n * Extends AddressBookEntry with sync metadata\n * This is only used internally during the sync process and is not stored in AddressBookController\n */\nexport type SyncAddressBookEntry = AddressBookEntry & {\n lastUpdatedAt?: number;\n deletedAt?: number;\n};\n\n/**\n * Map an address book entry to a user storage address book entry\n * Always sets a current timestamp for entries going to remote storage\n *\n * @param addressBookEntry - An address book entry\n * @returns A user storage address book entry\n */\nexport const mapAddressBookEntryToUserStorageEntry = (\n addressBookEntry: AddressBookEntry,\n): UserStorageContactEntry => {\n const {\n address,\n name,\n chainId,\n memo,\n addressType,\n isEns,\n lastUpdatedAt,\n deletedAt,\n } = addressBookEntry as SyncAddressBookEntry;\n\n const now = Date.now();\n\n return {\n [USER_STORAGE_VERSION_KEY]: USER_STORAGE_VERSION,\n a: address,\n n: name,\n c: chainId,\n ...(memo ? { m: memo } : {}),\n ...(addressType ? { t: addressType } : {}),\n ...(isEns ? { e: isEns } : {}),\n lu: lastUpdatedAt || now,\n ...(deletedAt ? { dt: deletedAt } : {}),\n };\n};\n\n/**\n * Map a user storage address book entry to an address book entry\n * Preserves sync metadata from remote storage while keeping the\n * entry compatible with AddressBookController\n *\n * @param userStorageEntry - A user storage address book entry\n * @returns An address book entry with sync metadata for internal use\n */\nexport const mapUserStorageEntryToAddressBookEntry = (\n userStorageEntry: UserStorageContactEntry,\n): SyncAddressBookEntry => {\n const addressBookEntry: SyncAddressBookEntry = {\n address: userStorageEntry.a,\n name: userStorageEntry.n,\n chainId: userStorageEntry.c,\n memo: userStorageEntry.m || '',\n isEns: userStorageEntry.e || false,\n ...(userStorageEntry.t\n ? { addressType: userStorageEntry.t as AddressType }\n : {}),\n // Include remote metadata for sync operation only (not stored in AddressBookController)\n ...(userStorageEntry.dt ? { deletedAt: userStorageEntry.dt } : {}),\n ...(userStorageEntry.lu ? { lastUpdatedAt: userStorageEntry.lu } : {}),\n };\n\n return addressBookEntry;\n};\n\n/**\n * Check if a contact entry is bridged from accounts\n * Contacts with chainId \"*\" are global accounts bridged from the accounts system\n *\n * @param contactEntry - The contact entry to check\n * @returns True if the contact is bridged from accounts\n */\nexport const isContactBridgedFromAccounts = (\n contactEntry: AddressBookEntry,\n): boolean => {\n return String(contactEntry.chainId) === '*';\n};\n"]}
|
|
@@ -27,9 +27,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.Mocks = exports.Controller = void 0;
|
|
30
|
-
const
|
|
31
|
-
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return
|
|
32
|
-
exports.default =
|
|
30
|
+
const UserStorageController_1 = require("./UserStorageController.cjs");
|
|
31
|
+
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return UserStorageController_1.UserStorageController; } });
|
|
32
|
+
exports.default = UserStorageController_1.UserStorageController;
|
|
33
33
|
__exportStar(require("./UserStorageController.cjs"), exports);
|
|
34
34
|
exports.Mocks = __importStar(require("./mocks/index.cjs"));
|
|
35
35
|
__exportStar(require("./constants.cjs"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAgE;AAE9B,2FAFzB,6CAAqB,OAEc;AAC5C,kBAAe,6CAAqB,CAAC;AACrC,8DAAwC;AACxC,2DAAiC;AACjC,kDAA4B;AAC5B,oEAAwC;AACxC,kEAA4C","sourcesContent":["import { UserStorageController } from './UserStorageController';\n\nexport { UserStorageController as Controller };\nexport default UserStorageController;\nexport * from './UserStorageController';\nexport * as Mocks from './mocks';\nexport * from './constants';\nexport * from '../../shared/encryption';\nexport * from '../../shared/storage-schema';\nexport type {\n UserStorageControllerPerformGetStorageAction,\n UserStorageControllerPerformGetStorageAllFeatureEntriesAction,\n UserStorageControllerPerformSetStorageAction,\n UserStorageControllerPerformBatchSetStorageAction,\n UserStorageControllerPerformDeleteStorageAction,\n UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction,\n UserStorageControllerPerformBatchDeleteStorageAction,\n UserStorageControllerGetStorageKeyAction,\n UserStorageControllerListEntropySourcesAction,\n UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction,\n UserStorageControllerSetIsContactSyncingInProgressAction,\n UserStorageControllerSyncContactsWithUserStorageAction,\n} from './UserStorageController-method-action-types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,oCAAgC;AAEhE,OAAO,EAAE,qBAAqB,IAAI,UAAU,EAAE,CAAC;AAC/C,eAAe,qBAAqB,CAAC;AACrC,4CAAwC;AACxC,OAAO,KAAK,KAAK,0BAAgB;AACjC,gCAA4B;AAC5B,kDAAwC;AACxC,gDAA4C;AAC5C,YAAY,EACV,4CAA4C,EAC5C,6DAA6D,EAC7D,4CAA4C,EAC5C,iDAAiD,EACjD,+CAA+C,EAC/C,gEAAgE,EAChE,oDAAoD,EACpD,wCAAwC,EACxC,6CAA6C,EAC7C,2DAA2D,EAC3D,wDAAwD,EACxD,sDAAsD,GACvD,wDAAoD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,oCAAgC;AAEhE,OAAO,EAAE,qBAAqB,IAAI,UAAU,EAAE,CAAC;AAC/C,eAAe,qBAAqB,CAAC;AACrC,4CAAwC;AACxC,OAAO,KAAK,KAAK,0BAAgB;AACjC,gCAA4B;AAC5B,kDAAwC;AACxC,gDAA4C;AAC5C,YAAY,EACV,4CAA4C,EAC5C,6DAA6D,EAC7D,4CAA4C,EAC5C,iDAAiD,EACjD,+CAA+C,EAC/C,gEAAgE,EAChE,oDAAoD,EACpD,wCAAwC,EACxC,6CAA6C,EAC7C,2DAA2D,EAC3D,wDAAwD,EACxD,sDAAsD,GACvD,wDAAoD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,oCAAgC;AAEhE,OAAO,EAAE,qBAAqB,IAAI,UAAU,EAAE,CAAC;AAC/C,eAAe,qBAAqB,CAAC;AACrC,4CAAwC;AACxC,OAAO,KAAK,KAAK,0BAAgB;AACjC,gCAA4B;AAC5B,kDAAwC;AACxC,gDAA4C","sourcesContent":["import { UserStorageController } from './UserStorageController';\n\nexport { UserStorageController as Controller };\nexport default UserStorageController;\nexport * from './UserStorageController';\nexport * as Mocks from './mocks';\nexport * from './constants';\nexport * from '../../shared/encryption';\nexport * from '../../shared/storage-schema';\nexport type {\n UserStorageControllerPerformGetStorageAction,\n UserStorageControllerPerformGetStorageAllFeatureEntriesAction,\n UserStorageControllerPerformSetStorageAction,\n UserStorageControllerPerformBatchSetStorageAction,\n UserStorageControllerPerformDeleteStorageAction,\n UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction,\n UserStorageControllerPerformBatchDeleteStorageAction,\n UserStorageControllerGetStorageKeyAction,\n UserStorageControllerListEntropySourcesAction,\n UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction,\n UserStorageControllerSetIsContactSyncingInProgressAction,\n UserStorageControllerSyncContactsWithUserStorageAction,\n} from './UserStorageController-method-action-types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAgC;AAChC,oDAA8B","sourcesContent":["export * from './mockResponses';\nexport * from './mockStorage';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":"AAAA,oCAAgC;AAChC,kCAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":"AAAA,oCAAgC;AAChC,kCAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/index.ts"],"names":[],"mappings":"AAAA,oCAAgC;AAChC,kCAA8B","sourcesContent":["export * from './mockResponses';\nexport * from './mockStorage';\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteMockUserStorageAllFeatureEntriesResponse = exports.deleteMockUserStorageResponse = exports.getMockUserStorageBatchDeleteResponse = exports.getMockUserStorageBatchPutResponse = exports.getMockUserStoragePutResponse = exports.getMockUserStorageAllFeatureEntriesResponse = exports.getMockUserStorageGetResponse = exports.createMockAllFeatureEntriesResponse = exports.createMockGetStorageResponse = exports.getMockUserStorageEndpoint = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const sdk_1 = require("../../../sdk/index.cjs");
|
|
5
|
+
const storage_schema_1 = require("../../../shared/storage-schema.cjs");
|
|
6
|
+
const mockStorage_1 = require("./mockStorage.cjs");
|
|
7
7
|
const getMockUserStorageEndpoint = (path) => {
|
|
8
8
|
if (path.split('.').length === 1) {
|
|
9
|
-
return `${(0,
|
|
9
|
+
return `${(0, sdk_1.getEnvUrls)(sdk_1.Env.PRD).userStorageApiUrl}/api/v1/userstorage/${path}`;
|
|
10
10
|
}
|
|
11
|
-
return `${(0,
|
|
11
|
+
return `${(0, sdk_1.getEnvUrls)(sdk_1.Env.PRD).userStorageApiUrl}/api/v1/userstorage/${(0, storage_schema_1.createEntryPath)(path, mockStorage_1.MOCK_STORAGE_KEY)}`;
|
|
12
12
|
};
|
|
13
13
|
exports.getMockUserStorageEndpoint = getMockUserStorageEndpoint;
|
|
14
14
|
/**
|
|
@@ -20,7 +20,7 @@ exports.getMockUserStorageEndpoint = getMockUserStorageEndpoint;
|
|
|
20
20
|
async function createMockGetStorageResponse(data) {
|
|
21
21
|
return {
|
|
22
22
|
HashedKey: 'HASHED_KEY',
|
|
23
|
-
Data: await (0,
|
|
23
|
+
Data: await (0, mockStorage_1.MOCK_ENCRYPTED_STORAGE_DATA)(data),
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
exports.createMockGetStorageResponse = createMockGetStorageResponse;
|
|
@@ -30,12 +30,12 @@ exports.createMockGetStorageResponse = createMockGetStorageResponse;
|
|
|
30
30
|
* @param dataArr - array of data to encrypt
|
|
31
31
|
* @returns a realistic GET ALL Response Body
|
|
32
32
|
*/
|
|
33
|
-
async function createMockAllFeatureEntriesResponse(dataArr = [
|
|
33
|
+
async function createMockAllFeatureEntriesResponse(dataArr = [mockStorage_1.MOCK_STORAGE_DATA]) {
|
|
34
34
|
const decryptedData = [];
|
|
35
35
|
for (const data of dataArr) {
|
|
36
36
|
decryptedData.push({
|
|
37
37
|
HashedKey: 'HASHED_KEY',
|
|
38
|
-
Data: await (0,
|
|
38
|
+
Data: await (0, mockStorage_1.MOCK_ENCRYPTED_STORAGE_DATA)(data),
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return decryptedData;
|
|
@@ -47,7 +47,7 @@ exports.createMockAllFeatureEntriesResponse = createMockAllFeatureEntriesRespons
|
|
|
47
47
|
* @param path - path of the GET Url
|
|
48
48
|
* @returns mock GET API request. Can be used by e2e or unit mock servers
|
|
49
49
|
*/
|
|
50
|
-
async function getMockUserStorageGetResponse(path = `${
|
|
50
|
+
async function getMockUserStorageGetResponse(path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) {
|
|
51
51
|
return {
|
|
52
52
|
url: (0, exports.getMockUserStorageEndpoint)(path),
|
|
53
53
|
requestMethod: 'GET',
|
|
@@ -62,7 +62,7 @@ exports.getMockUserStorageGetResponse = getMockUserStorageGetResponse;
|
|
|
62
62
|
* @param dataArr - data to encrypt
|
|
63
63
|
* @returns mock GET ALL API request. Can be used by e2e or unit mock servers
|
|
64
64
|
*/
|
|
65
|
-
async function getMockUserStorageAllFeatureEntriesResponse(path =
|
|
65
|
+
async function getMockUserStorageAllFeatureEntriesResponse(path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications, dataArr) {
|
|
66
66
|
return {
|
|
67
67
|
url: (0, exports.getMockUserStorageEndpoint)(path),
|
|
68
68
|
requestMethod: 'GET',
|
|
@@ -70,7 +70,7 @@ async function getMockUserStorageAllFeatureEntriesResponse(path = storage_schema
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
exports.getMockUserStorageAllFeatureEntriesResponse = getMockUserStorageAllFeatureEntriesResponse;
|
|
73
|
-
const getMockUserStoragePutResponse = (path = `${
|
|
73
|
+
const getMockUserStoragePutResponse = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) => {
|
|
74
74
|
return {
|
|
75
75
|
url: (0, exports.getMockUserStorageEndpoint)(path),
|
|
76
76
|
requestMethod: 'PUT',
|
|
@@ -78,7 +78,7 @@ const getMockUserStoragePutResponse = (path = `${storage_schema_js_1.USER_STORAG
|
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
80
|
exports.getMockUserStoragePutResponse = getMockUserStoragePutResponse;
|
|
81
|
-
const getMockUserStorageBatchPutResponse = (path =
|
|
81
|
+
const getMockUserStorageBatchPutResponse = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications) => {
|
|
82
82
|
return {
|
|
83
83
|
url: (0, exports.getMockUserStorageEndpoint)(path),
|
|
84
84
|
requestMethod: 'PUT',
|
|
@@ -86,7 +86,7 @@ const getMockUserStorageBatchPutResponse = (path = storage_schema_js_1.USER_STOR
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
exports.getMockUserStorageBatchPutResponse = getMockUserStorageBatchPutResponse;
|
|
89
|
-
const getMockUserStorageBatchDeleteResponse = (path =
|
|
89
|
+
const getMockUserStorageBatchDeleteResponse = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications) => {
|
|
90
90
|
return {
|
|
91
91
|
url: (0, exports.getMockUserStorageEndpoint)(path),
|
|
92
92
|
requestMethod: 'PUT',
|
|
@@ -94,7 +94,7 @@ const getMockUserStorageBatchDeleteResponse = (path = storage_schema_js_1.USER_S
|
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
exports.getMockUserStorageBatchDeleteResponse = getMockUserStorageBatchDeleteResponse;
|
|
97
|
-
const deleteMockUserStorageResponse = (path = `${
|
|
97
|
+
const deleteMockUserStorageResponse = (path = `${storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`) => {
|
|
98
98
|
return {
|
|
99
99
|
url: (0, exports.getMockUserStorageEndpoint)(path),
|
|
100
100
|
requestMethod: 'DELETE',
|
|
@@ -102,7 +102,7 @@ const deleteMockUserStorageResponse = (path = `${storage_schema_js_1.USER_STORAG
|
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
104
|
exports.deleteMockUserStorageResponse = deleteMockUserStorageResponse;
|
|
105
|
-
const deleteMockUserStorageAllFeatureEntriesResponse = (path =
|
|
105
|
+
const deleteMockUserStorageAllFeatureEntriesResponse = (path = storage_schema_1.USER_STORAGE_FEATURE_NAMES.notifications) => {
|
|
106
106
|
return {
|
|
107
107
|
url: (0, exports.getMockUserStorageEndpoint)(path),
|
|
108
108
|
requestMethod: 'DELETE',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"mockResponses.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAK/C,uEAGwC;AAKxC,mDAIuB;AAQhB,MAAM,0BAA0B,GAAG,CACxC,IAEyC,EACzC,EAAE;IACF,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,GAAG,IAAA,gBAAU,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC,iBAAiB,uBAAuB,IAAI,EAAE,CAAC;IAC/E,CAAC;IAED,OAAO,GAAG,IAAA,gBAAU,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC,iBAAiB,uBAAuB,IAAA,gCAAe,EACnF,IAA+C,EAC/C,8BAAgB,CACjB,EAAE,CAAC;AACN,CAAC,CAAC;AAbW,QAAA,0BAA0B,8BAarC;AAEF;;;;;GAKG;AACI,KAAK,UAAU,4BAA4B,CAChD,IAAa;IAEb,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,MAAM,IAAA,yCAA2B,EAAC,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC;AAPD,oEAOC;AAED;;;;;GAKG;AACI,KAAK,UAAU,mCAAmC,CACvD,UAAoB,CAAC,+BAAiB,CAAC;IAEvC,MAAM,aAAa,GAAG,EAAE,CAAC;IAEzB,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,aAAa,CAAC,IAAI,CAAC;YACjB,SAAS,EAAE,YAAY;YACvB,IAAI,EAAE,MAAM,IAAA,yCAA2B,EAAC,IAAI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QACrC,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,qCAAqC,yCAQhD;AAEK,MAAM,6BAA6B,GAAG,CAC3C,OAAgD,GAAG,2CAA0B,CAAC,aAAa,wBAAwB,EACnH,EAAE;IACF,OAAO;QACL,GAAG,EAAE,IAAA,kCAA0B,EAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,6BAA6B,iCAQxC;AAEK,MAAM,8CAA8C,GAAG,CAC5D,OAA8C,2CAA0B,CAAC,aAAa,EACtF,EAAE;IACF,OAAO;QACL,GAAG,EAAE,IAAA,kCAA0B,EAAC,IAAI,CAAC;QACrC,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,IAAI;KACQ,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,8CAA8C,kDAQzD","sourcesContent":["import { Env, getEnvUrls } from '../../../sdk';\nimport type {\n UserStorageGenericPathWithFeatureAndKey,\n UserStorageGenericPathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n createEntryPath,\n USER_STORAGE_FEATURE_NAMES,\n} from '../../../shared/storage-schema';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../types';\nimport {\n MOCK_ENCRYPTED_STORAGE_DATA,\n MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n} from './mockStorage';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const getMockUserStorageEndpoint = (\n path:\n | UserStorageGenericPathWithFeatureAndKey\n | UserStorageGenericPathWithFeatureOnly,\n) => {\n if (path.split('.').length === 1) {\n return `${getEnvUrls(Env.PRD).userStorageApiUrl}/api/v1/userstorage/${path}`;\n }\n\n return `${getEnvUrls(Env.PRD).userStorageApiUrl}/api/v1/userstorage/${createEntryPath(\n path as UserStorageGenericPathWithFeatureAndKey,\n MOCK_STORAGE_KEY,\n )}`;\n};\n\n/**\n * Creates a mock GET user-storage response\n *\n * @param data - data to encrypt\n * @returns a realistic GET Response Body\n */\nexport async function createMockGetStorageResponse(\n data?: string,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n };\n}\n\n/**\n * Creates a mock GET ALL user-storage response\n *\n * @param dataArr - array of data to encrypt\n * @returns a realistic GET ALL Response Body\n */\nexport async function createMockAllFeatureEntriesResponse(\n dataArr: string[] = [MOCK_STORAGE_DATA],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n const decryptedData = [];\n\n for (const data of dataArr) {\n decryptedData.push({\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n });\n }\n\n return decryptedData;\n}\n\n/**\n * Creates a mock user-storage api GET request\n *\n * @param path - path of the GET Url\n * @returns mock GET API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageGetResponse(\n path: UserStorageGenericPathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockGetStorageResponse(),\n } satisfies MockResponse;\n}\n\n/**\n * Creates a mock user-storage api GET ALL request\n *\n * @param path - path of the GET url\n * @param dataArr - data to encrypt\n * @returns mock GET ALL API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageAllFeatureEntriesResponse(\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n dataArr?: string[],\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockAllFeatureEntriesResponse(dataArr),\n } satisfies MockResponse;\n}\n\nexport const getMockUserStoragePutResponse = (\n path: UserStorageGenericPathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchPutResponse = (\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchDeleteResponse = (\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageResponse = (\n path: UserStorageGenericPathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageAllFeatureEntriesResponse = (\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uCAAuC,EACvC,qCAAqC,EACtC,
|
|
1
|
+
{"version":3,"file":"mockResponses.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uCAAuC,EACvC,qCAAqC,EACtC,2CAAuC;AAKxC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,qBAAiB;AAalB,eAAO,MAAM,0BAA0B,SAEjC,uCAAuC,GACvC,qCAAqC,WAU1C,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;;GAKG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAWlD;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,uCAA6G;;;;GAOpH;AAED;;;;;;GAMG;AACH,wBAAsB,2CAA2C,CAC/D,IAAI,GAAE,qCAAgF,EACtF,OAAO,CAAC,EAAE,MAAM,EAAE;;;;GAOnB;AAED,eAAO,MAAM,6BAA6B,UAClC,uCAAuC;;;;CAO9C,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,qCAAqC;;;;CAO5C,CAAC;AAEF,eAAO,MAAM,qCAAqC,UAC1C,qCAAqC;;;;CAO5C,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,uCAAuC;;;;CAO9C,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,qCAAqC;;;;CAO5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uCAAuC,EACvC,qCAAqC,EACtC,
|
|
1
|
+
{"version":3,"file":"mockResponses.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uCAAuC,EACvC,qCAAqC,EACtC,2CAAuC;AAKxC,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,qBAAiB;AAalB,eAAO,MAAM,0BAA0B,SAEjC,uCAAuC,GACvC,qCAAqC,WAU1C,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,CAAC,CAKjC;AAED;;;;;GAKG;AACH,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,MAAM,EAAwB,GACtC,OAAO,CAAC,uCAAuC,CAAC,CAWlD;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,uCAA6G;;;;GAOpH;AAED;;;;;;GAMG;AACH,wBAAsB,2CAA2C,CAC/D,IAAI,GAAE,qCAAgF,EACtF,OAAO,CAAC,EAAE,MAAM,EAAE;;;;GAOnB;AAED,eAAO,MAAM,6BAA6B,UAClC,uCAAuC;;;;CAO9C,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACvC,qCAAqC;;;;CAO5C,CAAC;AAEF,eAAO,MAAM,qCAAqC,UAC1C,qCAAqC;;;;CAO5C,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,uCAAuC;;;;CAO9C,CAAC;AAEF,eAAO,MAAM,8CAA8C,UACnD,qCAAqC;;;;CAO5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,+
|
|
1
|
+
{"version":3,"file":"mockResponses.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,+BAAqB;AAK/C,OAAO,EACL,eAAe,EACf,0BAA0B,EAC3B,2CAAuC;AAKxC,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,gBAAgB,EACjB,0BAAsB;AAQvB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,IAEyC,EACzC,EAAE;IACF,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAA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';\nimport type {\n UserStorageGenericPathWithFeatureAndKey,\n UserStorageGenericPathWithFeatureOnly,\n} from '../../../shared/storage-schema';\nimport {\n createEntryPath,\n USER_STORAGE_FEATURE_NAMES,\n} from '../../../shared/storage-schema';\nimport type {\n GetUserStorageAllFeatureEntriesResponse,\n GetUserStorageResponse,\n} from '../types';\nimport {\n MOCK_ENCRYPTED_STORAGE_DATA,\n MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n} from './mockStorage';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';\n response: unknown;\n};\n\nexport const getMockUserStorageEndpoint = (\n path:\n | UserStorageGenericPathWithFeatureAndKey\n | UserStorageGenericPathWithFeatureOnly,\n) => {\n if (path.split('.').length === 1) {\n return `${getEnvUrls(Env.PRD).userStorageApiUrl}/api/v1/userstorage/${path}`;\n }\n\n return `${getEnvUrls(Env.PRD).userStorageApiUrl}/api/v1/userstorage/${createEntryPath(\n path as UserStorageGenericPathWithFeatureAndKey,\n MOCK_STORAGE_KEY,\n )}`;\n};\n\n/**\n * Creates a mock GET user-storage response\n *\n * @param data - data to encrypt\n * @returns a realistic GET Response Body\n */\nexport async function createMockGetStorageResponse(\n data?: string,\n): Promise<GetUserStorageResponse> {\n return {\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n };\n}\n\n/**\n * Creates a mock GET ALL user-storage response\n *\n * @param dataArr - array of data to encrypt\n * @returns a realistic GET ALL Response Body\n */\nexport async function createMockAllFeatureEntriesResponse(\n dataArr: string[] = [MOCK_STORAGE_DATA],\n): Promise<GetUserStorageAllFeatureEntriesResponse> {\n const decryptedData = [];\n\n for (const data of dataArr) {\n decryptedData.push({\n HashedKey: 'HASHED_KEY',\n Data: await MOCK_ENCRYPTED_STORAGE_DATA(data),\n });\n }\n\n return decryptedData;\n}\n\n/**\n * Creates a mock user-storage api GET request\n *\n * @param path - path of the GET Url\n * @returns mock GET API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageGetResponse(\n path: UserStorageGenericPathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockGetStorageResponse(),\n } satisfies MockResponse;\n}\n\n/**\n * Creates a mock user-storage api GET ALL request\n *\n * @param path - path of the GET url\n * @param dataArr - data to encrypt\n * @returns mock GET ALL API request. Can be used by e2e or unit mock servers\n */\nexport async function getMockUserStorageAllFeatureEntriesResponse(\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n dataArr?: string[],\n) {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'GET',\n response: await createMockAllFeatureEntriesResponse(dataArr),\n } satisfies MockResponse;\n}\n\nexport const getMockUserStoragePutResponse = (\n path: UserStorageGenericPathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchPutResponse = (\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const getMockUserStorageBatchDeleteResponse = (\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'PUT',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageResponse = (\n path: UserStorageGenericPathWithFeatureAndKey = `${USER_STORAGE_FEATURE_NAMES.notifications}.notification_settings`,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n\nexport const deleteMockUserStorageAllFeatureEntriesResponse = (\n path: UserStorageGenericPathWithFeatureOnly = USER_STORAGE_FEATURE_NAMES.notifications,\n) => {\n return {\n url: getMockUserStorageEndpoint(path),\n requestMethod: 'DELETE',\n response: null,\n } satisfies MockResponse;\n};\n"]}
|
|
@@ -24,13 +24,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.MOCK_ENCRYPTED_STORAGE_DATA = exports.MOCK_STORAGE_DATA = exports.MOCK_STORAGE_KEY = exports.MOCK_STORAGE_KEY_SIGNATURE = void 0;
|
|
27
|
-
const
|
|
27
|
+
const encryption_1 = __importStar(require("../../../shared/encryption/index.cjs"));
|
|
28
28
|
exports.MOCK_STORAGE_KEY_SIGNATURE = 'mockStorageKey';
|
|
29
|
-
exports.MOCK_STORAGE_KEY = (0,
|
|
29
|
+
exports.MOCK_STORAGE_KEY = (0, encryption_1.createSHA256Hash)(exports.MOCK_STORAGE_KEY_SIGNATURE);
|
|
30
30
|
exports.MOCK_STORAGE_DATA = JSON.stringify({ hello: 'world' });
|
|
31
31
|
// NOTE - using encryption.encryptString directly in fixtures causes issues on mobile.
|
|
32
32
|
// This is because this fixture is getting added in at run time. Will be improved once we support multiple exports
|
|
33
33
|
let cachedMockEncryptedData;
|
|
34
|
-
const MOCK_ENCRYPTED_STORAGE_DATA = async (data) => (cachedMockEncryptedData ?? (cachedMockEncryptedData = await
|
|
34
|
+
const MOCK_ENCRYPTED_STORAGE_DATA = async (data) => (cachedMockEncryptedData ?? (cachedMockEncryptedData = await encryption_1.default.encryptString(data ?? exports.MOCK_STORAGE_DATA, exports.MOCK_STORAGE_KEY)));
|
|
35
35
|
exports.MOCK_ENCRYPTED_STORAGE_DATA = MOCK_ENCRYPTED_STORAGE_DATA;
|
|
36
36
|
//# sourceMappingURL=mockStorage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockStorage.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"mockStorage.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mFAA0E;AAE7D,QAAA,0BAA0B,GAAG,gBAAgB,CAAC;AAC9C,QAAA,gBAAgB,GAAG,IAAA,6BAAgB,EAAC,kCAA0B,CAAC,CAAC;AAChE,QAAA,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAEpE,sFAAsF;AACtF,kHAAkH;AAClH,IAAI,uBAA+B,CAAC;AAC7B,MAAM,2BAA2B,GAAG,KAAK,EAAE,IAAa,EAAE,EAAE,CACjE,CAAC,uBAAuB,KAAvB,uBAAuB,GAAK,MAAM,oBAAU,CAAC,aAAa,CACzD,IAAI,IAAI,yBAAiB,EACzB,wBAAgB,CACjB,EAAC,CAAC;AAJQ,QAAA,2BAA2B,+BAInC","sourcesContent":["import encryption, { createSHA256Hash } from '../../../shared/encryption';\n\nexport const MOCK_STORAGE_KEY_SIGNATURE = 'mockStorageKey';\nexport const MOCK_STORAGE_KEY = createSHA256Hash(MOCK_STORAGE_KEY_SIGNATURE);\nexport const MOCK_STORAGE_DATA = JSON.stringify({ hello: 'world' });\n\n// NOTE - using encryption.encryptString directly in fixtures causes issues on mobile.\n// This is because this fixture is getting added in at run time. Will be improved once we support multiple exports\nlet cachedMockEncryptedData: string;\nexport const MOCK_ENCRYPTED_STORAGE_DATA = async (data?: string) =>\n (cachedMockEncryptedData ??= await encryption.encryptString(\n data ?? MOCK_STORAGE_DATA,\n MOCK_STORAGE_KEY,\n ));\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockStorage.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mockStorage.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAAqC,CAAC;AAKpE,eAAO,MAAM,2BAA2B,UAAiB,MAAM,oBAI3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockStorage.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mockStorage.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/mocks/mockStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAAqC,CAAC;AAKpE,eAAO,MAAM,2BAA2B,UAAiB,MAAM,oBAI3D,CAAC"}
|