@metamask-previews/profile-sync-controller 28.0.2-preview-d23d9dc44 → 28.0.2-preview-a1caffc9c
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 +2 -17
- package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts +6 -36
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts +6 -36
- 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 +6 -111
- package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts +7 -43
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts +7 -43
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.mjs +6 -111
- package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
- package/dist/controllers/authentication/index.cjs.map +1 -1
- package/dist/controllers/authentication/index.d.cts +1 -1
- package/dist/controllers/authentication/index.d.cts.map +1 -1
- package/dist/controllers/authentication/index.d.mts +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/mockResponses.cjs +1 -10
- package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.cts +32 -17
- package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.mts +32 -17
- package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.mjs +1 -9
- package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +1 -28
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +0 -2
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +0 -2
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +2 -29
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs +1 -59
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts +1 -17
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts +1 -17
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs +0 -56
- 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 -20
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts +1 -20
- 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 +0 -4
- package/dist/sdk/authentication.cjs.map +1 -1
- package/dist/sdk/authentication.d.cts +0 -2
- package/dist/sdk/authentication.d.cts.map +1 -1
- package/dist/sdk/authentication.d.mts +0 -2
- package/dist/sdk/authentication.d.mts.map +1 -1
- package/dist/sdk/authentication.mjs +0 -4
- package/dist/sdk/authentication.mjs.map +1 -1
- package/dist/sdk/mocks/auth.cjs +1 -11
- package/dist/sdk/mocks/auth.cjs.map +1 -1
- package/dist/sdk/mocks/auth.d.cts +0 -10
- package/dist/sdk/mocks/auth.d.cts.map +1 -1
- package/dist/sdk/mocks/auth.d.mts +0 -10
- package/dist/sdk/mocks/auth.d.mts.map +1 -1
- package/dist/sdk/mocks/auth.mjs +1 -11
- package/dist/sdk/mocks/auth.mjs.map +1 -1
- package/dist/sdk/user-storage.cjs +3 -26
- package/dist/sdk/user-storage.cjs.map +1 -1
- package/dist/sdk/user-storage.d.cts +0 -7
- package/dist/sdk/user-storage.d.cts.map +1 -1
- package/dist/sdk/user-storage.d.mts +0 -7
- package/dist/sdk/user-storage.d.mts.map +1 -1
- package/dist/sdk/user-storage.mjs +3 -26
- package/dist/sdk/user-storage.mjs.map +1 -1
- package/dist/shared/types/services.cjs.map +1 -1
- package/dist/shared/types/services.d.cts +0 -7
- package/dist/shared/types/services.d.cts.map +1 -1
- package/dist/shared/types/services.d.mts +0 -7
- package/dist/shared/types/services.d.mts.map +1 -1
- package/dist/shared/types/services.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +0 -27
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts +0 -13
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts +0 -13
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +0 -1
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs +0 -23
- package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +0 -1
- package/dist/sdk/utils/validate-pair-response.cjs +0 -29
- package/dist/sdk/utils/validate-pair-response.cjs.map +0 -1
- package/dist/sdk/utils/validate-pair-response.d.cts +0 -26
- package/dist/sdk/utils/validate-pair-response.d.cts.map +0 -1
- package/dist/sdk/utils/validate-pair-response.d.mts +0 -26
- package/dist/sdk/utils/validate-pair-response.d.mts.map +0 -1
- package/dist/sdk/utils/validate-pair-response.mjs +0 -25
- package/dist/sdk/utils/validate-pair-response.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.cjs","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":";;;AAAA,qEAA8D;AAGjD,QAAA,eAAe,GAAwB;IAClD,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,SAAiB,EAAE,GAAQ;IAC7D,MAAM,IAAI,GAAG,uBAAe,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,IAAA,6BAAgB,EAAC,SAAS,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC;AAND,kDAMC","sourcesContent":["import { createSHA256Hash } from '../../../shared/encryption';\nimport type { Env } from '../../../shared/env';\n\nexport const IDENTIFIER_SALT: Record<Env, string> = {\n dev: 'Baiche1eu8Oa2een5ieReul0Phooph4e',\n uat: 'wooG2Nahd4juviiw7cooxa7ekaeNgeik',\n prd: 'oCheThi4lohv5choGhuosh1aiT2phioF',\n};\n\n/**\n * Computes a deterministic identifier ID by hashing a public key with an\n * environment-specific salt. Matches the server-side formula:\n * SHA256(publicKey + salt).\n *\n * @param publicKey - The raw SRP public key\n * @param env - The environment whose salt to use\n * @returns The hex-encoded SHA256 hash used as identifier_id\n */\nexport function computeIdentifierId(publicKey: string, env: Env): string {\n const salt = IDENTIFIER_SALT[env];\n if (!salt) {\n throw new Error('Cannot compute identifier ID: invalid environment');\n }\n return createSHA256Hash(publicKey + salt);\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Env } from "../../../shared/env.cjs";
|
|
2
|
-
export declare const IDENTIFIER_SALT: Record<Env, string>;
|
|
3
|
-
/**
|
|
4
|
-
* Computes a deterministic identifier ID by hashing a public key with an
|
|
5
|
-
* environment-specific salt. Matches the server-side formula:
|
|
6
|
-
* SHA256(publicKey + salt).
|
|
7
|
-
*
|
|
8
|
-
* @param publicKey - The raw SRP public key
|
|
9
|
-
* @param env - The environment whose salt to use
|
|
10
|
-
* @returns The hex-encoded SHA256 hash used as identifier_id
|
|
11
|
-
*/
|
|
12
|
-
export declare function computeIdentifierId(publicKey: string, env: Env): string;
|
|
13
|
-
//# sourceMappingURL=identifier.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.d.cts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,gCAA4B;AAE/C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAI/C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAMvE"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Env } from "../../../shared/env.mjs";
|
|
2
|
-
export declare const IDENTIFIER_SALT: Record<Env, string>;
|
|
3
|
-
/**
|
|
4
|
-
* Computes a deterministic identifier ID by hashing a public key with an
|
|
5
|
-
* environment-specific salt. Matches the server-side formula:
|
|
6
|
-
* SHA256(publicKey + salt).
|
|
7
|
-
*
|
|
8
|
-
* @param publicKey - The raw SRP public key
|
|
9
|
-
* @param env - The environment whose salt to use
|
|
10
|
-
* @returns The hex-encoded SHA256 hash used as identifier_id
|
|
11
|
-
*/
|
|
12
|
-
export declare function computeIdentifierId(publicKey: string, env: Env): string;
|
|
13
|
-
//# sourceMappingURL=identifier.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.d.mts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,gCAA4B;AAE/C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAI/C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAMvE"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createSHA256Hash } from "../../../shared/encryption/index.mjs";
|
|
2
|
-
export const IDENTIFIER_SALT = {
|
|
3
|
-
dev: 'Baiche1eu8Oa2een5ieReul0Phooph4e',
|
|
4
|
-
uat: 'wooG2Nahd4juviiw7cooxa7ekaeNgeik',
|
|
5
|
-
prd: 'oCheThi4lohv5choGhuosh1aiT2phioF',
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Computes a deterministic identifier ID by hashing a public key with an
|
|
9
|
-
* environment-specific salt. Matches the server-side formula:
|
|
10
|
-
* SHA256(publicKey + salt).
|
|
11
|
-
*
|
|
12
|
-
* @param publicKey - The raw SRP public key
|
|
13
|
-
* @param env - The environment whose salt to use
|
|
14
|
-
* @returns The hex-encoded SHA256 hash used as identifier_id
|
|
15
|
-
*/
|
|
16
|
-
export function computeIdentifierId(publicKey, env) {
|
|
17
|
-
const salt = IDENTIFIER_SALT[env];
|
|
18
|
-
if (!salt) {
|
|
19
|
-
throw new Error('Cannot compute identifier ID: invalid environment');
|
|
20
|
-
}
|
|
21
|
-
return createSHA256Hash(publicKey + salt);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=identifier.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.mjs","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/utils/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,6CAAmC;AAG9D,MAAM,CAAC,MAAM,eAAe,GAAwB;IAClD,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;IACvC,GAAG,EAAE,kCAAkC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,GAAQ;IAC7D,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,gBAAgB,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { createSHA256Hash } from '../../../shared/encryption';\nimport type { Env } from '../../../shared/env';\n\nexport const IDENTIFIER_SALT: Record<Env, string> = {\n dev: 'Baiche1eu8Oa2een5ieReul0Phooph4e',\n uat: 'wooG2Nahd4juviiw7cooxa7ekaeNgeik',\n prd: 'oCheThi4lohv5choGhuosh1aiT2phioF',\n};\n\n/**\n * Computes a deterministic identifier ID by hashing a public key with an\n * environment-specific salt. Matches the server-side formula:\n * SHA256(publicKey + salt).\n *\n * @param publicKey - The raw SRP public key\n * @param env - The environment whose salt to use\n * @returns The hex-encoded SHA256 hash used as identifier_id\n */\nexport function computeIdentifierId(publicKey: string, env: Env): string {\n const salt = IDENTIFIER_SALT[env];\n if (!salt) {\n throw new Error('Cannot compute identifier ID: invalid environment');\n }\n return createSHA256Hash(publicKey + salt);\n}\n"]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.validatePairResponse = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* Asserts that the raw API response from the profile pairing endpoint has the
|
|
7
|
-
* expected shape before we attempt to map it into a `PairProfilesResponse`.
|
|
8
|
-
* Throws if the response is malformed.
|
|
9
|
-
*
|
|
10
|
-
* @param input - The raw JSON parsed from the pair endpoint response body.
|
|
11
|
-
*/
|
|
12
|
-
function validatePairResponse(input) {
|
|
13
|
-
if (!input || typeof input !== 'object') {
|
|
14
|
-
throw new Error('validatePairResponse: input is not an object');
|
|
15
|
-
}
|
|
16
|
-
const assumed = input;
|
|
17
|
-
const profile = assumed.profile;
|
|
18
|
-
if (!profile || typeof profile !== 'object') {
|
|
19
|
-
throw new Error('validatePairResponse: profile is missing or not an object');
|
|
20
|
-
}
|
|
21
|
-
if (typeof profile.profile_id !== 'string' || !profile.profile_id) {
|
|
22
|
-
throw new Error('validatePairResponse: profile.profile_id is missing or empty');
|
|
23
|
-
}
|
|
24
|
-
if (typeof profile.identifier_id !== 'string' || !profile.identifier_id) {
|
|
25
|
-
throw new Error('validatePairResponse: profile.identifier_id is missing or empty');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.validatePairResponse = validatePairResponse;
|
|
29
|
-
//# sourceMappingURL=validate-pair-response.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-pair-response.cjs","sourceRoot":"","sources":["../../../src/sdk/utils/validate-pair-response.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAiBzD;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAClC,KAAc;IAEd,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,OAAO,GAAG,KAAgC,CAAC;IACjD,MAAM,OAAO,GAAG,OAAO,CAAC,OAA8C,CAAC;IACvE,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,OAAO,CAAC,aAAa,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,CAAC;AACH,CAAC;AA1BD,oDA0BC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\ntype RawProfileAlias = {\n alias_profile_id: string;\n canonical_profile_id: string;\n identifier_ids: { id: string; type: string }[];\n};\n\nexport type RawPairResponse = {\n profile: {\n profile_id: string;\n identifier_id: string;\n metametrics_id?: string;\n };\n profile_aliases?: RawProfileAlias[];\n};\n\n/**\n * Asserts that the raw API response from the profile pairing endpoint has the\n * expected shape before we attempt to map it into a `PairProfilesResponse`.\n * Throws if the response is malformed.\n *\n * @param input - The raw JSON parsed from the pair endpoint response body.\n */\nexport function validatePairResponse(\n input: unknown,\n): asserts input is RawPairResponse {\n if (!input || typeof input !== 'object') {\n throw new Error('validatePairResponse: input is not an object');\n }\n\n const assumed = input as Record<string, unknown>;\n const profile = assumed.profile as Record<string, unknown> | undefined;\n if (!profile || typeof profile !== 'object') {\n throw new Error(\n 'validatePairResponse: profile is missing or not an object',\n );\n }\n\n if (typeof profile.profile_id !== 'string' || !profile.profile_id) {\n throw new Error(\n 'validatePairResponse: profile.profile_id is missing or empty',\n );\n }\n\n if (typeof profile.identifier_id !== 'string' || !profile.identifier_id) {\n throw new Error(\n 'validatePairResponse: profile.identifier_id is missing or empty',\n );\n }\n}\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
type RawProfileAlias = {
|
|
2
|
-
alias_profile_id: string;
|
|
3
|
-
canonical_profile_id: string;
|
|
4
|
-
identifier_ids: {
|
|
5
|
-
id: string;
|
|
6
|
-
type: string;
|
|
7
|
-
}[];
|
|
8
|
-
};
|
|
9
|
-
export type RawPairResponse = {
|
|
10
|
-
profile: {
|
|
11
|
-
profile_id: string;
|
|
12
|
-
identifier_id: string;
|
|
13
|
-
metametrics_id?: string;
|
|
14
|
-
};
|
|
15
|
-
profile_aliases?: RawProfileAlias[];
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Asserts that the raw API response from the profile pairing endpoint has the
|
|
19
|
-
* expected shape before we attempt to map it into a `PairProfilesResponse`.
|
|
20
|
-
* Throws if the response is malformed.
|
|
21
|
-
*
|
|
22
|
-
* @param input - The raw JSON parsed from the pair endpoint response body.
|
|
23
|
-
*/
|
|
24
|
-
export declare function validatePairResponse(input: unknown): asserts input is RawPairResponse;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=validate-pair-response.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-pair-response.d.cts","sourceRoot":"","sources":["../../../src/sdk/utils/validate-pair-response.ts"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;CACrC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,eAAe,CAwBlC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
type RawProfileAlias = {
|
|
2
|
-
alias_profile_id: string;
|
|
3
|
-
canonical_profile_id: string;
|
|
4
|
-
identifier_ids: {
|
|
5
|
-
id: string;
|
|
6
|
-
type: string;
|
|
7
|
-
}[];
|
|
8
|
-
};
|
|
9
|
-
export type RawPairResponse = {
|
|
10
|
-
profile: {
|
|
11
|
-
profile_id: string;
|
|
12
|
-
identifier_id: string;
|
|
13
|
-
metametrics_id?: string;
|
|
14
|
-
};
|
|
15
|
-
profile_aliases?: RawProfileAlias[];
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Asserts that the raw API response from the profile pairing endpoint has the
|
|
19
|
-
* expected shape before we attempt to map it into a `PairProfilesResponse`.
|
|
20
|
-
* Throws if the response is malformed.
|
|
21
|
-
*
|
|
22
|
-
* @param input - The raw JSON parsed from the pair endpoint response body.
|
|
23
|
-
*/
|
|
24
|
-
export declare function validatePairResponse(input: unknown): asserts input is RawPairResponse;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=validate-pair-response.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-pair-response.d.mts","sourceRoot":"","sources":["../../../src/sdk/utils/validate-pair-response.ts"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;CACrC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,eAAe,CAwBlC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
/**
|
|
3
|
-
* Asserts that the raw API response from the profile pairing endpoint has the
|
|
4
|
-
* expected shape before we attempt to map it into a `PairProfilesResponse`.
|
|
5
|
-
* Throws if the response is malformed.
|
|
6
|
-
*
|
|
7
|
-
* @param input - The raw JSON parsed from the pair endpoint response body.
|
|
8
|
-
*/
|
|
9
|
-
export function validatePairResponse(input) {
|
|
10
|
-
if (!input || typeof input !== 'object') {
|
|
11
|
-
throw new Error('validatePairResponse: input is not an object');
|
|
12
|
-
}
|
|
13
|
-
const assumed = input;
|
|
14
|
-
const profile = assumed.profile;
|
|
15
|
-
if (!profile || typeof profile !== 'object') {
|
|
16
|
-
throw new Error('validatePairResponse: profile is missing or not an object');
|
|
17
|
-
}
|
|
18
|
-
if (typeof profile.profile_id !== 'string' || !profile.profile_id) {
|
|
19
|
-
throw new Error('validatePairResponse: profile.profile_id is missing or empty');
|
|
20
|
-
}
|
|
21
|
-
if (typeof profile.identifier_id !== 'string' || !profile.identifier_id) {
|
|
22
|
-
throw new Error('validatePairResponse: profile.identifier_id is missing or empty');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=validate-pair-response.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-pair-response.mjs","sourceRoot":"","sources":["../../../src/sdk/utils/validate-pair-response.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAiBzD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAc;IAEd,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,OAAO,GAAG,KAAgC,CAAC;IACjD,MAAM,OAAO,GAAG,OAAO,CAAC,OAA8C,CAAC;IACvE,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,OAAO,CAAC,aAAa,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\ntype RawProfileAlias = {\n alias_profile_id: string;\n canonical_profile_id: string;\n identifier_ids: { id: string; type: string }[];\n};\n\nexport type RawPairResponse = {\n profile: {\n profile_id: string;\n identifier_id: string;\n metametrics_id?: string;\n };\n profile_aliases?: RawProfileAlias[];\n};\n\n/**\n * Asserts that the raw API response from the profile pairing endpoint has the\n * expected shape before we attempt to map it into a `PairProfilesResponse`.\n * Throws if the response is malformed.\n *\n * @param input - The raw JSON parsed from the pair endpoint response body.\n */\nexport function validatePairResponse(\n input: unknown,\n): asserts input is RawPairResponse {\n if (!input || typeof input !== 'object') {\n throw new Error('validatePairResponse: input is not an object');\n }\n\n const assumed = input as Record<string, unknown>;\n const profile = assumed.profile as Record<string, unknown> | undefined;\n if (!profile || typeof profile !== 'object') {\n throw new Error(\n 'validatePairResponse: profile is missing or not an object',\n );\n }\n\n if (typeof profile.profile_id !== 'string' || !profile.profile_id) {\n throw new Error(\n 'validatePairResponse: profile.profile_id is missing or empty',\n );\n }\n\n if (typeof profile.identifier_id !== 'string' || !profile.identifier_id) {\n throw new Error(\n 'validatePairResponse: profile.identifier_id is missing or empty',\n );\n }\n}\n"]}
|