@metamask-previews/profile-sync-controller 28.0.2-preview-45a82ea8e → 28.0.2-preview-d8ff44d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +1 -1
  3. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts +36 -6
  4. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +1 -1
  5. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts +36 -6
  6. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts.map +1 -1
  7. package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +1 -1
  8. package/dist/controllers/authentication/AuthenticationController.cjs +111 -6
  9. package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
  10. package/dist/controllers/authentication/AuthenticationController.d.cts +43 -7
  11. package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
  12. package/dist/controllers/authentication/AuthenticationController.d.mts +43 -7
  13. package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
  14. package/dist/controllers/authentication/AuthenticationController.mjs +111 -6
  15. package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
  16. package/dist/controllers/authentication/index.cjs.map +1 -1
  17. package/dist/controllers/authentication/index.d.cts +1 -1
  18. package/dist/controllers/authentication/index.d.cts.map +1 -1
  19. package/dist/controllers/authentication/index.d.mts +1 -1
  20. package/dist/controllers/authentication/index.d.mts.map +1 -1
  21. package/dist/controllers/authentication/index.mjs.map +1 -1
  22. package/dist/controllers/authentication/mocks/mockResponses.cjs +10 -1
  23. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
  24. package/dist/controllers/authentication/mocks/mockResponses.d.cts +17 -32
  25. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -1
  26. package/dist/controllers/authentication/mocks/mockResponses.d.mts +17 -32
  27. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -1
  28. package/dist/controllers/authentication/mocks/mockResponses.mjs +9 -1
  29. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
  30. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +28 -1
  31. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
  32. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +2 -0
  33. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
  34. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +2 -0
  35. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
  36. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +29 -2
  37. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
  38. package/dist/sdk/authentication-jwt-bearer/services.cjs +59 -1
  39. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
  40. package/dist/sdk/authentication-jwt-bearer/services.d.cts +17 -1
  41. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
  42. package/dist/sdk/authentication-jwt-bearer/services.d.mts +17 -1
  43. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
  44. package/dist/sdk/authentication-jwt-bearer/services.mjs +56 -0
  45. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
  46. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
  47. package/dist/sdk/authentication-jwt-bearer/types.d.cts +20 -1
  48. package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
  49. package/dist/sdk/authentication-jwt-bearer/types.d.mts +20 -1
  50. package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -1
  51. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
  52. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +27 -0
  53. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +1 -0
  54. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts +13 -0
  55. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +1 -0
  56. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts +13 -0
  57. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +1 -0
  58. package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs +23 -0
  59. package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +1 -0
  60. package/dist/sdk/authentication.cjs +4 -0
  61. package/dist/sdk/authentication.cjs.map +1 -1
  62. package/dist/sdk/authentication.d.cts +2 -0
  63. package/dist/sdk/authentication.d.cts.map +1 -1
  64. package/dist/sdk/authentication.d.mts +2 -0
  65. package/dist/sdk/authentication.d.mts.map +1 -1
  66. package/dist/sdk/authentication.mjs +4 -0
  67. package/dist/sdk/authentication.mjs.map +1 -1
  68. package/dist/sdk/mocks/auth.cjs +11 -1
  69. package/dist/sdk/mocks/auth.cjs.map +1 -1
  70. package/dist/sdk/mocks/auth.d.cts +10 -0
  71. package/dist/sdk/mocks/auth.d.cts.map +1 -1
  72. package/dist/sdk/mocks/auth.d.mts +10 -0
  73. package/dist/sdk/mocks/auth.d.mts.map +1 -1
  74. package/dist/sdk/mocks/auth.mjs +11 -1
  75. package/dist/sdk/mocks/auth.mjs.map +1 -1
  76. package/dist/sdk/user-storage.cjs +26 -3
  77. package/dist/sdk/user-storage.cjs.map +1 -1
  78. package/dist/sdk/user-storage.d.cts +7 -0
  79. package/dist/sdk/user-storage.d.cts.map +1 -1
  80. package/dist/sdk/user-storage.d.mts +7 -0
  81. package/dist/sdk/user-storage.d.mts.map +1 -1
  82. package/dist/sdk/user-storage.mjs +26 -3
  83. package/dist/sdk/user-storage.mjs.map +1 -1
  84. package/dist/sdk/utils/validate-pair-response.cjs +29 -0
  85. package/dist/sdk/utils/validate-pair-response.cjs.map +1 -0
  86. package/dist/sdk/utils/validate-pair-response.d.cts +26 -0
  87. package/dist/sdk/utils/validate-pair-response.d.cts.map +1 -0
  88. package/dist/sdk/utils/validate-pair-response.d.mts +26 -0
  89. package/dist/sdk/utils/validate-pair-response.d.mts.map +1 -0
  90. package/dist/sdk/utils/validate-pair-response.mjs +25 -0
  91. package/dist/sdk/utils/validate-pair-response.mjs.map +1 -0
  92. package/dist/shared/types/services.cjs.map +1 -1
  93. package/dist/shared/types/services.d.cts +7 -0
  94. package/dist/shared/types/services.d.cts.map +1 -1
  95. package/dist/shared/types/services.d.mts +7 -0
  96. package/dist/shared/types/services.d.mts.map +1 -1
  97. package/dist/shared/types/services.mjs.map +1 -1
  98. package/package.json +4 -4
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,23 @@
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
@@ -0,0 +1 @@
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"]}
@@ -74,6 +74,10 @@ class JwtBearerAuth {
74
74
  async getUserProfileLineage(entropySourceId) {
75
75
  return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getUserProfileLineage(entropySourceId);
76
76
  }
77
+ async pairSrpProfiles(accessTokens, authAccessToken) {
78
+ __classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSRP).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
79
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").pairSrpProfiles(accessTokens, authAccessToken);
80
+ }
77
81
  async signMessage(message, entropySourceId) {
78
82
  return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").signMessage(message, entropySourceId);
79
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.cjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,yEAA0E;AAC1E,uEAAwE;AACxE,uEAG8C;AAM9C,iEAA6D;AAC7D,yCAA+D;AAY/D,MAAa,aAAa;IAOxB,YAAY,GAAG,IAAyB;;QAN/B,sCAAgB;QAEhB,qCAAU;QAEV,qCAA2C;QAGlD,uBAAA,IAAI,uBAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAA,CAAC;QAC1B,uBAAA,IAAI,sBAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,CAAC;QAExB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAQ,CAAC,GAAG,EAAE,CAAC;YAClC,uBAAA,IAAI,sBAAQ,IAAI,2BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,uBAAA,IAAI,sBAAQ,IAAI,6BAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACpD,OAAO;QACT,CAAC;QAED,MAAM,IAAI,iCAAwB,CAAC,uB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,MAAhB,IAAI,EAAa,uBAAA,IAAI,2BAAM,EAAE,uBAAA,IAAI,0BAAK,CAAC,CAAC;QACxC,uBAAA,IAAI,0BAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CA2BF;AAjID,sCAiIC;sNAxBG,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,gBAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,iCAAwB,CAChC,kDAAkD,CACnD,CAAC;AACJ,CAAC,+DAGC,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,gBAAQ,CAAC,GAAG,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,iCAAwB,CAChC,iDAAiD,CAClD,CAAC;AACJ,CAAC;AAGH,uEAA0E;AAAjE,8GAAA,iBAAiB,OAAA;AAC1B,qEAAwE;AAA/D,4GAAA,gBAAgB,OAAA;AACzB,wEAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport type { Env } from '../shared/env';\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type {\n UserProfile,\n Pair,\n UserProfileLineage,\n} from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\nexport type SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getAccessToken(entropySourceId);\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n return await this.#sdk.getUserProfile(entropySourceId);\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n return await this.#sdk.getUserProfileLineage(entropySourceId);\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.signMessage(message, entropySourceId);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n raw_message: raw,\n encrypted_storage_key: p.encryptedStorageKey,\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
1
+ {"version":3,"file":"authentication.cjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,yEAA0E;AAC1E,uEAAwE;AACxE,uEAG8C;AAO9C,iEAA6D;AAC7D,yCAA+D;AAY/D,MAAa,aAAa;IAOxB,YAAY,GAAG,IAAyB;;QAN/B,sCAAgB;QAEhB,qCAAU;QAEV,qCAA2C;QAGlD,uBAAA,IAAI,uBAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAA,CAAC;QAC1B,uBAAA,IAAI,sBAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,CAAC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,iDAAiD,CAClD,CAAC;AACJ,CAAC;AAGH,uEAA0E;AAAjE,8GAAA,iBAAiB,OAAA;AAC1B,qEAAwE;AAA/D,4GAAA,gBAAgB,OAAA;AACzB,wEAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport type { Env } from '../shared/env';\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { PairProfilesResponse } from './authentication-jwt-bearer/services';\nimport type {\n UserProfile,\n Pair,\n UserProfileLineage,\n} from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\nexport type SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getAccessToken(entropySourceId);\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n return await this.#sdk.getUserProfile(entropySourceId);\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n return await this.#sdk.getUserProfileLineage(entropySourceId);\n }\n\n async pairSrpProfiles(\n accessTokens: string[],\n authAccessToken: string,\n ): Promise<PairProfilesResponse> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.pairSrpProfiles(accessTokens, authAccessToken);\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.signMessage(message, entropySourceId);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n raw_message: raw,\n encrypted_storage_key: p.encryptedStorageKey,\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { Eip1193Provider } from "ethers";
2
2
  import { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.cjs";
3
3
  import { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.cjs";
4
+ import type { PairProfilesResponse } from "./authentication-jwt-bearer/services.cjs";
4
5
  import type { UserProfile, Pair, UserProfileLineage } from "./authentication-jwt-bearer/types.cjs";
5
6
  type Compute<T> = T extends infer U ? {
6
7
  [K in keyof U]: U[K];
@@ -20,6 +21,7 @@ export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
20
21
  getUserProfile(entropySourceId?: string): Promise<UserProfile>;
21
22
  getIdentifier(entropySourceId?: string): Promise<string>;
22
23
  getUserProfileLineage(entropySourceId?: string): Promise<UserProfileLineage>;
24
+ pairSrpProfiles(accessTokens: string[], authAccessToken: string): Promise<PairProfilesResponse>;
23
25
  signMessage(message: string, entropySourceId?: string): Promise<string>;
24
26
  pairIdentifiers(pairing: Pair[]): Promise<void>;
25
27
  prepare(signer: {
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.d.cts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"m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;gBAOnD,GAAG,IAAI,EAAE,mBAAmB;IAiBxC,iBAAiB,CAAC,QAAQ,EAAE,eAAe;IAKrC,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAK9B,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAKnC,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI9D,aAAa,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,qBAAqB,CACzB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,kBAAkB,CAAC;IAIxB,eAAe,CACnB,YAAY,EAAE,MAAM,EAAE,EACtB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,CAAC;IAK1B,WAAW,CACf,OAAO,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC;IAIZ,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BrD,OAAO,CAAC,MAAM,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;CA8BT;AAED,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD"}
@@ -1,6 +1,7 @@
1
1
  import type { Eip1193Provider } from "ethers";
2
2
  import { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.mjs";
3
3
  import { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.mjs";
4
+ import type { PairProfilesResponse } from "./authentication-jwt-bearer/services.mjs";
4
5
  import type { UserProfile, Pair, UserProfileLineage } from "./authentication-jwt-bearer/types.mjs";
5
6
  type Compute<T> = T extends infer U ? {
6
7
  [K in keyof U]: U[K];
@@ -20,6 +21,7 @@ export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
20
21
  getUserProfile(entropySourceId?: string): Promise<UserProfile>;
21
22
  getIdentifier(entropySourceId?: string): Promise<string>;
22
23
  getUserProfileLineage(entropySourceId?: string): Promise<UserProfileLineage>;
24
+ pairSrpProfiles(accessTokens: string[], authAccessToken: string): Promise<PairProfilesResponse>;
23
25
  signMessage(message: string, entropySourceId?: string): Promise<string>;
24
26
  pairIdentifiers(pairing: Pair[]): Promise<void>;
25
27
  prepare(signer: {
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.d.mts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe;AAG9C,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AAKxE,OAAO,KAAK,EACV,WAAW,EACX,IAAI,EACJ,kBAAkB,EACnB,8CAA0C;AAM3C,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC;AACvE,KAAK,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChD,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAErD,KAAK,UAAU,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,KAAK,SAAS,GAAG,qBAAqB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,KAAK,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD,qBAAa,aAAc,YA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AC,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BrD,OAAO,CAAC,MAAM,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;CA8BT;AAED,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD"}
@@ -57,6 +57,10 @@ export class JwtBearerAuth {
57
57
  async getUserProfileLineage(entropySourceId) {
58
58
  return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getUserProfileLineage(entropySourceId);
59
59
  }
60
+ async pairSrpProfiles(accessTokens, authAccessToken) {
61
+ __classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSRP).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
62
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").pairSrpProfiles(accessTokens, authAccessToken);
63
+ }
60
64
  async signMessage(message, entropySourceId) {
61
65
  return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").signMessage(message, entropySourceId);
62
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.mjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,OAAO,EACL,QAAQ,EACR,eAAe,EAChB,iDAA6C;AAM9C,OAAO,EAAE,QAAQ,EAAE,8CAA0C;AAC7D,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,qBAAiB;AAY/D,MAAM,OAA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AiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport type { Env } from '../shared/env';\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type {\n UserProfile,\n Pair,\n UserProfileLineage,\n} from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\nexport type SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getAccessToken(entropySourceId);\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n return await this.#sdk.getUserProfile(entropySourceId);\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n return await this.#sdk.getUserProfileLineage(entropySourceId);\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.signMessage(message, entropySourceId);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n raw_message: raw,\n encrypted_storage_key: p.encryptedStorageKey,\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
1
+ {"version":3,"file":"authentication.mjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,OAAO,EACL,QAAQ,EACR,eAAe,EAChB,iDAA6C;AAO9C,OAAO,EAAE,QAAQ,EAAE,8CAA0C;AAC7D,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,qBAAiB;AAY/D,MAAM,OAAO,aAAa;IAOxB,YAAY,GAAG,IAAyB;;QAN/B,sCAAgB;QAEhB,qCAAU;QAEV,qCAA2C;QAGlD,uBAAA,IAAI,uBAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAA,CAAC;QAC1B,uBAAA,IAAI,sBAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,CAAC;QAExB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,CAAC;YAClC,uBAAA,IAAI,sBAAQ,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,uBAAA,IAAI,sBAAQ,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC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AAM,IAAI,SAAS,CACjB,mCAAmC,YAAY,EAAE,CAClD,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CACH,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAChD,MAAM,eAAe,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,uBAAA,IAAI,0BAAK,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,CAAC,MAKP;QACC,uBAAA,IAAI,2DAAY,MAAhB,IAAI,EAAa,uBAAA,IAAI,2BAAM,EAAE,uBAAA,IAAI,0BAAK,CAAC,CAAC;QACxC,uBAAA,IAAI,0BAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CA2BF;sNAxBG,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,wBAAwB,CAChC,kDAAkD,CACnD,CAAC;AACJ,CAAC,+DAGC,IAAc,EACd,IAA0C;IAE1C,IAAI,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,wBAAwB,CAChC,iDAAiD,CAClD,CAAC;AACJ,CAAC;AAGH,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD","sourcesContent":["import type { Eip1193Provider } from 'ethers';\n\nimport type { Env } from '../shared/env';\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { PairProfilesResponse } from './authentication-jwt-bearer/services';\nimport type {\n UserProfile,\n Pair,\n UserProfileLineage,\n} from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\nexport type SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getAccessToken(entropySourceId);\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n return await this.#sdk.getUserProfile(entropySourceId);\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n return await this.#sdk.getUserProfileLineage(entropySourceId);\n }\n\n async pairSrpProfiles(\n accessTokens: string[],\n authAccessToken: string,\n ): Promise<PairProfilesResponse> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.pairSrpProfiles(accessTokens, authAccessToken);\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.signMessage(message, entropySourceId);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n raw_message: raw,\n encrypted_storage_key: p.encryptedStorageKey,\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MOCK_USER_PROFILE_LINEAGE_RESPONSE = exports.MOCK_OIDC_TOKEN_RESPONSE = exports.MOCK_SRP_LOGIN_RESPONSE = exports.MOCK_SIWE_LOGIN_RESPONSE = exports.MOCK_NONCE_RESPONSE = exports.MOCK_ACCESS_JWT = exports.MOCK_JWT = exports.MOCK_PROFILE_LINEAGE_URL = exports.MOCK_PAIR_IDENTIFIERS_URL = exports.MOCK_SIWE_LOGIN_URL = exports.MOCK_OIDC_TOKEN_URL = exports.MOCK_SRP_LOGIN_URL = exports.MOCK_NONCE_URL = void 0;
3
+ exports.MOCK_USER_PROFILE_LINEAGE_RESPONSE = exports.MOCK_PAIR_PROFILES_RESPONSE = exports.MOCK_OIDC_TOKEN_RESPONSE = exports.MOCK_SRP_LOGIN_RESPONSE = exports.MOCK_SIWE_LOGIN_RESPONSE = exports.MOCK_NONCE_RESPONSE = exports.MOCK_ACCESS_JWT = exports.MOCK_JWT = exports.MOCK_PROFILE_LINEAGE_URL = exports.MOCK_PAIR_PROFILES_URL = exports.MOCK_PAIR_IDENTIFIERS_URL = exports.MOCK_SIWE_LOGIN_URL = exports.MOCK_OIDC_TOKEN_URL = exports.MOCK_SRP_LOGIN_URL = exports.MOCK_NONCE_URL = void 0;
4
4
  const env_1 = require("../../shared/env.cjs");
5
5
  const services_1 = require("../authentication-jwt-bearer/services.cjs");
6
6
  exports.MOCK_NONCE_URL = (0, services_1.NONCE_URL)(env_1.Env.PRD);
@@ -8,6 +8,7 @@ exports.MOCK_SRP_LOGIN_URL = (0, services_1.SRP_LOGIN_URL)(env_1.Env.PRD);
8
8
  exports.MOCK_OIDC_TOKEN_URL = (0, services_1.OIDC_TOKEN_URL)(env_1.Env.PRD);
9
9
  exports.MOCK_SIWE_LOGIN_URL = (0, services_1.SIWE_LOGIN_URL)(env_1.Env.PRD);
10
10
  exports.MOCK_PAIR_IDENTIFIERS_URL = (0, services_1.PAIR_IDENTIFIERS)(env_1.Env.PRD);
11
+ exports.MOCK_PAIR_PROFILES_URL = (0, services_1.PAIR_PROFILES_URL)(env_1.Env.PRD);
11
12
  exports.MOCK_PROFILE_LINEAGE_URL = (0, services_1.PROFILE_LINEAGE_URL)(env_1.Env.PRD);
12
13
  exports.MOCK_JWT = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';
13
14
  exports.MOCK_ACCESS_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
@@ -37,11 +38,20 @@ exports.MOCK_SRP_LOGIN_RESPONSE = {
37
38
  identifier_type: 'SRP',
38
39
  encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',
39
40
  },
41
+ profile_aliases: [],
40
42
  };
41
43
  exports.MOCK_OIDC_TOKEN_RESPONSE = {
42
44
  access_token: exports.MOCK_ACCESS_JWT,
43
45
  expires_in: 3600,
44
46
  };
47
+ exports.MOCK_PAIR_PROFILES_RESPONSE = {
48
+ profile: {
49
+ identifier_id: exports.MOCK_SRP_LOGIN_RESPONSE.profile.identifier_id,
50
+ metametrics_id: exports.MOCK_SRP_LOGIN_RESPONSE.profile.metametrics_id,
51
+ profile_id: exports.MOCK_SRP_LOGIN_RESPONSE.profile.profile_id,
52
+ },
53
+ profile_aliases: [],
54
+ };
45
55
  exports.MOCK_USER_PROFILE_LINEAGE_RESPONSE = {
46
56
  profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',
47
57
  created_at: '2025-10-01T12:00:00Z',
@@ -1 +1 @@
1
- {"version":3,"file":"auth.cjs","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":";;;AAAA,8CAAiD;AACjD,wEAO+C;AAElC,QAAA,cAAc,GAAG,IAAA,oBAAS,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AACpC,QAAA,kBAAkB,GAAG,IAAA,wBAAa,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAA,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,QAAA,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,QAAA,yBAAyB,GAAG,IAAA,2BAAgB,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AACtD,QAAA,wBAAwB,GAAG,IAAA,8BAAmB,EAAC,SAAG,CAAC,GAAG,CA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CE_URL,\n SIWE_LOGIN_URL,\n SRP_LOGIN_URL,\n OIDC_TOKEN_URL,\n PAIR_IDENTIFIERS,\n PROFILE_LINEAGE_URL,\n} from '../authentication-jwt-bearer/services';\n\nexport const MOCK_NONCE_URL = NONCE_URL(Env.PRD);\nexport const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);\nexport const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);\nexport const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);\nexport const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);\nexport const MOCK_PROFILE_LINEAGE_URL = PROFILE_LINEAGE_URL(Env.PRD);\n\nexport const MOCK_JWT =\n 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';\n\nexport const MOCK_ACCESS_JWT =\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';\n\nexport const MOCK_NONCE_RESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n expires_in: 300,\n};\n\nexport const MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n identifier_type: 'SIWE',\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n identifier_type: 'SRP',\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n access_token: MOCK_ACCESS_JWT,\n expires_in: 3600,\n};\n\nexport const MOCK_USER_PROFILE_LINEAGE_RESPONSE = {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n created_at: '2025-10-01T12:00:00Z',\n lineage: [\n {\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n agent: Platform.MOBILE,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 1,\n },\n {\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n agent: Platform.EXTENSION,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 2,\n },\n ],\n};\n"]}
1
+ {"version":3,"file":"auth.cjs","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":";;;AAAA,8CAAiD;AACjD,wEAQ+C;AAElC,QAAA,cAAc,GAAG,IAAA,oBAAS,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AACpC,QAAA,kBAAkB,GAAG,IAAA,wBAAa,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAA,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,QAAA,mBAAmB,GAAG,IAAA,yBAAc,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAC9C,QAAA,yBAAyB,GAAG,IAAA,2BAAgB,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AACtD,QAAA,sBAAsB,GAAG,IAAA,4BAAiB,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AACpD,QAAA,wBAAwB,GAAG,IAAA,8BAAmB,EAAC,SAAG,CAAC,GAAG,CAAC,CAAC;AAExD,QAAA,QAAQ,GACnB,opBAAopB,CAAC;AAE1oB,QAAA,eAAe,GAC1B,mLAAmL,CAAC;AAEzK,QAAA,mBAAmB,GAAG;IACjC,KAAK,EAAE,kBAAkB;IACzB,UAAU,EAAE,4CAA4C;IACxD,UAAU,EAAE,GAAG;CAChB,CAAC;AAEW,QAAA,wBAAwB,GAAG;IACtC,KAAK,EAAE,gBAAQ;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,UAAU,EAAE,sCAAsC;QAClD,cAAc,EAAE,sCAAsC;QACtD,aAAa,EACX,kEAAkE;QACpE,eAAe,EAAE,MAAM;QACvB,qBAAqB,EAAE,iCAAiC;KACzD;CACF,CAAC;AAEW,QAAA,uBAAuB,GAAG;IACrC,KAAK,EAAE,gBAAQ;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,UAAU,EAAE,sCAAsC;QAClD,cAAc,EAAE,sCAAsC;QACtD,aAAa,EACX,kEAAkE;QACpE,eAAe,EAAE,KAAK;QACtB,qBAAqB,EAAE,4BAA4B;KACpD;IACD,eAAe,EAAE,EAAE;CACpB,CAAC;AAEW,QAAA,wBAAwB,GAAG;IACtC,YAAY,EAAE,uBAAe;IAC7B,UAAU,EAAE,IAAI;CACjB,CAAC;AAEW,QAAA,2BAA2B,GAAG;IACzC,OAAO,EAAE;QACP,aAAa,EAAE,+BAAuB,CAAC,OAAO,CAAC,aAAa;QAC5D,cAAc,EAAE,+BAAuB,CAAC,OAAO,CAAC,cAAc;QAC9D,UAAU,EAAE,+BAAuB,CAAC,OAAO,CAAC,UAAU;KACvD;IACD,eAAe,EAAE,EAAE;CACpB,CAAC;AAEW,QAAA,kCAAkC,GAAG;IAChD,UAAU,EAAE,sCAAsC;IAClD,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE;QACP;YACE,cAAc,EAAE,sCAAsC;YACtD,KAAK,EAAE,cAAQ,CAAC,MAAM;YACtB,UAAU,EAAE,sBAAsB;YAClC,UAAU,EAAE,sBAAsB;YAClC,OAAO,EAAE,CAAC;SACX;QACD;YACE,cAAc,EAAE,sCAAsC;YACtD,KAAK,EAAE,cAAQ,CAAC,SAAS;YACzB,UAAU,EAAE,sBAAsB;YAClC,UAAU,EAAE,sBAAsB;YAClC,OAAO,EAAE,CAAC;SACX;KACF;CACF,CAAC","sourcesContent":["import { Env, Platform } from '../../shared/env';\nimport {\n NONCE_URL,\n SIWE_LOGIN_URL,\n SRP_LOGIN_URL,\n OIDC_TOKEN_URL,\n PAIR_IDENTIFIERS,\n PAIR_PROFILES_URL,\n PROFILE_LINEAGE_URL,\n} from '../authentication-jwt-bearer/services';\n\nexport const MOCK_NONCE_URL = NONCE_URL(Env.PRD);\nexport const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);\nexport const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);\nexport const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);\nexport const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);\nexport const MOCK_PAIR_PROFILES_URL = PAIR_PROFILES_URL(Env.PRD);\nexport const MOCK_PROFILE_LINEAGE_URL = PROFILE_LINEAGE_URL(Env.PRD);\n\nexport const MOCK_JWT =\n 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';\n\nexport const MOCK_ACCESS_JWT =\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';\n\nexport const MOCK_NONCE_RESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n expires_in: 300,\n};\n\nexport const MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n identifier_type: 'SIWE',\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n identifier_type: 'SRP',\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n profile_aliases: [],\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n access_token: MOCK_ACCESS_JWT,\n expires_in: 3600,\n};\n\nexport const MOCK_PAIR_PROFILES_RESPONSE = {\n profile: {\n identifier_id: MOCK_SRP_LOGIN_RESPONSE.profile.identifier_id,\n metametrics_id: MOCK_SRP_LOGIN_RESPONSE.profile.metametrics_id,\n profile_id: MOCK_SRP_LOGIN_RESPONSE.profile.profile_id,\n },\n profile_aliases: [],\n};\n\nexport const MOCK_USER_PROFILE_LINEAGE_RESPONSE = {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n created_at: '2025-10-01T12:00:00Z',\n lineage: [\n {\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n agent: Platform.MOBILE,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 1,\n },\n {\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n agent: Platform.EXTENSION,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 2,\n },\n ],\n};\n"]}
@@ -4,6 +4,7 @@ export declare const MOCK_SRP_LOGIN_URL: string;
4
4
  export declare const MOCK_OIDC_TOKEN_URL: string;
5
5
  export declare const MOCK_SIWE_LOGIN_URL: string;
6
6
  export declare const MOCK_PAIR_IDENTIFIERS_URL: string;
7
+ export declare const MOCK_PAIR_PROFILES_URL: string;
7
8
  export declare const MOCK_PROFILE_LINEAGE_URL: string;
8
9
  export declare const MOCK_JWT = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ";
9
10
  export declare const MOCK_ACCESS_JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
@@ -33,11 +34,20 @@ export declare const MOCK_SRP_LOGIN_RESPONSE: {
33
34
  identifier_type: string;
34
35
  encrypted_storage_key: string;
35
36
  };
37
+ profile_aliases: never[];
36
38
  };
37
39
  export declare const MOCK_OIDC_TOKEN_RESPONSE: {
38
40
  access_token: string;
39
41
  expires_in: number;
40
42
  };
43
+ export declare const MOCK_PAIR_PROFILES_RESPONSE: {
44
+ profile: {
45
+ identifier_id: string;
46
+ metametrics_id: string;
47
+ profile_id: string;
48
+ };
49
+ profile_aliases: never[];
50
+ };
41
51
  export declare const MOCK_USER_PROFILE_LINEAGE_RESPONSE: {
42
52
  profile_id: string;
43
53
  created_at: string;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.cts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,6BAAyB;AAUjD,eAAO,MAAM,cAAc,QAAqB,CAAC;AACjD,eAAO,MAAM,kBAAkB,QAAyB,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,yBAAyB,QAA4B,CAAC;AACnE,eAAO,MAAM,wBAAwB,QAA+B,CAAC;AAErE,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,sLACyJ,CAAC;AAEtL,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;CAWpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;CAWnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;CAmB9C,CAAC"}
1
+ {"version":3,"file":"auth.d.cts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,6BAAyB;AAWjD,eAAO,MAAM,cAAc,QAAqB,CAAC;AACjD,eAAO,MAAM,kBAAkB,QAAyB,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,yBAAyB,QAA4B,CAAC;AACnE,eAAO,MAAM,sBAAsB,QAA6B,CAAC;AACjE,eAAO,MAAM,wBAAwB,QAA+B,CAAC;AAErE,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,sLACyJ,CAAC;AAEtL,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;CAWpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;CAYnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;CAmB9C,CAAC"}
@@ -4,6 +4,7 @@ export declare const MOCK_SRP_LOGIN_URL: string;
4
4
  export declare const MOCK_OIDC_TOKEN_URL: string;
5
5
  export declare const MOCK_SIWE_LOGIN_URL: string;
6
6
  export declare const MOCK_PAIR_IDENTIFIERS_URL: string;
7
+ export declare const MOCK_PAIR_PROFILES_URL: string;
7
8
  export declare const MOCK_PROFILE_LINEAGE_URL: string;
8
9
  export declare const MOCK_JWT = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ";
9
10
  export declare const MOCK_ACCESS_JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
@@ -33,11 +34,20 @@ export declare const MOCK_SRP_LOGIN_RESPONSE: {
33
34
  identifier_type: string;
34
35
  encrypted_storage_key: string;
35
36
  };
37
+ profile_aliases: never[];
36
38
  };
37
39
  export declare const MOCK_OIDC_TOKEN_RESPONSE: {
38
40
  access_token: string;
39
41
  expires_in: number;
40
42
  };
43
+ export declare const MOCK_PAIR_PROFILES_RESPONSE: {
44
+ profile: {
45
+ identifier_id: string;
46
+ metametrics_id: string;
47
+ profile_id: string;
48
+ };
49
+ profile_aliases: never[];
50
+ };
41
51
  export declare const MOCK_USER_PROFILE_LINEAGE_RESPONSE: {
42
52
  profile_id: string;
43
53
  created_at: string;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.mts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,6BAAyB;AAUjD,eAAO,MAAM,cAAc,QAAqB,CAAC;AACjD,eAAO,MAAM,kBAAkB,QAAyB,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,yBAAyB,QAA4B,CAAC;AACnE,eAAO,MAAM,wBAAwB,QAA+B,CAAC;AAErE,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,sLACyJ,CAAC;AAEtL,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;CAWpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;CAWnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;CAmB9C,CAAC"}
1
+ {"version":3,"file":"auth.d.mts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,6BAAyB;AAWjD,eAAO,MAAM,cAAc,QAAqB,CAAC;AACjD,eAAO,MAAM,kBAAkB,QAAyB,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAC3D,eAAO,MAAM,yBAAyB,QAA4B,CAAC;AACnE,eAAO,MAAM,sBAAsB,QAA6B,CAAC;AACjE,eAAO,MAAM,wBAAwB,QAA+B,CAAC;AAErE,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,sLACyJ,CAAC;AAEtL,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;CAWpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;CAYnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;CAOvC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;CAmB9C,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { Env, Platform } from "../../shared/env.mjs";
2
- import { NONCE_URL, SIWE_LOGIN_URL, SRP_LOGIN_URL, OIDC_TOKEN_URL, PAIR_IDENTIFIERS, PROFILE_LINEAGE_URL } from "../authentication-jwt-bearer/services.mjs";
2
+ import { NONCE_URL, SIWE_LOGIN_URL, SRP_LOGIN_URL, OIDC_TOKEN_URL, PAIR_IDENTIFIERS, PAIR_PROFILES_URL, PROFILE_LINEAGE_URL } from "../authentication-jwt-bearer/services.mjs";
3
3
  export const MOCK_NONCE_URL = NONCE_URL(Env.PRD);
4
4
  export const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);
5
5
  export const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);
6
6
  export const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);
7
7
  export const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);
8
+ export const MOCK_PAIR_PROFILES_URL = PAIR_PROFILES_URL(Env.PRD);
8
9
  export const MOCK_PROFILE_LINEAGE_URL = PROFILE_LINEAGE_URL(Env.PRD);
9
10
  export const MOCK_JWT = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';
10
11
  export const MOCK_ACCESS_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
@@ -34,11 +35,20 @@ export const MOCK_SRP_LOGIN_RESPONSE = {
34
35
  identifier_type: 'SRP',
35
36
  encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',
36
37
  },
38
+ profile_aliases: [],
37
39
  };
38
40
  export const MOCK_OIDC_TOKEN_RESPONSE = {
39
41
  access_token: MOCK_ACCESS_JWT,
40
42
  expires_in: 3600,
41
43
  };
44
+ export const MOCK_PAIR_PROFILES_RESPONSE = {
45
+ profile: {
46
+ identifier_id: MOCK_SRP_LOGIN_RESPONSE.profile.identifier_id,
47
+ metametrics_id: MOCK_SRP_LOGIN_RESPONSE.profile.metametrics_id,
48
+ profile_id: MOCK_SRP_LOGIN_RESPONSE.profile.profile_id,
49
+ },
50
+ profile_aliases: [],
51
+ };
42
52
  export const MOCK_USER_PROFILE_LINEAGE_RESPONSE = {
43
53
  profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',
44
54
  created_at: '2025-10-01T12:00:00Z',
@@ -1 +1 @@
1
- {"version":3,"file":"auth.mjs","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,6BAAyB;AACjD,OAAO,EACL,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACpB,kDAA8C;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,QAAQ,GACnB,opBAAopB,CAAC;AAEvpB,MAAM,CAAC,MAAM,eAAe,GAC1B,mLAAmL,CAAC;AAEtL,MA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\n OIDC_TOKEN_URL,\n PAIR_IDENTIFIERS,\n PROFILE_LINEAGE_URL,\n} from '../authentication-jwt-bearer/services';\n\nexport const MOCK_NONCE_URL = NONCE_URL(Env.PRD);\nexport const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);\nexport const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);\nexport const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);\nexport const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);\nexport const MOCK_PROFILE_LINEAGE_URL = PROFILE_LINEAGE_URL(Env.PRD);\n\nexport const MOCK_JWT =\n 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';\n\nexport const MOCK_ACCESS_JWT =\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';\n\nexport const MOCK_NONCE_RESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n expires_in: 300,\n};\n\nexport const MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n identifier_type: 'SIWE',\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n identifier_type: 'SRP',\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n access_token: MOCK_ACCESS_JWT,\n expires_in: 3600,\n};\n\nexport const MOCK_USER_PROFILE_LINEAGE_RESPONSE = {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n created_at: '2025-10-01T12:00:00Z',\n lineage: [\n {\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n agent: Platform.MOBILE,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 1,\n },\n {\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n agent: Platform.EXTENSION,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 2,\n },\n ],\n};\n"]}
1
+ {"version":3,"file":"auth.mjs","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,6BAAyB;AACjD,OAAO,EACL,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACpB,kDAA8C;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,QAAQ,GACnB,opBAAopB,CAAC;AAEvpB,MAAM,CAAC,MAAM,eAAe,GAC1B,mLAAmL,CAAC;AAEtL,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,kBAAkB;IACzB,UAAU,EAAE,4CAA4C;IACxD,UAAU,EAAE,GAAG;CAChB,CAAC;AAEF,MAAM,CAAC,M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AsB;YAClC,OAAO,EAAE,CAAC;SACX;KACF;CACF,CAAC","sourcesContent":["import { Env, Platform } from '../../shared/env';\nimport {\n NONCE_URL,\n SIWE_LOGIN_URL,\n SRP_LOGIN_URL,\n OIDC_TOKEN_URL,\n PAIR_IDENTIFIERS,\n PAIR_PROFILES_URL,\n PROFILE_LINEAGE_URL,\n} from '../authentication-jwt-bearer/services';\n\nexport const MOCK_NONCE_URL = NONCE_URL(Env.PRD);\nexport const MOCK_SRP_LOGIN_URL = SRP_LOGIN_URL(Env.PRD);\nexport const MOCK_OIDC_TOKEN_URL = OIDC_TOKEN_URL(Env.PRD);\nexport const MOCK_SIWE_LOGIN_URL = SIWE_LOGIN_URL(Env.PRD);\nexport const MOCK_PAIR_IDENTIFIERS_URL = PAIR_IDENTIFIERS(Env.PRD);\nexport const MOCK_PAIR_PROFILES_URL = PAIR_PROFILES_URL(Env.PRD);\nexport const MOCK_PROFILE_LINEAGE_URL = PROFILE_LINEAGE_URL(Env.PRD);\n\nexport const MOCK_JWT =\n 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImIwNzE2N2U2LWJjNWUtNDgyZC1hNjRhLWU1MjQ0MjY2MGU3NyJ9.eyJzdWIiOiI1MzE0ODc5YWM2NDU1OGI3OTQ5ZmI4NWIzMjg2ZjZjNjUwODAzYmFiMTY0Y2QyOWNmMmM3YzdmMjMzMWMwZTRlIiwiaWF0IjoxNzA2MTEzMDYyLCJleHAiOjE3NjkxODUwNjMsImlzcyI6ImF1dGgubWV0YW1hc2suaW8iLCJhdWQiOiJwb3J0Zm9saW8ubWV0YW1hc2suaW8ifQ.E5UL6oABNweS8t5a6IBTqTf7NLOJbrhJSmEcsr7kwLp4bGvcENJzACwnsHDkA6PlzfDV09ZhAGU_F3hlS0j-erbY0k0AFR-GAtyS7E9N02D8RgUDz5oDR65CKmzM8JilgFA8UvruJ6OJGogroaOSOqzRES_s8MjHpP47RJ9lXrUesajsbOudXbuksXWg5QmWip6LLvjwr8UUzcJzNQilyIhiEpo4WdzWM4R3VtTwr4rHnWEvtYnYCov1jmI2w3YQ48y0M-3Y9IOO0ov_vlITRrOnR7Y7fRUGLUFmU5msD8mNWRywjQFLHfJJ1yNP5aJ8TkuCK3sC6kcUH335IVvukQ';\n\nexport const MOCK_ACCESS_JWT =\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjQxMDI0NDQ4MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';\n\nexport const MOCK_NONCE_RESPONSE = {\n nonce: 'xGMm9SoihEKeAEfV',\n identifier: '0xd8641601Cb79a94FD872fE42d5b4a067A44a7e88',\n expires_in: 300,\n};\n\nexport const MOCK_SIWE_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'fa2bbf82-bd9a-4e6b-aabc-9ca0d0319b6e',\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n identifier_id:\n 'ec9a4e9906836497efad2fd4d4290b34d2c6a2c0d93eb174aa3cd88a133adbaf',\n identifier_type: 'SIWE',\n encrypted_storage_key: '2c6a2c0d93eb174aa3cd88a133adbaf',\n },\n};\n\nexport const MOCK_SRP_LOGIN_RESPONSE = {\n token: MOCK_JWT,\n expires_in: 3600,\n profile: {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n identifier_id:\n 'da9a9fc7b09edde9cc23cec9b7e11a71fb0ab4d2ddd8af8af905306f3e1456fb',\n identifier_type: 'SRP',\n encrypted_storage_key: 'd2ddd8af8af905306f3e1456fb',\n },\n profile_aliases: [],\n};\n\nexport const MOCK_OIDC_TOKEN_RESPONSE = {\n access_token: MOCK_ACCESS_JWT,\n expires_in: 3600,\n};\n\nexport const MOCK_PAIR_PROFILES_RESPONSE = {\n profile: {\n identifier_id: MOCK_SRP_LOGIN_RESPONSE.profile.identifier_id,\n metametrics_id: MOCK_SRP_LOGIN_RESPONSE.profile.metametrics_id,\n profile_id: MOCK_SRP_LOGIN_RESPONSE.profile.profile_id,\n },\n profile_aliases: [],\n};\n\nexport const MOCK_USER_PROFILE_LINEAGE_RESPONSE = {\n profile_id: 'f88227bd-b615-41a3-b0be-467dd781a4ad',\n created_at: '2025-10-01T12:00:00Z',\n lineage: [\n {\n metametrics_id: '561ec651-a844-4b36-a451-04d6eac35740',\n agent: Platform.MOBILE,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 1,\n },\n {\n metametrics_id: 'de742679-4960-4977-a415-4718b5f8e86c',\n agent: Platform.EXTENSION,\n created_at: '2025-10-01T12:00:00Z',\n updated_at: '2025-10-01T12:00:00Z',\n counter: 2,\n },\n ],\n};\n"]}
@@ -27,7 +27,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
27
27
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
28
28
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
29
29
  };
30
- var _UserStorage_instances, _UserStorage_upsertUserStorage, _UserStorage_batchUpsertUserStorage, _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries, _UserStorage_getUserStorage, _UserStorage_getUserStorageAllFeatureEntries, _UserStorage_deleteUserStorage, _UserStorage_deleteUserStorageAllFeatureEntries, _UserStorage_batchDeleteUserStorage, _UserStorage_createEntryKey, _UserStorage_getAuthorizationHeader;
30
+ var _UserStorage_instances, _UserStorage_upsertUserStorage, _UserStorage_batchUpsertUserStorage, _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries, _UserStorage_getUserStorage, _UserStorage_getUserStorageAllFeatureEntries, _UserStorage_deleteUserStorage, _UserStorage_deleteUserStorageAllFeatureEntries, _UserStorage_batchDeleteUserStorage, _UserStorage_createEntryKey, _UserStorage_getAuthorizationHeader, _UserStorage_getProfileScopeHeader;
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.UserStorage = exports.STORAGE_URL = void 0;
33
33
  const encryption_1 = __importStar(require("../shared/encryption/index.cjs"));
@@ -83,6 +83,7 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
83
83
  const entropySourceId = options?.entropySourceId;
84
84
  try {
85
85
  const headers = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getAuthorizationHeader).call(this, entropySourceId);
86
+ const profileScopeHeader = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getProfileScopeHeader).call(this, entropySourceId, options?.useCanonicalScope);
86
87
  const storageKey = await this.getStorageKey(entropySourceId);
87
88
  const encryptedData = await encryption_1.default.encryptString(data, storageKey, options?.nativeScryptCrypto);
88
89
  const encryptedPath = (0, storage_schema_1.createEntryPath)(path, storageKey);
@@ -92,6 +93,7 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
92
93
  headers: {
93
94
  'Content-Type': 'application/json',
94
95
  ...headers,
96
+ ...profileScopeHeader,
95
97
  },
96
98
  body: JSON.stringify({ data: encryptedData }),
97
99
  });
@@ -115,6 +117,7 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
115
117
  return;
116
118
  }
117
119
  const headers = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getAuthorizationHeader).call(this, entropySourceId);
120
+ const profileScopeHeader = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getProfileScopeHeader).call(this, entropySourceId, options?.useCanonicalScope);
118
121
  const storageKey = await this.getStorageKey(entropySourceId);
119
122
  const encryptedData = await Promise.all(data.map(async (d) => {
120
123
  return [
@@ -128,6 +131,7 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
128
131
  headers: {
129
132
  'Content-Type': 'application/json',
130
133
  ...headers,
134
+ ...profileScopeHeader,
131
135
  },
132
136
  body: JSON.stringify({ data: Object.fromEntries(encryptedData) }),
133
137
  });
@@ -144,15 +148,17 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
144
148
  const errorMessage = e instanceof Error ? e.message : JSON.stringify(e ?? '');
145
149
  throw new errors_1.UserStorageError(`failed to batch upsert user storage for path '${path}'. ${errorMessage}`);
146
150
  }
147
- }, _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries = async function _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries(path, encryptedData, entropySourceId) {
151
+ }, _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries = async function _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries(path, encryptedData, entropySourceId, useCanonicalScope) {
148
152
  try {
149
153
  const headers = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getAuthorizationHeader).call(this, entropySourceId);
154
+ const profileScopeHeader = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getProfileScopeHeader).call(this, entropySourceId, useCanonicalScope);
150
155
  const url = new URL((0, exports.STORAGE_URL)(this.env, path));
151
156
  const response = await fetch(url.toString(), {
152
157
  method: 'PUT',
153
158
  headers: {
154
159
  'Content-Type': 'application/json',
155
160
  ...headers,
161
+ ...profileScopeHeader,
156
162
  },
157
163
  body: JSON.stringify({ data: Object.fromEntries(encryptedData) }),
158
164
  });
@@ -213,12 +219,14 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
213
219
  const entropySourceId = options?.entropySourceId;
214
220
  try {
215
221
  const headers = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getAuthorizationHeader).call(this, entropySourceId);
222
+ const profileScopeHeader = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getProfileScopeHeader).call(this, entropySourceId, options?.useCanonicalScope);
216
223
  const storageKey = await this.getStorageKey(entropySourceId);
217
224
  const url = new URL((0, exports.STORAGE_URL)(this.env, path));
218
225
  const response = await fetch(url.toString(), {
219
226
  headers: {
220
227
  'Content-Type': 'application/json',
221
228
  ...headers,
229
+ ...profileScopeHeader,
222
230
  },
223
231
  });
224
232
  if (response.status === 404) {
@@ -256,7 +264,7 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
256
264
  }
257
265
  // Re-upload the re-encrypted entries
258
266
  if (reEncryptedEntries.length) {
259
- await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries).call(this, path, reEncryptedEntries, entropySourceId);
267
+ await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_batchUpsertUserStorageWithAlreadyHashedAndEncryptedEntries).call(this, path, reEncryptedEntries, entropySourceId, options?.useCanonicalScope);
260
268
  }
261
269
  return decryptedData;
262
270
  }
@@ -299,12 +307,14 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
299
307
  try {
300
308
  const entropySourceId = options?.entropySourceId;
301
309
  const headers = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getAuthorizationHeader).call(this, entropySourceId);
310
+ const profileScopeHeader = await __classPrivateFieldGet(this, _UserStorage_instances, "m", _UserStorage_getProfileScopeHeader).call(this, entropySourceId, options?.useCanonicalScope);
302
311
  const url = new URL((0, exports.STORAGE_URL)(this.env, path));
303
312
  const response = await fetch(url.toString(), {
304
313
  method: 'DELETE',
305
314
  headers: {
306
315
  'Content-Type': 'application/json',
307
316
  ...headers,
317
+ ...profileScopeHeader,
308
318
  },
309
319
  });
310
320
  if (response.status === 404) {
@@ -359,5 +369,18 @@ _UserStorage_instances = new WeakSet(), _UserStorage_upsertUserStorage = async f
359
369
  }, _UserStorage_getAuthorizationHeader = async function _UserStorage_getAuthorizationHeader(entropySourceId) {
360
370
  const accessToken = await this.config.auth.getAccessToken(entropySourceId);
361
371
  return { Authorization: `Bearer ${accessToken}` };
372
+ }, _UserStorage_getProfileScopeHeader = async function _UserStorage_getProfileScopeHeader(entropySourceId, useCanonicalScope) {
373
+ if (useCanonicalScope) {
374
+ return {};
375
+ }
376
+ const profile = await this.config.auth.getUserProfile(entropySourceId);
377
+ if (profile.profileId !== profile.canonicalProfileId) {
378
+ // After SRP pairing the JWT `sub` is the canonical profile id, but
379
+ // user storage data is still keyed by the original per-SRP profileId.
380
+ // The `x-profile-id` header tells the backend to scope reads/writes to
381
+ // that alias partition until ADR 0005 migrates storage keys to canonical.
382
+ return { 'x-profile-id': profile.profileId };
383
+ }
384
+ return {};
362
385
  };
363
386
  //# sourceMappingURL=user-storage.cjs.map