@metamask/profile-sync-controller 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/dist/controllers/authentication/services.cjs +1 -1
- package/dist/controllers/authentication/services.cjs.map +1 -1
- package/dist/controllers/authentication/services.mjs +1 -1
- package/dist/controllers/authentication/services.mjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +35 -9
- package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts +11 -2
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts +11 -2
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.mjs +36 -10
- package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs +53 -17
- package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts +31 -5
- package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts +31 -5
- package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs +48 -13
- package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +15 -3
- package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts +3 -2
- package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +3 -2
- package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +14 -3
- package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs.map +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs +1 -1
- package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs.map +1 -1
- package/dist/controllers/user-storage/index.cjs +1 -1
- package/dist/controllers/user-storage/index.cjs.map +1 -1
- package/dist/controllers/user-storage/index.d.cts +1 -1
- package/dist/controllers/user-storage/index.d.cts.map +1 -1
- package/dist/controllers/user-storage/index.d.mts +1 -1
- package/dist/controllers/user-storage/index.d.mts.map +1 -1
- package/dist/controllers/user-storage/index.mjs +1 -1
- package/dist/controllers/user-storage/index.mjs.map +1 -1
- package/dist/controllers/user-storage/services.cjs +62 -6
- package/dist/controllers/user-storage/services.cjs.map +1 -1
- package/dist/controllers/user-storage/services.d.cts +11 -2
- package/dist/controllers/user-storage/services.d.cts.map +1 -1
- package/dist/controllers/user-storage/services.d.mts +11 -2
- package/dist/controllers/user-storage/services.d.mts.map +1 -1
- package/dist/controllers/user-storage/services.mjs +35 -3
- package/dist/controllers/user-storage/services.mjs.map +1 -1
- package/dist/sdk/__fixtures__/mock-auth.cjs +1 -1
- package/dist/sdk/__fixtures__/mock-auth.cjs.map +1 -1
- package/dist/sdk/__fixtures__/mock-auth.mjs +1 -1
- package/dist/sdk/__fixtures__/mock-auth.mjs.map +1 -1
- package/dist/sdk/__fixtures__/mock-userstorage.cjs +6 -4
- package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +1 -1
- package/dist/sdk/__fixtures__/mock-userstorage.d.cts +1 -1
- package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +1 -1
- package/dist/sdk/__fixtures__/mock-userstorage.d.mts +1 -1
- package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +1 -1
- package/dist/sdk/__fixtures__/mock-userstorage.mjs +6 -4
- package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +1 -1
- package/dist/sdk/__fixtures__/test-utils.cjs +1 -1
- package/dist/sdk/__fixtures__/test-utils.cjs.map +1 -1
- package/dist/sdk/__fixtures__/test-utils.d.cts.map +1 -1
- package/dist/sdk/__fixtures__/test-utils.d.mts.map +1 -1
- package/dist/sdk/__fixtures__/test-utils.mjs +1 -1
- package/dist/sdk/__fixtures__/test-utils.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs +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 +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts +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.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/index.cjs +2 -2
- package/dist/sdk/index.cjs.map +1 -1
- package/dist/sdk/index.d.cts +2 -2
- package/dist/sdk/index.d.cts.map +1 -1
- package/dist/sdk/index.d.mts +2 -2
- package/dist/sdk/index.d.mts.map +1 -1
- package/dist/sdk/index.mjs +2 -2
- package/dist/sdk/index.mjs.map +1 -1
- package/dist/sdk/user-storage.cjs +44 -6
- package/dist/sdk/user-storage.cjs.map +1 -1
- package/dist/sdk/user-storage.d.cts +3 -2
- package/dist/sdk/user-storage.d.cts.map +1 -1
- package/dist/sdk/user-storage.d.mts +3 -2
- package/dist/sdk/user-storage.d.mts.map +1 -1
- package/dist/sdk/user-storage.mjs +42 -4
- package/dist/sdk/user-storage.mjs.map +1 -1
- package/dist/shared/encryption/cache.cjs.map +1 -0
- package/dist/shared/encryption/cache.d.cts.map +1 -0
- package/dist/shared/encryption/cache.d.mts.map +1 -0
- package/dist/shared/encryption/cache.mjs.map +1 -0
- package/dist/shared/encryption/encryption.cjs.map +1 -0
- package/dist/{controllers/user-storage → shared}/encryption/encryption.d.cts +1 -1
- package/dist/shared/encryption/encryption.d.cts.map +1 -0
- package/dist/{controllers/user-storage → shared}/encryption/encryption.d.mts +1 -1
- package/dist/shared/encryption/encryption.d.mts.map +1 -0
- package/dist/shared/encryption/encryption.mjs.map +1 -0
- package/dist/shared/encryption/index.cjs.map +1 -0
- package/dist/shared/encryption/index.d.cts.map +1 -0
- package/dist/shared/encryption/index.d.mts.map +1 -0
- package/dist/shared/encryption/index.mjs.map +1 -0
- package/dist/shared/encryption/utils.cjs.map +1 -0
- package/dist/shared/encryption/utils.d.cts.map +1 -0
- package/dist/shared/encryption/utils.d.mts.map +1 -0
- package/dist/shared/encryption/utils.mjs.map +1 -0
- package/dist/shared/env.cjs.map +1 -0
- package/dist/shared/env.d.cts.map +1 -0
- package/dist/shared/env.d.mts.map +1 -0
- package/dist/shared/env.mjs.map +1 -0
- package/dist/{controllers/user-storage/schema.cjs → shared/storage-schema.cjs} +1 -1
- package/dist/shared/storage-schema.cjs.map +1 -0
- package/dist/{controllers/user-storage/schema.d.mts → shared/storage-schema.d.cts} +6 -3
- package/dist/shared/storage-schema.d.cts.map +1 -0
- package/dist/{controllers/user-storage/schema.d.cts → shared/storage-schema.d.mts} +6 -3
- package/dist/shared/storage-schema.d.mts.map +1 -0
- package/dist/{controllers/user-storage/schema.mjs → shared/storage-schema.mjs} +1 -1
- package/dist/shared/storage-schema.mjs.map +1 -0
- package/dist/shared/types/encryption.cjs +3 -0
- package/dist/shared/types/encryption.cjs.map +1 -0
- package/dist/shared/types/encryption.d.cts +2 -0
- package/dist/shared/types/encryption.d.cts.map +1 -0
- package/dist/shared/types/encryption.d.mts +2 -0
- package/dist/shared/types/encryption.d.mts.map +1 -0
- package/dist/shared/types/encryption.mjs +2 -0
- package/dist/shared/types/encryption.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/controllers/user-storage/encryption/cache.cjs.map +0 -1
- package/dist/controllers/user-storage/encryption/cache.d.cts.map +0 -1
- package/dist/controllers/user-storage/encryption/cache.d.mts.map +0 -1
- package/dist/controllers/user-storage/encryption/cache.mjs.map +0 -1
- package/dist/controllers/user-storage/encryption/encryption.cjs.map +0 -1
- package/dist/controllers/user-storage/encryption/encryption.d.cts.map +0 -1
- package/dist/controllers/user-storage/encryption/encryption.d.mts.map +0 -1
- package/dist/controllers/user-storage/encryption/encryption.mjs.map +0 -1
- package/dist/controllers/user-storage/encryption/index.cjs.map +0 -1
- package/dist/controllers/user-storage/encryption/index.d.cts.map +0 -1
- package/dist/controllers/user-storage/encryption/index.d.mts.map +0 -1
- package/dist/controllers/user-storage/encryption/index.mjs.map +0 -1
- package/dist/controllers/user-storage/encryption/utils.cjs.map +0 -1
- package/dist/controllers/user-storage/encryption/utils.d.cts.map +0 -1
- package/dist/controllers/user-storage/encryption/utils.d.mts.map +0 -1
- package/dist/controllers/user-storage/encryption/utils.mjs.map +0 -1
- package/dist/controllers/user-storage/schema.cjs.map +0 -1
- package/dist/controllers/user-storage/schema.d.cts.map +0 -1
- package/dist/controllers/user-storage/schema.d.mts.map +0 -1
- package/dist/controllers/user-storage/schema.mjs.map +0 -1
- package/dist/sdk/encryption.cjs +0 -23
- package/dist/sdk/encryption.cjs.map +0 -1
- package/dist/sdk/encryption.d.cts +0 -4
- package/dist/sdk/encryption.d.cts.map +0 -1
- package/dist/sdk/encryption.d.mts +0 -4
- package/dist/sdk/encryption.d.mts.map +0 -1
- package/dist/sdk/encryption.mjs +0 -4
- package/dist/sdk/encryption.mjs.map +0 -1
- package/dist/sdk/env.cjs.map +0 -1
- package/dist/sdk/env.d.cts.map +0 -1
- package/dist/sdk/env.d.mts.map +0 -1
- package/dist/sdk/env.mjs.map +0 -1
- /package/dist/{controllers/user-storage → shared}/encryption/cache.cjs +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/cache.d.cts +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/cache.d.mts +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/cache.mjs +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/encryption.cjs +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/encryption.mjs +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/index.cjs +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/index.d.cts +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/index.d.mts +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/index.mjs +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/utils.cjs +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/utils.d.cts +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/utils.d.mts +0 -0
- /package/dist/{controllers/user-storage → shared}/encryption/utils.mjs +0 -0
- /package/dist/{sdk → shared}/env.cjs +0 -0
- /package/dist/{sdk → shared}/env.d.cts +0 -0
- /package/dist/{sdk → shared}/env.d.mts +0 -0
- /package/dist/{sdk → shared}/env.mjs +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/schema.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,wBAAkC,CAAC;AAE7D,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX,KAAK,iBAAiB,GAAG,OAAO,mBA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KACH;IAED,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAGpC,CAAC;IAEF,IAAI,CAAC,CAAC,OAAO,IAAI,mBAAmB,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,4CAA4C,OAAO,EAAE,CAAC,CAAC;KACxE;IAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,CAAsB,CAAC;IAEvE,IACE,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC3B,CAAC,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAC5C;QACA,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1D,MAAM,IAAI,KAAK,CACb,yDAAyD,GAAG,iBAAiB,SAAS,EAAE,CACzF,CAAC;KACH;IAED,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,IAAY,EAC8B,EAAE;IAC5C,MAAM,SAAS,GAAG,aAAa,CAAC;IAEhC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAsC,EACtC,UAAkB;IAElB,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC;IAErD,OAAO,GAAG,OAAO,IAAI,SAAS,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { createSHA256Hash } from './encryption';\n\n/**\n * The User Storage Endpoint requires a feature name and a namespace key.\n * Developers can provide additional features and keys by extending these types below.\n *\n * Adding ALLOW_ARBITRARY_KEYS as the first key in the array allows for any key to be used for this feature.\n * This can be useful for features where keys are not deterministic (eg. accounts addresses).\n */\nconst ALLOW_ARBITRARY_KEYS = 'ALLOW_ARBITRARY_KEYS' as const;\n\nexport const USER_STORAGE_SCHEMA = {\n notifications: ['notification_settings'],\n accounts: [ALLOW_ARBITRARY_KEYS], // keyed by account addresses\n networks: [ALLOW_ARBITRARY_KEYS], // keyed by chains/networks\n} as const;\n\ntype UserStorageSchema = typeof USER_STORAGE_SCHEMA;\n\ntype UserStorageFeatures = keyof UserStorageSchema;\ntype UserStorageFeatureKeys<Feature extends UserStorageFeatures> =\n UserStorageSchema[Feature][0] extends typeof ALLOW_ARBITRARY_KEYS\n ? string\n : UserStorageSchema[Feature][number];\n\ntype UserStorageFeatureAndKey = {\n feature: UserStorageFeatures;\n key: UserStorageFeatureKeys<UserStorageFeatures>;\n};\n\nexport type UserStoragePathWithFeatureOnly = keyof UserStorageSchema;\nexport type UserStoragePathWithFeatureAndKey = {\n [K in UserStorageFeatures]: `${K}.${UserStorageFeatureKeys<K>}`;\n}[UserStoragePathWithFeatureOnly];\n\nexport const getFeatureAndKeyFromPath = (\n path: UserStoragePathWithFeatureAndKey,\n): UserStorageFeatureAndKey => {\n const pathRegex = /^\\w+\\.\\w+$/u;\n\n if (!pathRegex.test(path)) {\n throw new Error(\n `user-storage - path is not in the correct format. Correct format: 'feature.key'`,\n );\n }\n\n const [feature, key] = path.split('.') as [\n UserStorageFeatures,\n UserStorageFeatureKeys<UserStorageFeatures>,\n ];\n\n if (!(feature in USER_STORAGE_SCHEMA)) {\n throw new Error(`user-storage - invalid feature provided: ${feature}`);\n }\n\n const validFeature = USER_STORAGE_SCHEMA[feature] as readonly string[];\n\n if (\n !validFeature.includes(key) &&\n !validFeature.includes(ALLOW_ARBITRARY_KEYS)\n ) {\n const validKeys = USER_STORAGE_SCHEMA[feature].join(', ');\n\n throw new Error(\n `user-storage - invalid key provided for this feature: ${key}. Valid keys: ${validKeys}`,\n );\n }\n\n return { feature, key };\n};\n\nexport const isPathWithFeatureAndKey = (\n path: string,\n): path is UserStoragePathWithFeatureAndKey => {\n const pathRegex = /^\\w+\\.\\w+$/u;\n\n return pathRegex.test(path);\n};\n\n/**\n * Constructs a unique entry path for a user.\n * This can be done due to the uniqueness of the storage key (no users will share the same storage key).\n * The users entry is a unique hash that cannot be reversed.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param storageKey - users storage key\n * @returns path to store entry\n */\nexport function createEntryPath(\n path: UserStoragePathWithFeatureAndKey,\n storageKey: string,\n): string {\n const { feature, key } = getFeatureAndKeyFromPath(path);\n const hashedKey = createSHA256Hash(key + storageKey);\n\n return `${feature}/${hashedKey}`;\n}\n"]}
|
package/dist/sdk/encryption.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const encryption_1 = __importDefault(require("../controllers/user-storage/encryption/encryption.cjs"));
|
|
21
|
-
__exportStar(require("../controllers/user-storage/encryption/encryption.cjs"), exports);
|
|
22
|
-
exports.default = encryption_1.default;
|
|
23
|
-
//# sourceMappingURL=encryption.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.cjs","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,uGAA2E;AAE3E,wFAAkE;AAClE,kBAAe,oBAAU,CAAC","sourcesContent":["import encryption from '../controllers/user-storage/encryption/encryption';\n\nexport * from '../controllers/user-storage/encryption/encryption';\nexport default encryption;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.cts","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,8DAA0D;AAE3E,sEAAkE;AAClE,eAAe,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.mts","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,8DAA0D;AAE3E,sEAAkE;AAClE,eAAe,UAAU,CAAC"}
|
package/dist/sdk/encryption.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.mjs","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,8DAA0D;AAE3E,sEAAkE;AAClE,eAAe,UAAU,CAAC","sourcesContent":["import encryption from '../controllers/user-storage/encryption/encryption';\n\nexport * from '../controllers/user-storage/encryption/encryption';\nexport default encryption;\n"]}
|
package/dist/sdk/env.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.cjs","sourceRoot":"","sources":["../../src/sdk/env.ts"],"names":[],"mappings":";;;AAAA,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAA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AAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;YACzD,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;SAC1D;QACD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACT,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;YACzD,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;SAC1D;KACF,CAAC;IAEF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,mCAAmC,CAAC,CAAC;KACxE;IAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE;QAC7B,MAAM,IAAI,KAAK,CACb,eAAe,GAAG,iBAAiB,QAAQ,+CAA+C,CAC3F,CAAC;KACH;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAjCD,0CAiCC","sourcesContent":["export enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\nexport enum Platform {\n MOBILE = 'mobile',\n EXTENSION = 'extension',\n PORTFOLIO = 'portfolio',\n INFURA = 'infura',\n}\n\ntype EnvUrlsEntry = {\n authApiUrl: string;\n oidcApiUrl: string;\n userStorageApiUrl: string;\n};\n\nconst ENV_URLS: Record<Env, EnvUrlsEntry> = {\n dev: {\n authApiUrl: 'https://authentication.dev-api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.dev-api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.dev-api.cx.metamask.io',\n },\n uat: {\n authApiUrl: 'https://authentication.uat-api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.uat-api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.uat-api.cx.metamask.io',\n },\n prd: {\n authApiUrl: 'https://authentication.api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.api.cx.metamask.io',\n },\n};\n\n/**\n * Validates and returns correct environment endpoints\n *\n * @param env - environment field\n * @returns the correct environment url\n * @throws on invalid environment passed\n */\nexport function getEnvUrls(env: Env): EnvUrlsEntry {\n if (!ENV_URLS[env]) {\n throw new Error('invalid environment configuration');\n }\n return ENV_URLS[env];\n}\n\n/**\n * Returns the valid OIDC Client ID (used during authorization)\n *\n * @param env - environment field\n * @param platform - platform field\n * @returns the OIDC client id for the environment\n */\nexport function getOidcClientId(env: Env, platform: Platform): string {\n const clientIds = {\n [Env.DEV]: {\n [Platform.PORTFOLIO]: 'c7ca94a0-5d52-4635-9502-1a50a9c410cc',\n [Platform.MOBILE]: 'e83c7cc9-267d-4fb4-8fec-f0e3bbe5ae8e',\n [Platform.EXTENSION]: 'f1a963d7-50dc-4cb5-8d81-f1f3654f0df3',\n [Platform.INFURA]: 'bd887006-0d55-481a-a395-5ff9a0dc52c9',\n },\n [Env.UAT]: {\n [Platform.PORTFOLIO]: '8f2dd4ac-db07-4819-9ba5-1ee0ec1b56d1',\n [Platform.MOBILE]: 'c3cfdcd2-51d6-4fae-ad2c-ff238c8fef53',\n [Platform.EXTENSION]: 'a9de167c-c9a6-43d8-af39-d301fd44c485',\n [Platform.INFURA]: '01929890-7002-4c97-9913-8f6c09a6d674',\n },\n [Env.PRD]: {\n [Platform.PORTFOLIO]: '35e1cd62-49c5-4be8-8b6e-a5212f2d2cfb',\n [Platform.MOBILE]: '75fa62a3-9ca0-4b91-9fe5-76bec86b0257',\n [Platform.EXTENSION]: '1132f10a-b4e5-4390-a5f2-d9c6022db564',\n [Platform.INFURA]: 'fdde9417-e193-4d23-9943-a8346b18d097',\n },\n };\n\n if (!clientIds[env]) {\n throw new Error(`invalid env ${env}: cannot determine oidc client id`);\n }\n\n if (!clientIds[env][platform]) {\n throw new Error(\n `invalid env ${env} and platform ${platform} combination: cannot determine oidc client id`,\n );\n }\n\n return clientIds[env][platform];\n}\n"]}
|
package/dist/sdk/env.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.cts","sourceRoot":"","sources":["../../src/sdk/env.ts"],"names":[],"mappings":"AAAA,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,oBAAY,QAAQ;IAClB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAoBF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,CAKjD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAiCpE"}
|
package/dist/sdk/env.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.mts","sourceRoot":"","sources":["../../src/sdk/env.ts"],"names":[],"mappings":"AAAA,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,oBAAY,QAAQ;IAClB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAoBF;;;;;;GAMG;AACH,wBAAgB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ILE = 'mobile',\n EXTENSION = 'extension',\n PORTFOLIO = 'portfolio',\n INFURA = 'infura',\n}\n\ntype EnvUrlsEntry = {\n authApiUrl: string;\n oidcApiUrl: string;\n userStorageApiUrl: string;\n};\n\nconst ENV_URLS: Record<Env, EnvUrlsEntry> = {\n dev: {\n authApiUrl: 'https://authentication.dev-api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.dev-api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.dev-api.cx.metamask.io',\n },\n uat: {\n authApiUrl: 'https://authentication.uat-api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.uat-api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.uat-api.cx.metamask.io',\n },\n prd: {\n authApiUrl: 'https://authentication.api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.api.cx.metamask.io',\n },\n};\n\n/**\n * Validates and returns correct environment endpoints\n *\n * @param env - environment field\n * @returns the correct environment url\n * @throws on invalid environment passed\n */\nexport function getEnvUrls(env: Env): EnvUrlsEntry {\n if (!ENV_URLS[env]) {\n throw new Error('invalid environment configuration');\n }\n return ENV_URLS[env];\n}\n\n/**\n * Returns the valid OIDC Client ID (used during authorization)\n *\n * @param env - environment field\n * @param platform - platform field\n * @returns the OIDC client id for the environment\n */\nexport function getOidcClientId(env: Env, platform: Platform): string {\n const clientIds = {\n [Env.DEV]: {\n [Platform.PORTFOLIO]: 'c7ca94a0-5d52-4635-9502-1a50a9c410cc',\n [Platform.MOBILE]: 'e83c7cc9-267d-4fb4-8fec-f0e3bbe5ae8e',\n [Platform.EXTENSION]: 'f1a963d7-50dc-4cb5-8d81-f1f3654f0df3',\n [Platform.INFURA]: 'bd887006-0d55-481a-a395-5ff9a0dc52c9',\n },\n [Env.UAT]: {\n [Platform.PORTFOLIO]: '8f2dd4ac-db07-4819-9ba5-1ee0ec1b56d1',\n [Platform.MOBILE]: 'c3cfdcd2-51d6-4fae-ad2c-ff238c8fef53',\n [Platform.EXTENSION]: 'a9de167c-c9a6-43d8-af39-d301fd44c485',\n [Platform.INFURA]: '01929890-7002-4c97-9913-8f6c09a6d674',\n },\n [Env.PRD]: {\n [Platform.PORTFOLIO]: '35e1cd62-49c5-4be8-8b6e-a5212f2d2cfb',\n [Platform.MOBILE]: '75fa62a3-9ca0-4b91-9fe5-76bec86b0257',\n [Platform.EXTENSION]: '1132f10a-b4e5-4390-a5f2-d9c6022db564',\n [Platform.INFURA]: 'fdde9417-e193-4d23-9943-a8346b18d097',\n },\n };\n\n if (!clientIds[env]) {\n throw new Error(`invalid env ${env}: cannot determine oidc client id`);\n }\n\n if (!clientIds[env][platform]) {\n throw new Error(\n `invalid env ${env} and platform ${platform} combination: cannot determine oidc client id`,\n );\n }\n\n return clientIds[env][platform];\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|