@metamask-previews/kyc-controller 0.0.0-preview-8bfa290fb → 0.2.0-preview-0a30e47

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 (203) hide show
  1. package/CHANGELOG.md +30 -49
  2. package/dist/{KycController-method-action-types.d.mts → KycController-method-action-types.d.ts} +35 -7
  3. package/dist/KycController-method-action-types.d.ts.map +1 -0
  4. package/dist/{KycController-method-action-types.mjs → KycController-method-action-types.js} +1 -1
  5. package/dist/KycController-method-action-types.js.map +1 -0
  6. package/dist/{KycController.d.mts → KycController.d.ts} +87 -45
  7. package/dist/KycController.d.ts.map +1 -0
  8. package/dist/KycController.js +1991 -0
  9. package/dist/KycController.js.map +1 -0
  10. package/dist/{KycService-method-action-types.d.mts → KycService-method-action-types.d.ts} +16 -16
  11. package/dist/KycService-method-action-types.d.ts.map +1 -0
  12. package/dist/{KycService-method-action-types.mjs → KycService-method-action-types.js} +1 -1
  13. package/dist/KycService-method-action-types.js.map +1 -0
  14. package/dist/{KycService.d.mts → KycService.d.ts} +23 -23
  15. package/dist/KycService.d.ts.map +1 -0
  16. package/dist/{KycService.mjs → KycService.js} +194 -185
  17. package/dist/KycService.js.map +1 -0
  18. package/dist/{countryCodes.d.cts → countryCodes.d.ts} +1 -1
  19. package/dist/countryCodes.d.ts.map +1 -0
  20. package/dist/{countryCodes.mjs → countryCodes.js} +1 -1
  21. package/dist/countryCodes.js.map +1 -0
  22. package/dist/{crypto.d.mts → crypto.d.ts} +1 -1
  23. package/dist/crypto.d.ts.map +1 -0
  24. package/dist/{crypto.mjs → crypto.js} +7 -7
  25. package/dist/crypto.js.map +1 -0
  26. package/dist/{encoding.d.mts → encoding.d.ts} +1 -1
  27. package/dist/encoding.d.ts.map +1 -0
  28. package/dist/{encoding.mjs → encoding.js} +2 -2
  29. package/dist/encoding.js.map +1 -0
  30. package/dist/index.d.ts +19 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +12 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/{logger.d.cts → logger.d.ts} +2 -3
  35. package/dist/logger.d.ts.map +1 -0
  36. package/dist/{logger.mjs → logger.js} +2 -2
  37. package/dist/logger.js.map +1 -0
  38. package/dist/{selectors.d.mts → selectors.d.ts} +4 -4
  39. package/dist/selectors.d.ts.map +1 -0
  40. package/dist/{selectors.mjs → selectors.js} +2 -2
  41. package/dist/selectors.js.map +1 -0
  42. package/dist/{types.d.cts → types.d.ts} +72 -13
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/{types.mjs → types.js} +1 -1
  45. package/dist/types.js.map +1 -0
  46. package/dist/ukyc/{constants.d.mts → constants.d.ts} +9 -9
  47. package/dist/ukyc/constants.d.ts.map +1 -0
  48. package/dist/ukyc/{constants.mjs → constants.js} +1 -1
  49. package/dist/ukyc/constants.js.map +1 -0
  50. package/dist/ukyc/{deriveClientMaterial.d.cts → deriveClientMaterial.d.ts} +1 -1
  51. package/dist/ukyc/deriveClientMaterial.d.ts.map +1 -0
  52. package/dist/ukyc/{deriveClientMaterial.mjs → deriveClientMaterial.js} +7 -7
  53. package/dist/ukyc/deriveClientMaterial.js.map +1 -0
  54. package/dist/ukyc/{jwtChain.d.mts → jwtChain.d.ts} +1 -1
  55. package/dist/ukyc/jwtChain.d.ts.map +1 -0
  56. package/dist/ukyc/{jwtChain.mjs → jwtChain.js} +4 -4
  57. package/dist/ukyc/jwtChain.js.map +1 -0
  58. package/dist/ukyc/{localUserSecret.d.mts → localUserSecret.d.ts} +1 -1
  59. package/dist/ukyc/localUserSecret.d.ts.map +1 -0
  60. package/dist/ukyc/{localUserSecret.mjs → localUserSecret.js} +4 -4
  61. package/dist/ukyc/localUserSecret.js.map +1 -0
  62. package/dist/ukyc/{storageAccessToken.d.mts → storageAccessToken.d.ts} +2 -2
  63. package/dist/ukyc/storageAccessToken.d.ts.map +1 -0
  64. package/dist/ukyc/{storageAccessToken.mjs → storageAccessToken.js} +5 -5
  65. package/dist/ukyc/storageAccessToken.js.map +1 -0
  66. package/dist/ukyc/{testToken.d.mts → testToken.d.ts} +2 -2
  67. package/dist/ukyc/testToken.d.ts.map +1 -0
  68. package/dist/ukyc/{testToken.mjs → testToken.js} +5 -5
  69. package/dist/ukyc/testToken.js.map +1 -0
  70. package/dist/ukyc/{wrapEncryptionKey.d.mts → wrapEncryptionKey.d.ts} +1 -1
  71. package/dist/ukyc/wrapEncryptionKey.d.ts.map +1 -0
  72. package/dist/ukyc/{wrapEncryptionKey.mjs → wrapEncryptionKey.js} +3 -4
  73. package/dist/ukyc/wrapEncryptionKey.js.map +1 -0
  74. package/dist/ukyc/{wrappedRelayPayload.d.mts → wrappedRelayPayload.d.ts} +3 -3
  75. package/dist/ukyc/wrappedRelayPayload.d.ts.map +1 -0
  76. package/dist/ukyc/{wrappedRelayPayload.mjs → wrappedRelayPayload.js} +2 -2
  77. package/dist/ukyc/wrappedRelayPayload.js.map +1 -0
  78. package/dist/vendorDisclaimerAcceptance.d.ts +39 -0
  79. package/dist/vendorDisclaimerAcceptance.d.ts.map +1 -0
  80. package/dist/vendorDisclaimerAcceptance.js +67 -0
  81. package/dist/vendorDisclaimerAcceptance.js.map +1 -0
  82. package/dist/vendors/MoonPayFrameHandler.d.ts +74 -0
  83. package/dist/vendors/MoonPayFrameHandler.d.ts.map +1 -0
  84. package/dist/vendors/MoonPayFrameHandler.js +218 -0
  85. package/dist/vendors/MoonPayFrameHandler.js.map +1 -0
  86. package/package.json +19 -23
  87. package/dist/KycController-method-action-types.cjs +0 -7
  88. package/dist/KycController-method-action-types.cjs.map +0 -1
  89. package/dist/KycController-method-action-types.d.cts +0 -239
  90. package/dist/KycController-method-action-types.d.cts.map +0 -1
  91. package/dist/KycController-method-action-types.d.mts.map +0 -1
  92. package/dist/KycController-method-action-types.mjs.map +0 -1
  93. package/dist/KycController.cjs +0 -1882
  94. package/dist/KycController.cjs.map +0 -1
  95. package/dist/KycController.d.cts +0 -395
  96. package/dist/KycController.d.cts.map +0 -1
  97. package/dist/KycController.d.mts.map +0 -1
  98. package/dist/KycController.mjs +0 -1877
  99. package/dist/KycController.mjs.map +0 -1
  100. package/dist/KycService-method-action-types.cjs +0 -7
  101. package/dist/KycService-method-action-types.cjs.map +0 -1
  102. package/dist/KycService-method-action-types.d.cts +0 -220
  103. package/dist/KycService-method-action-types.d.cts.map +0 -1
  104. package/dist/KycService-method-action-types.d.mts.map +0 -1
  105. package/dist/KycService-method-action-types.mjs.map +0 -1
  106. package/dist/KycService.cjs +0 -637
  107. package/dist/KycService.cjs.map +0 -1
  108. package/dist/KycService.d.cts +0 -552
  109. package/dist/KycService.d.cts.map +0 -1
  110. package/dist/KycService.d.mts.map +0 -1
  111. package/dist/KycService.mjs.map +0 -1
  112. package/dist/countryCodes.cjs +0 -274
  113. package/dist/countryCodes.cjs.map +0 -1
  114. package/dist/countryCodes.d.cts.map +0 -1
  115. package/dist/countryCodes.d.mts +0 -18
  116. package/dist/countryCodes.d.mts.map +0 -1
  117. package/dist/countryCodes.mjs.map +0 -1
  118. package/dist/crypto.cjs +0 -154
  119. package/dist/crypto.cjs.map +0 -1
  120. package/dist/crypto.d.cts +0 -84
  121. package/dist/crypto.d.cts.map +0 -1
  122. package/dist/crypto.d.mts.map +0 -1
  123. package/dist/crypto.mjs.map +0 -1
  124. package/dist/encoding.cjs +0 -40
  125. package/dist/encoding.cjs.map +0 -1
  126. package/dist/encoding.d.cts +0 -24
  127. package/dist/encoding.d.cts.map +0 -1
  128. package/dist/encoding.d.mts.map +0 -1
  129. package/dist/encoding.mjs.map +0 -1
  130. package/dist/index.cjs +0 -37
  131. package/dist/index.cjs.map +0 -1
  132. package/dist/index.d.cts +0 -19
  133. package/dist/index.d.cts.map +0 -1
  134. package/dist/index.d.mts +0 -19
  135. package/dist/index.d.mts.map +0 -1
  136. package/dist/index.mjs +0 -12
  137. package/dist/index.mjs.map +0 -1
  138. package/dist/logger.cjs +0 -9
  139. package/dist/logger.cjs.map +0 -1
  140. package/dist/logger.d.cts.map +0 -1
  141. package/dist/logger.d.mts +0 -6
  142. package/dist/logger.d.mts.map +0 -1
  143. package/dist/logger.mjs.map +0 -1
  144. package/dist/selectors.cjs +0 -30
  145. package/dist/selectors.cjs.map +0 -1
  146. package/dist/selectors.d.cts +0 -24
  147. package/dist/selectors.d.cts.map +0 -1
  148. package/dist/selectors.d.mts.map +0 -1
  149. package/dist/selectors.mjs.map +0 -1
  150. package/dist/types.cjs +0 -10
  151. package/dist/types.cjs.map +0 -1
  152. package/dist/types.d.cts.map +0 -1
  153. package/dist/types.d.mts +0 -217
  154. package/dist/types.d.mts.map +0 -1
  155. package/dist/types.mjs.map +0 -1
  156. package/dist/ukyc/constants.cjs +0 -75
  157. package/dist/ukyc/constants.cjs.map +0 -1
  158. package/dist/ukyc/constants.d.cts +0 -69
  159. package/dist/ukyc/constants.d.cts.map +0 -1
  160. package/dist/ukyc/constants.d.mts.map +0 -1
  161. package/dist/ukyc/constants.mjs.map +0 -1
  162. package/dist/ukyc/deriveClientMaterial.cjs +0 -65
  163. package/dist/ukyc/deriveClientMaterial.cjs.map +0 -1
  164. package/dist/ukyc/deriveClientMaterial.d.cts.map +0 -1
  165. package/dist/ukyc/deriveClientMaterial.d.mts +0 -54
  166. package/dist/ukyc/deriveClientMaterial.d.mts.map +0 -1
  167. package/dist/ukyc/deriveClientMaterial.mjs.map +0 -1
  168. package/dist/ukyc/jwtChain.cjs +0 -54
  169. package/dist/ukyc/jwtChain.cjs.map +0 -1
  170. package/dist/ukyc/jwtChain.d.cts +0 -40
  171. package/dist/ukyc/jwtChain.d.cts.map +0 -1
  172. package/dist/ukyc/jwtChain.d.mts.map +0 -1
  173. package/dist/ukyc/jwtChain.mjs.map +0 -1
  174. package/dist/ukyc/localUserSecret.cjs +0 -98
  175. package/dist/ukyc/localUserSecret.cjs.map +0 -1
  176. package/dist/ukyc/localUserSecret.d.cts +0 -65
  177. package/dist/ukyc/localUserSecret.d.cts.map +0 -1
  178. package/dist/ukyc/localUserSecret.d.mts.map +0 -1
  179. package/dist/ukyc/localUserSecret.mjs.map +0 -1
  180. package/dist/ukyc/storageAccessToken.cjs +0 -139
  181. package/dist/ukyc/storageAccessToken.cjs.map +0 -1
  182. package/dist/ukyc/storageAccessToken.d.cts +0 -99
  183. package/dist/ukyc/storageAccessToken.d.cts.map +0 -1
  184. package/dist/ukyc/storageAccessToken.d.mts.map +0 -1
  185. package/dist/ukyc/storageAccessToken.mjs.map +0 -1
  186. package/dist/ukyc/testToken.cjs +0 -61
  187. package/dist/ukyc/testToken.cjs.map +0 -1
  188. package/dist/ukyc/testToken.d.cts +0 -50
  189. package/dist/ukyc/testToken.d.cts.map +0 -1
  190. package/dist/ukyc/testToken.d.mts.map +0 -1
  191. package/dist/ukyc/testToken.mjs.map +0 -1
  192. package/dist/ukyc/wrapEncryptionKey.cjs +0 -31
  193. package/dist/ukyc/wrapEncryptionKey.cjs.map +0 -1
  194. package/dist/ukyc/wrapEncryptionKey.d.cts +0 -36
  195. package/dist/ukyc/wrapEncryptionKey.d.cts.map +0 -1
  196. package/dist/ukyc/wrapEncryptionKey.d.mts.map +0 -1
  197. package/dist/ukyc/wrapEncryptionKey.mjs.map +0 -1
  198. package/dist/ukyc/wrappedRelayPayload.cjs +0 -32
  199. package/dist/ukyc/wrappedRelayPayload.cjs.map +0 -1
  200. package/dist/ukyc/wrappedRelayPayload.d.cts +0 -35
  201. package/dist/ukyc/wrappedRelayPayload.d.cts.map +0 -1
  202. package/dist/ukyc/wrappedRelayPayload.d.mts.map +0 -1
  203. package/dist/ukyc/wrappedRelayPayload.mjs.map +0 -1
@@ -1,637 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- 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");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _KycService_instances, _KycService_fetch, _KycService_baseUrl, _KycService_idosEnclaveBaseUrl, _KycService_idosRelayBaseUrl, _KycService_fetchWellKnownJwks, _KycService_validateResponse, _KycService_requestJson;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.KycService = exports.serviceName = void 0;
16
- const base_data_service_1 = require("@metamask/base-data-service");
17
- const controller_utils_1 = require("@metamask/controller-utils");
18
- const superstruct_1 = require("@metamask/superstruct");
19
- const utils_1 = require("@metamask/utils");
20
- const countryCodes_js_1 = require("./countryCodes.cjs");
21
- const constants_js_1 = require("./ukyc/constants.cjs");
22
- // === GENERAL ===
23
- /**
24
- * The name of the {@link KycService}, used to namespace the service's actions.
25
- */
26
- exports.serviceName = 'KycService';
27
- // === MESSENGER ===
28
- const MESSENGER_EXPOSED_METHODS = [
29
- 'getGeoCountry',
30
- 'fetchVendorDisclaimers',
31
- 'createSession',
32
- 'checkKycRequired',
33
- 'createVendorCustomer',
34
- 'submitVendorDisclaimers',
35
- 'fetchDisclaimersCatalog',
36
- 'fetchSessionDisclaimers',
37
- 'submitSessionDisclaimers',
38
- 'fetchKycStatus',
39
- 'fetchIdosEnclaveJwks',
40
- 'fetchIdosRelayJwks',
41
- 'createUkycSession',
42
- 'setAuthorizations',
43
- 'createJourney',
44
- 'getSessionStatus',
45
- ];
46
- // === API RESPONSE SCHEMAS ===
47
- const DisclaimerStruct = (0, superstruct_1.type)({
48
- id: (0, superstruct_1.string)(),
49
- display_name: (0, superstruct_1.string)(),
50
- url: (0, superstruct_1.string)(),
51
- });
52
- const DisclaimersResponseStruct = (0, superstruct_1.array)(DisclaimerStruct);
53
- const VendorSigningStruct = (0, superstruct_1.type)({
54
- id: (0, superstruct_1.string)(),
55
- customer_id: (0, superstruct_1.string)(),
56
- content_id: (0, superstruct_1.optional)((0, superstruct_1.string)()),
57
- });
58
- const VendorSigningsResponseStruct = (0, superstruct_1.array)(VendorSigningStruct);
59
- const CreateSessionResponseStruct = (0, superstruct_1.type)({ sessionToken: (0, superstruct_1.string)() });
60
- // The live KYC API returns the flag under `required`; the service normalizes
61
- // this to `kycRequired` for consumers (see `checkKycRequired`).
62
- const KycRequiredResponseStruct = (0, superstruct_1.type)({ required: (0, superstruct_1.boolean)() });
63
- // The session server's public key, in JWK-like form, returned inside an
64
- // encryption schema from `POST /sessions`. `x` is the base64url public key
65
- // used to wrap a secret for that schema.
66
- const ServerPublicKeyStruct = (0, superstruct_1.type)({
67
- kty: (0, superstruct_1.string)(),
68
- crv: (0, superstruct_1.string)(),
69
- x: (0, superstruct_1.string)(),
70
- kid: (0, superstruct_1.optional)((0, superstruct_1.string)()),
71
- alg: (0, superstruct_1.optional)((0, superstruct_1.string)()),
72
- use: (0, superstruct_1.optional)((0, superstruct_1.string)()),
73
- });
74
- const EncryptionSchemaStruct = (0, superstruct_1.type)({
75
- serverPublicKey: ServerPublicKeyStruct,
76
- jwtChain: (0, superstruct_1.string)(),
77
- });
78
- // A single Ed25519 (OKP) JWK. `type` (not `object`) keeps optional/extra JWK
79
- // fields (`use`, `alg`) from failing validation.
80
- const JwkStruct = (0, superstruct_1.type)({
81
- kty: (0, superstruct_1.string)(),
82
- crv: (0, superstruct_1.string)(),
83
- x: (0, superstruct_1.string)(),
84
- kid: (0, superstruct_1.string)(),
85
- });
86
- const JwksResponseStruct = (0, superstruct_1.type)({ keys: (0, superstruct_1.array)(JwkStruct) });
87
- const UkycSessionResponseStruct = (0, superstruct_1.type)({
88
- sessionId: (0, superstruct_1.string)(),
89
- // Per-secret wrapping material so the client can seal the
90
- // `data_encryption_key` and the `ukyc_capability_token` independently.
91
- encryptionDataKey: EncryptionSchemaStruct,
92
- ukycCapabilityToken: EncryptionSchemaStruct,
93
- });
94
- const ApplicantAccessTokenResponseStruct = (0, superstruct_1.type)({
95
- status: (0, superstruct_1.string)(),
96
- applicantAccessToken: (0, superstruct_1.string)(),
97
- });
98
- const SessionStatusResponseStruct = (0, superstruct_1.type)({
99
- finalStatus: (0, superstruct_1.string)(),
100
- statusMessage: (0, superstruct_1.optional)((0, superstruct_1.string)()),
101
- externalUserId: (0, superstruct_1.string)(),
102
- kycStatus: (0, superstruct_1.string)(),
103
- vendor: (0, superstruct_1.string)(),
104
- vendorStatus: (0, superstruct_1.string)(),
105
- });
106
- // Vendor customer subset — `type` (not `object`) keeps extra vendor fields from
107
- // failing validation while still requiring the fields the controller needs.
108
- const VendorCustomerResponseStruct = (0, superstruct_1.type)({
109
- id: (0, superstruct_1.string)(),
110
- email: (0, superstruct_1.string)(),
111
- status: (0, superstruct_1.string)(),
112
- });
113
- const KYC_USER_STATUSES = [
114
- 'not-started',
115
- 'pending',
116
- 'need-more-information',
117
- 'terminal-failure',
118
- 'completed',
119
- ];
120
- const KycUserStatusResponseStruct = (0, superstruct_1.type)({
121
- status: (0, superstruct_1.enums)([...KYC_USER_STATUSES]),
122
- sumsubSessionId: (0, superstruct_1.optional)((0, superstruct_1.string)()),
123
- errorCode: (0, superstruct_1.optional)((0, superstruct_1.string)()),
124
- });
125
- const ConsentDocumentStruct = (0, superstruct_1.type)({
126
- key: (0, superstruct_1.string)(),
127
- version: (0, superstruct_1.string)(),
128
- title: (0, superstruct_1.string)(),
129
- url: (0, superstruct_1.string)(),
130
- consented: (0, superstruct_1.boolean)(),
131
- });
132
- const DisclaimersCatalogFields = {
133
- idOS: (0, superstruct_1.array)(ConsentDocumentStruct),
134
- kycProvider: (0, superstruct_1.array)(ConsentDocumentStruct),
135
- };
136
- /** Global catalog from `GET /disclaimers` (no credential-reuse flag). */
137
- const GlobalDisclaimersResponseStruct = (0, superstruct_1.type)(DisclaimersCatalogFields);
138
- /** Session catalog from `GET`/`POST /sessions/{id}/disclaimers`. */
139
- const SessionDisclaimersResponseStruct = (0, superstruct_1.type)({
140
- ...DisclaimersCatalogFields,
141
- credentialReusabilityConsentGiven: (0, superstruct_1.boolean)(),
142
- });
143
- // === SERVICE DEFINITION ===
144
- /**
145
- * `KycService` communicates with the Universal KYC (UKYC) backend to drive the
146
- * identity + document-verification flow. It is stateless and platform-agnostic:
147
- * HTTP is performed through the runtime's native `fetch` (or an injected
148
- * `fetch` when provided), and the auth bearer token and geolocation come from
149
- * other controllers via the messenger.
150
- *
151
- * It extends {@link BaseDataService}, so read-only endpoints are routed through
152
- * `fetchQuery`: they are wrapped in the shared service policy (retries, circuit
153
- * breaker) and their results are exposed via the service's `QueryClient`.
154
- * `fetchDisclaimers` and `fetchJwks` are cached with a `staleTime`;
155
- * session-scoped disclaimer and status-polling reads opt out of caching
156
- * (`staleTime`/`gcTime` of `0`) so they never serve a stale result.
157
- *
158
- * Write endpoints (every `POST`) deliberately bypass `fetchQuery`. The query
159
- * cache is built for idempotent reads: it deduplicates concurrent requests
160
- * sharing a `queryKey`, retains responses for replay, and publishes them on the
161
- * messenger via `cacheUpdated`. None of that is safe for calls that create
162
- * sessions, customers, or consents — two overlapping `createVendorCustomer`
163
- * calls would collapse into a single `POST`, and session tokens would be
164
- * broadcast as cache payloads. Writes therefore call `#requestJson` directly,
165
- * which also means they are not retried by the service policy.
166
- */
167
- class KycService extends base_data_service_1.BaseDataService {
168
- /**
169
- * Constructs a new KycService.
170
- *
171
- * @param options - The constructor options.
172
- * @param options.messenger - The messenger suited for this service.
173
- * @param options.fetch - A function used to make HTTP requests. Defaults to
174
- * the runtime's native `fetch`.
175
- * @param options.baseUrl - Base URL of the KYC API
176
- * @param options.idosEnclaveBaseUrl - Base URL of the idOS enclave, from
177
- * which the JWKS used to verify the `encryptionDataKey` schema's `jwtChain`
178
- * is fetched.
179
- * @param options.idosRelayBaseUrl - Base URL of the idOS relay, from which
180
- * the JWKS used to verify the `ukycCapabilityToken` schema's `jwtChain` is
181
- * fetched.
182
- * @param options.queryClientConfig - Shared configuration for all queries
183
- * exposed by the service.
184
- * @param options.policyOptions - Options for the request service policy.
185
- */
186
- constructor({ messenger, fetch: fetchFunction, baseUrl, idosEnclaveBaseUrl, idosRelayBaseUrl, queryClientConfig = {}, policyOptions = {}, }) {
187
- super({
188
- name: exports.serviceName,
189
- messenger,
190
- queryClientConfig,
191
- policyOptions,
192
- });
193
- _KycService_instances.add(this);
194
- _KycService_fetch.set(this, void 0);
195
- _KycService_baseUrl.set(this, void 0);
196
- _KycService_idosEnclaveBaseUrl.set(this, void 0);
197
- _KycService_idosRelayBaseUrl.set(this, void 0);
198
- // Fall back to the runtime's native `fetch`, bound to `globalThis` so it
199
- // can be invoked as a method of this instance without an illegal-invocation
200
- // error on platforms that check the receiver.
201
- if (fetchFunction) {
202
- __classPrivateFieldSet(this, _KycService_fetch, fetchFunction, "f");
203
- }
204
- else if (typeof globalThis.fetch === 'function') {
205
- __classPrivateFieldSet(this, _KycService_fetch, globalThis.fetch.bind(globalThis), "f");
206
- }
207
- else {
208
- throw new Error('KycService: fetch is not available globally and was not provided in options. Please inject a fetch implementation.');
209
- }
210
- if (!baseUrl) {
211
- throw new Error('KycService: baseUrl is required');
212
- }
213
- __classPrivateFieldSet(this, _KycService_baseUrl, baseUrl, "f");
214
- __classPrivateFieldSet(this, _KycService_idosEnclaveBaseUrl, idosEnclaveBaseUrl ?? '', "f");
215
- __classPrivateFieldSet(this, _KycService_idosRelayBaseUrl, idosRelayBaseUrl ?? '', "f");
216
- this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
217
- }
218
- /**
219
- * Resolves the customer's country from the geolocation source and converts it
220
- * to an ISO 3166-1 alpha-3 code.
221
- *
222
- * @returns The alpha-3 country code.
223
- * @throws If the country cannot be determined or mapped.
224
- */
225
- async getGeoCountry() {
226
- const location = await this.messenger.call('GeolocationController:getGeolocation');
227
- // Guard nullish/empty geolocation with the documented domain error rather
228
- // than letting `assert(location, string())` surface a superstruct
229
- // assertion error (which would change how the failure reads in
230
- // `disclaimersError`).
231
- const alpha2 = typeof location === 'string' ? location.split('-')[0].toUpperCase() : '';
232
- if (!alpha2 || alpha2 === 'UNKNOWN') {
233
- throw new Error(`Unable to determine country from geolocation (got "${String(location)}").`);
234
- }
235
- const alpha3 = (0, countryCodes_js_1.alpha2ToAlpha3)(alpha2);
236
- if (!alpha3) {
237
- throw new Error(`Unable to map country code "${alpha2}" to an ISO 3166-1 alpha-3 code.`);
238
- }
239
- return alpha3;
240
- }
241
- /**
242
- * Fetches the disclaimers the customer must accept before a session is
243
- * created.
244
- *
245
- * @param params - The parameters.
246
- * @param params.vendor - Identity vendor. Defaults to `moonpay`.
247
- * @param params.country - ISO 3166-1 alpha-3 country code.
248
- * @returns The disclaimers.
249
- */
250
- async fetchVendorDisclaimers({ vendor = 'moonpay', country, }) {
251
- const url = new URL(`/vendors/${vendor}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
252
- url.searchParams.set('country', country);
253
- const data = await this.fetchQuery({
254
- queryKey: [`${this.name}:fetchVendorDisclaimers`, vendor, country],
255
- queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
256
- staleTime: (0, utils_1.inMilliseconds)(5, utils_1.Duration.Minute),
257
- });
258
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, DisclaimersResponseStruct, 'disclaimers');
259
- }
260
- /**
261
- * Creates a vendor session via the UKYC backend.
262
- *
263
- * @param params - The session parameters.
264
- * @returns The created session token.
265
- */
266
- async createSession(params) {
267
- const url = new URL('/vendors/moonpay/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
268
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
269
- method: 'POST',
270
- body: JSON.stringify(params),
271
- });
272
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, CreateSessionResponseStruct, 'sessions');
273
- }
274
- /**
275
- * Checks whether KYC is required for the given vendor, country, and
276
- * capabilities.
277
- *
278
- * @param params - The check parameters.
279
- * @returns Whether KYC is required.
280
- */
281
- async checkKycRequired(params) {
282
- const vendor = params.vendor ?? 'moonpay';
283
- const url = new URL(`/vendors/${vendor}/kyc-required`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
284
- const capabilities = params.capabilities ?? [{ product: 'ramps' }];
285
- const body = vendor === 'moonpay'
286
- ? {
287
- accessToken: params.accessToken,
288
- country: params.country,
289
- capabilities,
290
- }
291
- : {};
292
- // MoonPay requires accessToken and country; validate before making the request.
293
- if (vendor === 'moonpay') {
294
- if (!params.accessToken) {
295
- throw new Error('checkKycRequired: accessToken is required for vendor "moonpay".');
296
- }
297
- if (!params.country) {
298
- throw new Error('checkKycRequired: country is required for vendor "moonpay".');
299
- }
300
- }
301
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
302
- method: 'POST',
303
- body: JSON.stringify(body),
304
- });
305
- const { required } = __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, KycRequiredResponseStruct, 'kyc-required');
306
- return { kycRequired: required };
307
- }
308
- /**
309
- * Creates (or resumes) an empty-shell customer for the authenticated
310
- * canonical user on the given identity vendor. Must run before showing
311
- * vendor T&C so the customer exists and resume logic can key off vendor
312
- * status.
313
- *
314
- * @param params - The parameters.
315
- * @param params.vendor - Identity vendor (e.g. `iron` for Money/VBA).
316
- * @param params.email - Email associated with the customer.
317
- * @returns The vendor customer record (subset validated for controller use).
318
- */
319
- async createVendorCustomer(params) {
320
- const url = new URL(`/vendors/${params.vendor}/customers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
321
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
322
- method: 'POST',
323
- body: JSON.stringify({ email: params.email }),
324
- });
325
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, VendorCustomerResponseStruct, 'vendor customers');
326
- }
327
- /**
328
- * Records vendor T&C acceptance (`POST /vendors/{vendor}/disclaimers`).
329
- * For Iron this creates content signings from the disclaimer ids the
330
- * customer accepted. Session-scoped idOS / KYC-provider consents are
331
- * recorded separately via {@link submitSessionDisclaimers}. Retries re-POST
332
- * the same ids, matching the legacy `POST /consents` signing step.
333
- *
334
- * @param params - The parameters.
335
- * @param params.vendor - Identity vendor (e.g. `iron`).
336
- * @param params.disclaimerIds - Accepted vendor T&C ids.
337
- * @returns The vendor signing records.
338
- */
339
- async submitVendorDisclaimers(params) {
340
- const url = new URL(`/vendors/${encodeURIComponent(params.vendor)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
341
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
342
- method: 'POST',
343
- body: JSON.stringify({ disclaimerIds: params.disclaimerIds }),
344
- });
345
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, VendorSigningsResponseStruct, 'vendor disclaimers');
346
- }
347
- /**
348
- * Fetches the global idOS + KYC-provider disclaimer catalog
349
- * (`GET /disclaimers?country=`). Does not include
350
- * `credentialReusabilityConsentGiven` — that is session-scoped via
351
- * {@link fetchSessionDisclaimers}. Vendor T&Cs continue to come from
352
- * {@link fetchVendorDisclaimers}.
353
- *
354
- * @param params - The parameters.
355
- * @param params.country - ISO 3166-1 alpha-3 country code.
356
- * @returns The catalog documents.
357
- */
358
- async fetchDisclaimersCatalog({ country, }) {
359
- if (country.length !== 3) {
360
- throw new Error(`KycService.fetchDisclaimersCatalog: country must be an ISO 3166-1 alpha-3 code (received "${country}").`);
361
- }
362
- const url = new URL('/disclaimers', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
363
- url.searchParams.set('country', country);
364
- const data = await this.fetchQuery({
365
- queryKey: [`${this.name}:fetchDisclaimersCatalog`, country],
366
- queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
367
- staleTime: 0,
368
- gcTime: 0,
369
- });
370
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, GlobalDisclaimersResponseStruct, 'disclaimers');
371
- }
372
- /**
373
- * Fetches the session-scoped idOS + KYC-provider disclaimer catalog
374
- * (`GET /sessions/{sessionId}/disclaimers`), including per-session
375
- * `consented` flags and `credentialReusabilityConsentGiven`. For the
376
- * pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
377
- * T&Cs continue to come from {@link fetchVendorDisclaimers}.
378
- *
379
- * @param params - The parameters.
380
- * @param params.sessionId - The UKYC session id.
381
- * @returns The catalog, including which documents are already consented.
382
- */
383
- async fetchSessionDisclaimers({ sessionId, }) {
384
- const url = new URL(`/sessions/${encodeURIComponent(sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
385
- const data = await this.fetchQuery({
386
- queryKey: [`${this.name}:fetchSessionDisclaimers`, sessionId],
387
- queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
388
- // Consent state can change after a POST, so always re-fetch.
389
- staleTime: 0,
390
- gcTime: 0,
391
- });
392
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionDisclaimersResponseStruct, 'session disclaimers');
393
- }
394
- /**
395
- * Records idOS + KYC-provider consents for a UKYC session
396
- * (`POST /sessions/{sessionId}/disclaimers`). `key`/`version` pairs must
397
- * match the current catalog from {@link fetchSessionDisclaimers}. A 409
398
- * means those document versions were already recorded for the session.
399
- *
400
- * @param params - The consent parameters.
401
- * @returns The updated catalog after recording.
402
- */
403
- async submitSessionDisclaimers(params) {
404
- const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
405
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
406
- method: 'POST',
407
- body: JSON.stringify({
408
- idOS: params.idOS,
409
- kycProvider: params.kycProvider,
410
- credentialReusabilityConsentGiven: params.credentialReusabilityConsentGiven,
411
- }),
412
- });
413
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionDisclaimersResponseStruct, 'session disclaimers');
414
- }
415
- /**
416
- * Fetches the user-keyed simplified KYC status used by Money toast / banner
417
- * surfaces (`GET /kyc/status`).
418
- *
419
- * @returns The simplified status payload.
420
- */
421
- async fetchKycStatus() {
422
- const url = new URL('/kyc/status', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
423
- const data = await this.fetchQuery({
424
- queryKey: [`${this.name}:fetchKycStatus`],
425
- queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
426
- // Status is polled for toast flips, so it must always be fresh.
427
- staleTime: 0,
428
- gcTime: 0,
429
- });
430
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, KycUserStatusResponseStruct, 'kyc status');
431
- }
432
- /**
433
- * Fetches the idOS enclave JWKS used to verify the
434
- * `encryptionDataKey` schema's `jwtChain` from
435
- * {@link KycService.createUkycSession}.
436
- *
437
- * This is an unauthenticated request to a well-known path on the idOS enclave
438
- * host, distinct from the UKYC base URL.
439
- *
440
- * @returns The JWKS keys.
441
- */
442
- async fetchIdosEnclaveJwks() {
443
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_fetchWellKnownJwks).call(this, __classPrivateFieldGet(this, _KycService_idosEnclaveBaseUrl, "f"), 'fetchIdosEnclaveJwks', 'idOS enclave JWKS', 'KycService: idosEnclaveBaseUrl is not configured; cannot fetch JWKS to verify the encryptionDataKey schema.');
444
- }
445
- /**
446
- * Fetches the idOS relay JWKS used to verify the `ukycCapabilityToken`
447
- * schema's `jwtChain` from {@link KycService.createUkycSession}.
448
- *
449
- * This is an unauthenticated request to a well-known path on the idOS relay
450
- * host, distinct from both the UKYC base URL and the idOS enclave.
451
- *
452
- * @returns The JWKS keys.
453
- */
454
- async fetchIdosRelayJwks() {
455
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_fetchWellKnownJwks).call(this, __classPrivateFieldGet(this, _KycService_idosRelayBaseUrl, "f"), 'fetchIdosRelayJwks', 'idOS relay JWKS', 'KycService: idosRelayBaseUrl is not configured; cannot fetch JWKS to verify the ukycCapabilityToken schema.');
456
- }
457
- /**
458
- * Creates a UKYC session for the SumSub document-verification sub-flow.
459
- *
460
- * The client registers its per-session X25519 public key so the server can
461
- * later open boxes sealed with the matching private key, and supplies the
462
- * customer's ISO 3166-1 alpha-3 country of residence. The response
463
- * carries per-secret encryption schemas (`encryptionDataKey` and
464
- * `ukycCapabilityToken`) so the client can wrap the `data_encryption_key` and
465
- * the read-only `ukyc_capability_token` and submit them via
466
- * {@link KycService.setAuthorizations}.
467
- *
468
- * @param params - The session parameters.
469
- * @returns The UKYC session id and encryption schemas.
470
- */
471
- async createUkycSession(params) {
472
- const url = new URL('/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
473
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
474
- method: 'POST',
475
- body: JSON.stringify({
476
- vendorId: params.vendor ?? 'moonpay',
477
- vendorUserId: 'mockedId',
478
- jwtToken: params.jwtToken,
479
- sessionClientPublicKey: params.sessionClientPublicKey,
480
- residenceCountry: params.residenceCountry,
481
- vendorMetadata: params.vendorMetadata ?? {},
482
- }),
483
- });
484
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, UkycSessionResponseStruct, 'UKYC sessions');
485
- }
486
- /**
487
- * Submits the wrapped `data_encryption_key` and wrapped
488
- * `ukyc_capability_token` for a UKYC session. Both secrets are sealed with
489
- * `wrapEncryptionKey` against the encryption schemas returned by
490
- * {@link KycService.createUkycSession}.
491
- *
492
- * @param params - The wrapped authorizations.
493
- * @returns The session status after the authorizations are applied.
494
- */
495
- async setAuthorizations(params) {
496
- const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/authorizations`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
497
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
498
- method: 'POST',
499
- body: JSON.stringify({
500
- wrappedEncryptionDataKey: params.wrappedEncryptionDataKey,
501
- wrappedUkycCapabilityToken: params.wrappedUkycCapabilityToken,
502
- }),
503
- });
504
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionStatusResponseStruct, 'authorizations');
505
- }
506
- /**
507
- * Creates (or refreshes) the SumSub verification journey for a UKYC session,
508
- * returning the applicant access token used to launch the SDK.
509
- *
510
- * @param sessionId - The UKYC session id from `createUkycSession`.
511
- * @returns The applicant access token and status.
512
- */
513
- async createJourney(sessionId) {
514
- const url = new URL(`/sessions/${encodeURIComponent(sessionId)}/journey`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
515
- const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'POST' });
516
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, ApplicantAccessTokenResponseStruct, 'journey');
517
- }
518
- /**
519
- * Fetches the current status of a UKYC session. Polled after the SumSub SDK
520
- * completes to determine the final verification decision.
521
- *
522
- * @param params - The parameters.
523
- * @param params.sessionId - The UKYC session id.
524
- * @returns The session status.
525
- */
526
- async getSessionStatus(params) {
527
- const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/status`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
528
- const data = await this.fetchQuery({
529
- queryKey: [`${this.name}:getSessionStatus`, params.sessionId],
530
- queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
531
- // Status is polled for a terminal decision, so it must always be fresh.
532
- staleTime: 0,
533
- gcTime: 0,
534
- });
535
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionStatusResponseStruct, 'session status');
536
- }
537
- }
538
- exports.KycService = KycService;
539
- _KycService_fetch = new WeakMap(), _KycService_baseUrl = new WeakMap(), _KycService_idosEnclaveBaseUrl = new WeakMap(), _KycService_idosRelayBaseUrl = new WeakMap(), _KycService_instances = new WeakSet(), _KycService_fetchWellKnownJwks =
540
- /**
541
- * Fetches a well-known JWKS from `baseUrl`, caching the result for an hour.
542
- *
543
- * @param baseUrl - Host base URL that serves `/.well-known/jwks.json`.
544
- * @param queryName - Cache query-key segment.
545
- * @param responseLabel - Label used in malformed-response errors.
546
- * @param missingConfigMessage - Error thrown when `baseUrl` is empty.
547
- * @returns The JWKS keys.
548
- */
549
- async function _KycService_fetchWellKnownJwks(baseUrl, queryName, responseLabel, missingConfigMessage) {
550
- if (!baseUrl) {
551
- throw new Error(missingConfigMessage);
552
- }
553
- const url = new URL(constants_js_1.UKYC_JWKS_PATH, baseUrl);
554
- const data = await this.fetchQuery({
555
- queryKey: [`${this.name}:${queryName}`, baseUrl],
556
- queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }, { authenticated: false }),
557
- staleTime: (0, utils_1.inMilliseconds)(1, utils_1.Duration.Hour),
558
- });
559
- return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, JwksResponseStruct, responseLabel);
560
- }, _KycService_validateResponse = function _KycService_validateResponse(data, struct, apiName) {
561
- try {
562
- (0, superstruct_1.assert)(data, struct);
563
- return data;
564
- }
565
- catch (error) {
566
- const detail = error instanceof superstruct_1.StructError
567
- ? `${error.message} (received: ${JSON.stringify(data)})`
568
- : // `assert` only ever throws `StructError` for the plain structs used
569
- // here, so this is a defensive fallback that is not exercised.
570
- /* istanbul ignore next */
571
- String(error);
572
- throw new Error(`Malformed response received from ${apiName} API: ${detail}`);
573
- }
574
- }, _KycService_requestJson =
575
- /**
576
- * Performs a single JSON request.
577
- *
578
- * Read endpoints pass this as the `queryFn` to {@link fetchQuery}, which
579
- * wraps it in the shared service policy (retries, circuit breaker). Write
580
- * endpoints call it directly, so they are executed exactly once. Requests
581
- * are authenticated with the wallet bearer token by default; pass
582
- * `{ authenticated: false }` for calls to services that do not expect it
583
- * (e.g. the idOS enclave or idOS relay JWKS endpoints).
584
- *
585
- * @param url - The request URL.
586
- * @param init - The request init (method, body).
587
- * @param options - Request options.
588
- * @param options.authenticated - Whether to attach the bearer token. Defaults
589
- * to `true`.
590
- * @returns The parsed JSON response.
591
- */
592
- async function _KycService_requestJson(url, init, options = {}) {
593
- const { authenticated = true } = options;
594
- const headers = {};
595
- // Only advertise a JSON body when one is actually sent; bodyless requests
596
- // (e.g. `createJourney`) must not carry a `Content-Type`.
597
- if (init.body !== undefined && init.body !== null) {
598
- headers['Content-Type'] = 'application/json';
599
- }
600
- if (authenticated) {
601
- const bearerToken = await this.messenger.call('AuthenticationController:getBearerToken');
602
- if (!bearerToken) {
603
- throw new Error('Unable to obtain an authentication bearer token — is the wallet signed in?');
604
- }
605
- (0, superstruct_1.assert)(bearerToken, (0, superstruct_1.string)());
606
- headers.Authorization = `Bearer ${bearerToken}`;
607
- }
608
- const response = await __classPrivateFieldGet(this, _KycService_fetch, "f").call(this, url.toString(), {
609
- ...init,
610
- headers,
611
- });
612
- if (!response.ok) {
613
- let detail = '';
614
- try {
615
- const errorBody = await response.json();
616
- if (errorBody && typeof errorBody === 'object') {
617
- const record = errorBody;
618
- if (typeof record.message === 'string') {
619
- detail = record.message;
620
- }
621
- else if (typeof record.error === 'string') {
622
- detail = record.error;
623
- }
624
- }
625
- }
626
- catch {
627
- // Ignore body parse failures; status alone is still useful.
628
- }
629
- throw new controller_utils_1.HttpError(response.status, `Fetching '${url.toString()}' failed with status '${response.status}'${detail ? `: ${detail}` : ''}`);
630
- }
631
- // DELETE (and similar) endpoints return 204 No Content.
632
- if (response.status === 204) {
633
- return null;
634
- }
635
- return (await response.json());
636
- };
637
- //# sourceMappingURL=KycService.cjs.map