@metamask-previews/kyc-controller 0.0.0-preview-823dcff → 0.0.0-preview-e57e5c3dc

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 (155) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +10 -2
  3. package/dist/KycController-method-action-types.cjs +7 -0
  4. package/dist/KycController-method-action-types.cjs.map +1 -0
  5. package/dist/KycController-method-action-types.d.cts +168 -0
  6. package/dist/KycController-method-action-types.d.cts.map +1 -0
  7. package/dist/KycController-method-action-types.d.mts +168 -0
  8. package/dist/KycController-method-action-types.d.mts.map +1 -0
  9. package/dist/KycController-method-action-types.mjs +6 -0
  10. package/dist/KycController-method-action-types.mjs.map +1 -0
  11. package/dist/KycController.cjs +1085 -0
  12. package/dist/KycController.cjs.map +1 -0
  13. package/dist/KycController.d.cts +255 -0
  14. package/dist/KycController.d.cts.map +1 -0
  15. package/dist/KycController.d.mts +255 -0
  16. package/dist/KycController.d.mts.map +1 -0
  17. package/dist/KycController.mjs +1080 -0
  18. package/dist/KycController.mjs.map +1 -0
  19. package/dist/KycService-method-action-types.cjs +7 -0
  20. package/dist/KycService-method-action-types.cjs.map +1 -0
  21. package/dist/KycService-method-action-types.d.cts +121 -0
  22. package/dist/KycService-method-action-types.d.cts.map +1 -0
  23. package/dist/KycService-method-action-types.d.mts +121 -0
  24. package/dist/KycService-method-action-types.d.mts.map +1 -0
  25. package/dist/KycService-method-action-types.mjs +6 -0
  26. package/dist/KycService-method-action-types.mjs.map +1 -0
  27. package/dist/KycService.cjs +417 -0
  28. package/dist/KycService.cjs.map +1 -0
  29. package/dist/KycService.d.cts +307 -0
  30. package/dist/KycService.d.cts.map +1 -0
  31. package/dist/KycService.d.mts +307 -0
  32. package/dist/KycService.d.mts.map +1 -0
  33. package/dist/KycService.mjs +413 -0
  34. package/dist/KycService.mjs.map +1 -0
  35. package/dist/countryCodes.cjs +274 -0
  36. package/dist/countryCodes.cjs.map +1 -0
  37. package/dist/countryCodes.d.cts +18 -0
  38. package/dist/countryCodes.d.cts.map +1 -0
  39. package/dist/countryCodes.d.mts +18 -0
  40. package/dist/countryCodes.d.mts.map +1 -0
  41. package/dist/countryCodes.mjs +270 -0
  42. package/dist/countryCodes.mjs.map +1 -0
  43. package/dist/crypto.cjs +154 -0
  44. package/dist/crypto.cjs.map +1 -0
  45. package/dist/crypto.d.cts +84 -0
  46. package/dist/crypto.d.cts.map +1 -0
  47. package/dist/crypto.d.mts +84 -0
  48. package/dist/crypto.d.mts.map +1 -0
  49. package/dist/crypto.mjs +149 -0
  50. package/dist/crypto.mjs.map +1 -0
  51. package/dist/encoding.cjs +40 -0
  52. package/dist/encoding.cjs.map +1 -0
  53. package/dist/encoding.d.cts +24 -0
  54. package/dist/encoding.d.cts.map +1 -0
  55. package/dist/encoding.d.mts +24 -0
  56. package/dist/encoding.d.mts.map +1 -0
  57. package/dist/encoding.mjs +35 -0
  58. package/dist/encoding.mjs.map +1 -0
  59. package/dist/index.cjs +34 -10
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +18 -7
  62. package/dist/index.d.cts.map +1 -1
  63. package/dist/index.d.mts +18 -7
  64. package/dist/index.d.mts.map +1 -1
  65. package/dist/index.mjs +11 -9
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/selectors.cjs +30 -0
  68. package/dist/selectors.cjs.map +1 -0
  69. package/dist/selectors.d.cts +24 -0
  70. package/dist/selectors.d.cts.map +1 -0
  71. package/dist/selectors.d.mts +24 -0
  72. package/dist/selectors.d.mts.map +1 -0
  73. package/dist/selectors.mjs +24 -0
  74. package/dist/selectors.mjs.map +1 -0
  75. package/dist/types.cjs +10 -0
  76. package/dist/types.cjs.map +1 -0
  77. package/dist/types.d.cts +124 -0
  78. package/dist/types.d.cts.map +1 -0
  79. package/dist/types.d.mts +124 -0
  80. package/dist/types.d.mts.map +1 -0
  81. package/dist/types.mjs +9 -0
  82. package/dist/types.mjs.map +1 -0
  83. package/dist/ukyc/constants.cjs +75 -0
  84. package/dist/ukyc/constants.cjs.map +1 -0
  85. package/dist/ukyc/constants.d.cts +69 -0
  86. package/dist/ukyc/constants.d.cts.map +1 -0
  87. package/dist/ukyc/constants.d.mts +69 -0
  88. package/dist/ukyc/constants.d.mts.map +1 -0
  89. package/dist/ukyc/constants.mjs +72 -0
  90. package/dist/ukyc/constants.mjs.map +1 -0
  91. package/dist/ukyc/deriveClientMaterial.cjs +65 -0
  92. package/dist/ukyc/deriveClientMaterial.cjs.map +1 -0
  93. package/dist/ukyc/deriveClientMaterial.d.cts +54 -0
  94. package/dist/ukyc/deriveClientMaterial.d.cts.map +1 -0
  95. package/dist/ukyc/deriveClientMaterial.d.mts +54 -0
  96. package/dist/ukyc/deriveClientMaterial.d.mts.map +1 -0
  97. package/dist/ukyc/deriveClientMaterial.mjs +60 -0
  98. package/dist/ukyc/deriveClientMaterial.mjs.map +1 -0
  99. package/dist/ukyc/jwtChain.cjs +54 -0
  100. package/dist/ukyc/jwtChain.cjs.map +1 -0
  101. package/dist/ukyc/jwtChain.d.cts +40 -0
  102. package/dist/ukyc/jwtChain.d.cts.map +1 -0
  103. package/dist/ukyc/jwtChain.d.mts +40 -0
  104. package/dist/ukyc/jwtChain.d.mts.map +1 -0
  105. package/dist/ukyc/jwtChain.mjs +50 -0
  106. package/dist/ukyc/jwtChain.mjs.map +1 -0
  107. package/dist/ukyc/localUserSecret.cjs +98 -0
  108. package/dist/ukyc/localUserSecret.cjs.map +1 -0
  109. package/dist/ukyc/localUserSecret.d.cts +65 -0
  110. package/dist/ukyc/localUserSecret.d.cts.map +1 -0
  111. package/dist/ukyc/localUserSecret.d.mts +65 -0
  112. package/dist/ukyc/localUserSecret.d.mts.map +1 -0
  113. package/dist/ukyc/localUserSecret.mjs +92 -0
  114. package/dist/ukyc/localUserSecret.mjs.map +1 -0
  115. package/dist/ukyc/storageAccessToken.cjs +139 -0
  116. package/dist/ukyc/storageAccessToken.cjs.map +1 -0
  117. package/dist/ukyc/storageAccessToken.d.cts +99 -0
  118. package/dist/ukyc/storageAccessToken.d.cts.map +1 -0
  119. package/dist/ukyc/storageAccessToken.d.mts +99 -0
  120. package/dist/ukyc/storageAccessToken.d.mts.map +1 -0
  121. package/dist/ukyc/storageAccessToken.mjs +133 -0
  122. package/dist/ukyc/storageAccessToken.mjs.map +1 -0
  123. package/dist/ukyc/testToken.cjs +61 -0
  124. package/dist/ukyc/testToken.cjs.map +1 -0
  125. package/dist/ukyc/testToken.d.cts +50 -0
  126. package/dist/ukyc/testToken.d.cts.map +1 -0
  127. package/dist/ukyc/testToken.d.mts +50 -0
  128. package/dist/ukyc/testToken.d.mts.map +1 -0
  129. package/dist/ukyc/testToken.mjs +57 -0
  130. package/dist/ukyc/testToken.mjs.map +1 -0
  131. package/dist/ukyc/wrapEncryptionKey.cjs +28 -0
  132. package/dist/ukyc/wrapEncryptionKey.cjs.map +1 -0
  133. package/dist/ukyc/wrapEncryptionKey.d.cts +34 -0
  134. package/dist/ukyc/wrapEncryptionKey.d.cts.map +1 -0
  135. package/dist/ukyc/wrapEncryptionKey.d.mts +34 -0
  136. package/dist/ukyc/wrapEncryptionKey.d.mts.map +1 -0
  137. package/dist/ukyc/wrapEncryptionKey.mjs +25 -0
  138. package/dist/ukyc/wrapEncryptionKey.mjs.map +1 -0
  139. package/dist/ukyc/wrapUserKey.cjs +80 -0
  140. package/dist/ukyc/wrapUserKey.cjs.map +1 -0
  141. package/dist/ukyc/wrapUserKey.d.cts +26 -0
  142. package/dist/ukyc/wrapUserKey.d.cts.map +1 -0
  143. package/dist/ukyc/wrapUserKey.d.mts +26 -0
  144. package/dist/ukyc/wrapUserKey.d.mts.map +1 -0
  145. package/dist/ukyc/wrapUserKey.mjs +76 -0
  146. package/dist/ukyc/wrapUserKey.mjs.map +1 -0
  147. package/dist/ukyc/wrappedRelayPayload.cjs +32 -0
  148. package/dist/ukyc/wrappedRelayPayload.cjs.map +1 -0
  149. package/dist/ukyc/wrappedRelayPayload.d.cts +35 -0
  150. package/dist/ukyc/wrappedRelayPayload.d.cts.map +1 -0
  151. package/dist/ukyc/wrappedRelayPayload.d.mts +35 -0
  152. package/dist/ukyc/wrappedRelayPayload.d.mts.map +1 -0
  153. package/dist/ukyc/wrappedRelayPayload.mjs +28 -0
  154. package/dist/ukyc/wrappedRelayPayload.mjs.map +1 -0
  155. package/package.json +24 -3
@@ -0,0 +1,307 @@
1
+ import { BaseDataService } from "@metamask/base-data-service";
2
+ import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from "@metamask/base-data-service";
3
+ import type { CreateServicePolicyOptions } from "@metamask/controller-utils";
4
+ import type { GeolocationControllerGetGeolocationAction } from "@metamask/geolocation-controller";
5
+ import type { Messenger } from "@metamask/messenger";
6
+ import type { AuthenticationControllerGetBearerTokenAction } from "@metamask/profile-sync-controller/auth";
7
+ import type { Infer, Struct } from "@metamask/superstruct";
8
+ import type { QueryClientConfig } from "@tanstack/query-core";
9
+ import type { KycServiceMethodActions } from "./KycService-method-action-types.cjs";
10
+ import type { KycDisclaimer, KycSessionStatus } from "./types.cjs";
11
+ import type { UkycStorageAccessToken } from "./ukyc/storageAccessToken.cjs";
12
+ /**
13
+ * The name of the {@link KycService}, used to namespace the service's actions.
14
+ */
15
+ export declare const serviceName = "KycService";
16
+ /**
17
+ * Invalidates cached queries serviced by {@link KycService}.
18
+ */
19
+ export type KycServiceInvalidateQueriesAction = DataServiceInvalidateQueriesAction<typeof serviceName>;
20
+ /**
21
+ * Actions that {@link KycService} exposes to other consumers.
22
+ */
23
+ export type KycServiceActions = KycServiceMethodActions | KycServiceInvalidateQueriesAction;
24
+ /**
25
+ * Actions from other messengers that {@link KycService} calls.
26
+ */
27
+ type AllowedActions = AuthenticationControllerGetBearerTokenAction | GeolocationControllerGetGeolocationAction;
28
+ /**
29
+ * Published when {@link KycService}'s cache is updated.
30
+ */
31
+ export type KycServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<typeof serviceName>;
32
+ /**
33
+ * Published when a single key within {@link KycService}'s cache is updated.
34
+ */
35
+ export type KycServiceGranularCacheUpdatedEvent = DataServiceGranularCacheUpdatedEvent<typeof serviceName>;
36
+ /**
37
+ * Events that {@link KycService} exposes to other consumers.
38
+ */
39
+ export type KycServiceEvents = KycServiceCacheUpdatedEvent | KycServiceGranularCacheUpdatedEvent;
40
+ /**
41
+ * Events from other messengers that {@link KycService} subscribes to.
42
+ */
43
+ type AllowedEvents = never;
44
+ /**
45
+ * The messenger restricted to actions and events accessed by
46
+ * {@link KycService}.
47
+ */
48
+ export type KycServiceMessenger = Messenger<typeof serviceName, KycServiceActions | AllowedActions, KycServiceEvents | AllowedEvents>;
49
+ /**
50
+ * Options for constructing a {@link KycService}.
51
+ */
52
+ export type KycServiceOptions = {
53
+ messenger: KycServiceMessenger;
54
+ fetch: typeof fetch;
55
+ /**
56
+ * Mandatory value that sets the base url to KYC api
57
+ */
58
+ baseUrl: string;
59
+ /**
60
+ * Base URL of the Fractal encryption service, from which the JWKS used to
61
+ * verify the `jwtChain` returned by {@link KycService.getWrappingKey} is
62
+ * fetched. Required to run the wrapping-key exchange in
63
+ * {@link KycService.fetchJwks}.
64
+ */
65
+ fractalEncryptionBaseUrl?: string;
66
+ /**
67
+ * Shared configuration applied to all queries exposed by the service (e.g. a
68
+ * default `staleTime`/`cacheTime`). Each data service gets its own
69
+ * `QueryClient`.
70
+ */
71
+ queryClientConfig?: QueryClientConfig;
72
+ policyOptions?: CreateServicePolicyOptions;
73
+ };
74
+ declare const CreateSessionResponseStruct: Struct<{
75
+ sessionToken: string;
76
+ }, {
77
+ sessionToken: Struct<string, null>;
78
+ }>;
79
+ declare const WrappingKeyResponseStruct: Struct<{
80
+ id: string;
81
+ jwtChain: string;
82
+ sessionServerPublicKey: {
83
+ kty: string;
84
+ crv: string;
85
+ x: string;
86
+ };
87
+ }, {
88
+ id: Struct<string, null>;
89
+ jwtChain: Struct<string, null>;
90
+ sessionServerPublicKey: Struct<{
91
+ kty: string;
92
+ crv: string;
93
+ x: string;
94
+ }, {
95
+ kty: Struct<string, null>;
96
+ crv: Struct<string, null>;
97
+ x: Struct<string, null>;
98
+ }>;
99
+ }>;
100
+ export type WrappingKeyResponse = Infer<typeof WrappingKeyResponseStruct>;
101
+ declare const JwksResponseStruct: Struct<{
102
+ keys: {
103
+ kty: string;
104
+ crv: string;
105
+ x: string;
106
+ kid: string;
107
+ }[];
108
+ }, {
109
+ keys: Struct<{
110
+ kty: string;
111
+ crv: string;
112
+ x: string;
113
+ kid: string;
114
+ }[], Struct<{
115
+ kty: string;
116
+ crv: string;
117
+ x: string;
118
+ kid: string;
119
+ }, {
120
+ kty: Struct<string, null>;
121
+ crv: Struct<string, null>;
122
+ x: Struct<string, null>;
123
+ kid: Struct<string, null>;
124
+ }>>;
125
+ }>;
126
+ export type JwksResponse = Infer<typeof JwksResponseStruct>;
127
+ declare const UkycSessionResponseStruct: Struct<{
128
+ sessionId: string;
129
+ kycStatus?: string | undefined;
130
+ finalStatus?: string | undefined;
131
+ }, {
132
+ sessionId: Struct<string, null>;
133
+ kycStatus: Struct<string | undefined, null>;
134
+ finalStatus: Struct<string | undefined, null>;
135
+ }>;
136
+ export type UkycSessionResponse = Infer<typeof UkycSessionResponseStruct>;
137
+ declare const ApplicantAccessTokenResponseStruct: Struct<{
138
+ status: string;
139
+ applicantAccessToken: string;
140
+ }, {
141
+ status: Struct<string, null>;
142
+ applicantAccessToken: Struct<string, null>;
143
+ }>;
144
+ export type ApplicantAccessTokenResponse = Infer<typeof ApplicantAccessTokenResponseStruct>;
145
+ export type CreateSessionParams = {
146
+ email: string;
147
+ termsAcceptedAt: string;
148
+ disclaimerIds: string[];
149
+ };
150
+ export type CheckKycRequiredParams = {
151
+ accessToken: string;
152
+ country: string;
153
+ capabilities?: {
154
+ product: string;
155
+ }[];
156
+ };
157
+ export type GetWrappingKeyParams = {
158
+ sessionClientPublicKey: string;
159
+ };
160
+ /**
161
+ * The wrapped `data_encryption_key` sent to the UKYC backend when creating a
162
+ * session. `encryptedKey` and `nonce` are produced by `wrapEncryptionKey`;
163
+ * `sessionId` is the wrapping key id returned by `getWrappingKey`.
164
+ */
165
+ export type WrappedEncryptionKey = {
166
+ sessionId: string;
167
+ encryptedKey: string;
168
+ nonce: string;
169
+ };
170
+ export type CreateUkycSessionParams = {
171
+ jwtToken: string;
172
+ vendorMetadata: Record<string, unknown>;
173
+ wrappedEncryptionKey: WrappedEncryptionKey;
174
+ /**
175
+ * The client-signed `ukyc_capability_token` (envelope: payload + Ed25519
176
+ * signature) authorizing later storage access for this session. It is minted
177
+ * by the client with `read`-only scope — see the UKYC storage-and-auth spec
178
+ * for how it is formed. Only the client holds the signing key, so only the
179
+ * client can mint it. The envelope is base64url-encoded into a compact string
180
+ * before it is sent to the backend.
181
+ */
182
+ ukycCapabilityToken: UkycStorageAccessToken;
183
+ };
184
+ export type GetSessionStatusParams = {
185
+ sessionId: string;
186
+ };
187
+ /**
188
+ * `KycService` communicates with the Universal KYC (UKYC) backend to drive the
189
+ * identity + document-verification flow. It is stateless and platform-agnostic:
190
+ * HTTP is performed through an injected `fetch`, and the auth bearer token and
191
+ * geolocation come from other controllers via the messenger.
192
+ *
193
+ * It extends {@link BaseDataService}, so every request is routed through
194
+ * `fetchQuery`: it is wrapped in the shared service policy (retries, circuit
195
+ * breaker) and its result is exposed via the service's `QueryClient`. Read-only
196
+ * endpoints (`fetchDisclaimers`, `fetchJwks`) are cached with a `staleTime`;
197
+ * the session-creating and status-polling endpoints opt out of caching
198
+ * (`staleTime`/`cacheTime` of `0`) so they never serve a stale result.
199
+ */
200
+ export declare class KycService extends BaseDataService<typeof serviceName, KycServiceMessenger> {
201
+ #private;
202
+ /**
203
+ * Constructs a new KycService.
204
+ *
205
+ * @param options - The constructor options.
206
+ * @param options.messenger - The messenger suited for this service.
207
+ * @param options.fetch - A function used to make HTTP requests.
208
+ * @param options.baseUrl - Base URL of the KYC API
209
+ * @param options.fractalEncryptionBaseUrl - Base URL of the Fractal
210
+ * encryption service, from which the JWKS used to verify the wrapping-key
211
+ * `jwtChain` is fetched.
212
+ * @param options.queryClientConfig - Shared configuration for all queries
213
+ * exposed by the service.
214
+ * @param options.policyOptions - Options for the request service policy.
215
+ */
216
+ constructor({ messenger, fetch: fetchFunction, baseUrl, fractalEncryptionBaseUrl, queryClientConfig, policyOptions, }: KycServiceOptions);
217
+ /**
218
+ * Resolves the customer's country from the geolocation source and converts it
219
+ * to an ISO 3166-1 alpha-3 code.
220
+ *
221
+ * @returns The alpha-3 country code.
222
+ * @throws If the country cannot be determined or mapped.
223
+ */
224
+ getGeoCountry(): Promise<string>;
225
+ /**
226
+ * Fetches the disclaimers the customer must accept before a session is
227
+ * created.
228
+ *
229
+ * @param params - The parameters.
230
+ * @param params.country - ISO 3166-1 alpha-3 country code.
231
+ * @returns The disclaimers.
232
+ */
233
+ fetchDisclaimers({ country, }: {
234
+ country: string;
235
+ }): Promise<KycDisclaimer[]>;
236
+ /**
237
+ * Creates a vendor session via the UKYC backend.
238
+ *
239
+ * @param params - The session parameters.
240
+ * @returns The created session token.
241
+ */
242
+ createSession(params: CreateSessionParams): Promise<Infer<typeof CreateSessionResponseStruct>>;
243
+ /**
244
+ * Checks whether KYC is required for the given access token, country, and
245
+ * capabilities.
246
+ *
247
+ * @param params - The check parameters.
248
+ * @returns Whether KYC is required.
249
+ */
250
+ checkKycRequired(params: CheckKycRequiredParams): Promise<{
251
+ kycRequired: boolean;
252
+ }>;
253
+ /**
254
+ * Requests a per-session wrapping key from the UKYC backend.
255
+ *
256
+ * The client sends its ephemeral X25519 public key; the backend responds with
257
+ * its session public key (`sessionServerPublicKey`) and a `jwtChain` that
258
+ * attests it. The caller must verify `jwtChain` against the Fractal JWKS
259
+ * (see {@link KycService.fetchJwks}) before trusting the key to wrap the
260
+ * `data_encryption_key`.
261
+ *
262
+ * @param params - The parameters.
263
+ * @param params.sessionClientPublicKey - Our ephemeral X25519 public key
264
+ * (base64url).
265
+ * @returns The wrapping key id, `jwtChain`, and session server public key.
266
+ */
267
+ getWrappingKey(params: GetWrappingKeyParams): Promise<WrappingKeyResponse>;
268
+ /**
269
+ * Fetches the Fractal encryption service JWKS used to verify the `jwtChain`
270
+ * returned by {@link KycService.getWrappingKey}.
271
+ *
272
+ * This is an unauthenticated request to a well-known path on the Fractal
273
+ * host, distinct from the UKYC base URL.
274
+ *
275
+ * @returns The JWKS keys.
276
+ */
277
+ fetchJwks(): Promise<JwksResponse>;
278
+ /**
279
+ * Creates a UKYC session for the SumSub document-verification sub-flow,
280
+ * handing over the wrapped `data_encryption_key` and the client-signed,
281
+ * read-only `ukyc_capability_token` that authorizes later storage access for
282
+ * the session.
283
+ *
284
+ * @param params - The session parameters.
285
+ * @returns The UKYC session identifiers.
286
+ */
287
+ createUkycSession(params: CreateUkycSessionParams): Promise<UkycSessionResponse>;
288
+ /**
289
+ * Creates (or refreshes) the SumSub verification journey for a UKYC session,
290
+ * returning the applicant access token used to launch the SDK.
291
+ *
292
+ * @param sessionId - The UKYC session id from `createUkycSession`.
293
+ * @returns The applicant access token and status.
294
+ */
295
+ createJourney(sessionId: string): Promise<ApplicantAccessTokenResponse>;
296
+ /**
297
+ * Fetches the current status of a UKYC session. Polled after the SumSub SDK
298
+ * completes to determine the final verification decision.
299
+ *
300
+ * @param params - The parameters.
301
+ * @param params.sessionId - The UKYC session id.
302
+ * @returns The session status.
303
+ */
304
+ getSessionStatus(params: GetSessionStatusParams): Promise<KycSessionStatus>;
305
+ }
306
+ export {};
307
+ //# sourceMappingURL=KycService.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KycService.d.cts","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oCAAoC;AAC9D,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,oCAAoC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC;AAE7E,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AE,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAgC/B;;;;;;OAMG;IACG,aAAa,CACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,4BAA4B,CAAC;IAmBxC;;;;;;;OAOG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;CAgH7B"}
@@ -0,0 +1,307 @@
1
+ import { BaseDataService } from "@metamask/base-data-service";
2
+ import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from "@metamask/base-data-service";
3
+ import type { CreateServicePolicyOptions } from "@metamask/controller-utils";
4
+ import type { GeolocationControllerGetGeolocationAction } from "@metamask/geolocation-controller";
5
+ import type { Messenger } from "@metamask/messenger";
6
+ import type { AuthenticationControllerGetBearerTokenAction } from "@metamask/profile-sync-controller/auth";
7
+ import type { Infer, Struct } from "@metamask/superstruct";
8
+ import type { QueryClientConfig } from "@tanstack/query-core";
9
+ import type { KycServiceMethodActions } from "./KycService-method-action-types.mjs";
10
+ import type { KycDisclaimer, KycSessionStatus } from "./types.mjs";
11
+ import type { UkycStorageAccessToken } from "./ukyc/storageAccessToken.mjs";
12
+ /**
13
+ * The name of the {@link KycService}, used to namespace the service's actions.
14
+ */
15
+ export declare const serviceName = "KycService";
16
+ /**
17
+ * Invalidates cached queries serviced by {@link KycService}.
18
+ */
19
+ export type KycServiceInvalidateQueriesAction = DataServiceInvalidateQueriesAction<typeof serviceName>;
20
+ /**
21
+ * Actions that {@link KycService} exposes to other consumers.
22
+ */
23
+ export type KycServiceActions = KycServiceMethodActions | KycServiceInvalidateQueriesAction;
24
+ /**
25
+ * Actions from other messengers that {@link KycService} calls.
26
+ */
27
+ type AllowedActions = AuthenticationControllerGetBearerTokenAction | GeolocationControllerGetGeolocationAction;
28
+ /**
29
+ * Published when {@link KycService}'s cache is updated.
30
+ */
31
+ export type KycServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<typeof serviceName>;
32
+ /**
33
+ * Published when a single key within {@link KycService}'s cache is updated.
34
+ */
35
+ export type KycServiceGranularCacheUpdatedEvent = DataServiceGranularCacheUpdatedEvent<typeof serviceName>;
36
+ /**
37
+ * Events that {@link KycService} exposes to other consumers.
38
+ */
39
+ export type KycServiceEvents = KycServiceCacheUpdatedEvent | KycServiceGranularCacheUpdatedEvent;
40
+ /**
41
+ * Events from other messengers that {@link KycService} subscribes to.
42
+ */
43
+ type AllowedEvents = never;
44
+ /**
45
+ * The messenger restricted to actions and events accessed by
46
+ * {@link KycService}.
47
+ */
48
+ export type KycServiceMessenger = Messenger<typeof serviceName, KycServiceActions | AllowedActions, KycServiceEvents | AllowedEvents>;
49
+ /**
50
+ * Options for constructing a {@link KycService}.
51
+ */
52
+ export type KycServiceOptions = {
53
+ messenger: KycServiceMessenger;
54
+ fetch: typeof fetch;
55
+ /**
56
+ * Mandatory value that sets the base url to KYC api
57
+ */
58
+ baseUrl: string;
59
+ /**
60
+ * Base URL of the Fractal encryption service, from which the JWKS used to
61
+ * verify the `jwtChain` returned by {@link KycService.getWrappingKey} is
62
+ * fetched. Required to run the wrapping-key exchange in
63
+ * {@link KycService.fetchJwks}.
64
+ */
65
+ fractalEncryptionBaseUrl?: string;
66
+ /**
67
+ * Shared configuration applied to all queries exposed by the service (e.g. a
68
+ * default `staleTime`/`cacheTime`). Each data service gets its own
69
+ * `QueryClient`.
70
+ */
71
+ queryClientConfig?: QueryClientConfig;
72
+ policyOptions?: CreateServicePolicyOptions;
73
+ };
74
+ declare const CreateSessionResponseStruct: Struct<{
75
+ sessionToken: string;
76
+ }, {
77
+ sessionToken: Struct<string, null>;
78
+ }>;
79
+ declare const WrappingKeyResponseStruct: Struct<{
80
+ id: string;
81
+ jwtChain: string;
82
+ sessionServerPublicKey: {
83
+ kty: string;
84
+ crv: string;
85
+ x: string;
86
+ };
87
+ }, {
88
+ id: Struct<string, null>;
89
+ jwtChain: Struct<string, null>;
90
+ sessionServerPublicKey: Struct<{
91
+ kty: string;
92
+ crv: string;
93
+ x: string;
94
+ }, {
95
+ kty: Struct<string, null>;
96
+ crv: Struct<string, null>;
97
+ x: Struct<string, null>;
98
+ }>;
99
+ }>;
100
+ export type WrappingKeyResponse = Infer<typeof WrappingKeyResponseStruct>;
101
+ declare const JwksResponseStruct: Struct<{
102
+ keys: {
103
+ kty: string;
104
+ crv: string;
105
+ x: string;
106
+ kid: string;
107
+ }[];
108
+ }, {
109
+ keys: Struct<{
110
+ kty: string;
111
+ crv: string;
112
+ x: string;
113
+ kid: string;
114
+ }[], Struct<{
115
+ kty: string;
116
+ crv: string;
117
+ x: string;
118
+ kid: string;
119
+ }, {
120
+ kty: Struct<string, null>;
121
+ crv: Struct<string, null>;
122
+ x: Struct<string, null>;
123
+ kid: Struct<string, null>;
124
+ }>>;
125
+ }>;
126
+ export type JwksResponse = Infer<typeof JwksResponseStruct>;
127
+ declare const UkycSessionResponseStruct: Struct<{
128
+ sessionId: string;
129
+ kycStatus?: string | undefined;
130
+ finalStatus?: string | undefined;
131
+ }, {
132
+ sessionId: Struct<string, null>;
133
+ kycStatus: Struct<string | undefined, null>;
134
+ finalStatus: Struct<string | undefined, null>;
135
+ }>;
136
+ export type UkycSessionResponse = Infer<typeof UkycSessionResponseStruct>;
137
+ declare const ApplicantAccessTokenResponseStruct: Struct<{
138
+ status: string;
139
+ applicantAccessToken: string;
140
+ }, {
141
+ status: Struct<string, null>;
142
+ applicantAccessToken: Struct<string, null>;
143
+ }>;
144
+ export type ApplicantAccessTokenResponse = Infer<typeof ApplicantAccessTokenResponseStruct>;
145
+ export type CreateSessionParams = {
146
+ email: string;
147
+ termsAcceptedAt: string;
148
+ disclaimerIds: string[];
149
+ };
150
+ export type CheckKycRequiredParams = {
151
+ accessToken: string;
152
+ country: string;
153
+ capabilities?: {
154
+ product: string;
155
+ }[];
156
+ };
157
+ export type GetWrappingKeyParams = {
158
+ sessionClientPublicKey: string;
159
+ };
160
+ /**
161
+ * The wrapped `data_encryption_key` sent to the UKYC backend when creating a
162
+ * session. `encryptedKey` and `nonce` are produced by `wrapEncryptionKey`;
163
+ * `sessionId` is the wrapping key id returned by `getWrappingKey`.
164
+ */
165
+ export type WrappedEncryptionKey = {
166
+ sessionId: string;
167
+ encryptedKey: string;
168
+ nonce: string;
169
+ };
170
+ export type CreateUkycSessionParams = {
171
+ jwtToken: string;
172
+ vendorMetadata: Record<string, unknown>;
173
+ wrappedEncryptionKey: WrappedEncryptionKey;
174
+ /**
175
+ * The client-signed `ukyc_capability_token` (envelope: payload + Ed25519
176
+ * signature) authorizing later storage access for this session. It is minted
177
+ * by the client with `read`-only scope — see the UKYC storage-and-auth spec
178
+ * for how it is formed. Only the client holds the signing key, so only the
179
+ * client can mint it. The envelope is base64url-encoded into a compact string
180
+ * before it is sent to the backend.
181
+ */
182
+ ukycCapabilityToken: UkycStorageAccessToken;
183
+ };
184
+ export type GetSessionStatusParams = {
185
+ sessionId: string;
186
+ };
187
+ /**
188
+ * `KycService` communicates with the Universal KYC (UKYC) backend to drive the
189
+ * identity + document-verification flow. It is stateless and platform-agnostic:
190
+ * HTTP is performed through an injected `fetch`, and the auth bearer token and
191
+ * geolocation come from other controllers via the messenger.
192
+ *
193
+ * It extends {@link BaseDataService}, so every request is routed through
194
+ * `fetchQuery`: it is wrapped in the shared service policy (retries, circuit
195
+ * breaker) and its result is exposed via the service's `QueryClient`. Read-only
196
+ * endpoints (`fetchDisclaimers`, `fetchJwks`) are cached with a `staleTime`;
197
+ * the session-creating and status-polling endpoints opt out of caching
198
+ * (`staleTime`/`cacheTime` of `0`) so they never serve a stale result.
199
+ */
200
+ export declare class KycService extends BaseDataService<typeof serviceName, KycServiceMessenger> {
201
+ #private;
202
+ /**
203
+ * Constructs a new KycService.
204
+ *
205
+ * @param options - The constructor options.
206
+ * @param options.messenger - The messenger suited for this service.
207
+ * @param options.fetch - A function used to make HTTP requests.
208
+ * @param options.baseUrl - Base URL of the KYC API
209
+ * @param options.fractalEncryptionBaseUrl - Base URL of the Fractal
210
+ * encryption service, from which the JWKS used to verify the wrapping-key
211
+ * `jwtChain` is fetched.
212
+ * @param options.queryClientConfig - Shared configuration for all queries
213
+ * exposed by the service.
214
+ * @param options.policyOptions - Options for the request service policy.
215
+ */
216
+ constructor({ messenger, fetch: fetchFunction, baseUrl, fractalEncryptionBaseUrl, queryClientConfig, policyOptions, }: KycServiceOptions);
217
+ /**
218
+ * Resolves the customer's country from the geolocation source and converts it
219
+ * to an ISO 3166-1 alpha-3 code.
220
+ *
221
+ * @returns The alpha-3 country code.
222
+ * @throws If the country cannot be determined or mapped.
223
+ */
224
+ getGeoCountry(): Promise<string>;
225
+ /**
226
+ * Fetches the disclaimers the customer must accept before a session is
227
+ * created.
228
+ *
229
+ * @param params - The parameters.
230
+ * @param params.country - ISO 3166-1 alpha-3 country code.
231
+ * @returns The disclaimers.
232
+ */
233
+ fetchDisclaimers({ country, }: {
234
+ country: string;
235
+ }): Promise<KycDisclaimer[]>;
236
+ /**
237
+ * Creates a vendor session via the UKYC backend.
238
+ *
239
+ * @param params - The session parameters.
240
+ * @returns The created session token.
241
+ */
242
+ createSession(params: CreateSessionParams): Promise<Infer<typeof CreateSessionResponseStruct>>;
243
+ /**
244
+ * Checks whether KYC is required for the given access token, country, and
245
+ * capabilities.
246
+ *
247
+ * @param params - The check parameters.
248
+ * @returns Whether KYC is required.
249
+ */
250
+ checkKycRequired(params: CheckKycRequiredParams): Promise<{
251
+ kycRequired: boolean;
252
+ }>;
253
+ /**
254
+ * Requests a per-session wrapping key from the UKYC backend.
255
+ *
256
+ * The client sends its ephemeral X25519 public key; the backend responds with
257
+ * its session public key (`sessionServerPublicKey`) and a `jwtChain` that
258
+ * attests it. The caller must verify `jwtChain` against the Fractal JWKS
259
+ * (see {@link KycService.fetchJwks}) before trusting the key to wrap the
260
+ * `data_encryption_key`.
261
+ *
262
+ * @param params - The parameters.
263
+ * @param params.sessionClientPublicKey - Our ephemeral X25519 public key
264
+ * (base64url).
265
+ * @returns The wrapping key id, `jwtChain`, and session server public key.
266
+ */
267
+ getWrappingKey(params: GetWrappingKeyParams): Promise<WrappingKeyResponse>;
268
+ /**
269
+ * Fetches the Fractal encryption service JWKS used to verify the `jwtChain`
270
+ * returned by {@link KycService.getWrappingKey}.
271
+ *
272
+ * This is an unauthenticated request to a well-known path on the Fractal
273
+ * host, distinct from the UKYC base URL.
274
+ *
275
+ * @returns The JWKS keys.
276
+ */
277
+ fetchJwks(): Promise<JwksResponse>;
278
+ /**
279
+ * Creates a UKYC session for the SumSub document-verification sub-flow,
280
+ * handing over the wrapped `data_encryption_key` and the client-signed,
281
+ * read-only `ukyc_capability_token` that authorizes later storage access for
282
+ * the session.
283
+ *
284
+ * @param params - The session parameters.
285
+ * @returns The UKYC session identifiers.
286
+ */
287
+ createUkycSession(params: CreateUkycSessionParams): Promise<UkycSessionResponse>;
288
+ /**
289
+ * Creates (or refreshes) the SumSub verification journey for a UKYC session,
290
+ * returning the applicant access token used to launch the SDK.
291
+ *
292
+ * @param sessionId - The UKYC session id from `createUkycSession`.
293
+ * @returns The applicant access token and status.
294
+ */
295
+ createJourney(sessionId: string): Promise<ApplicantAccessTokenResponse>;
296
+ /**
297
+ * Fetches the current status of a UKYC session. Polled after the SumSub SDK
298
+ * completes to determine the final verification decision.
299
+ *
300
+ * @param params - The parameters.
301
+ * @param params.sessionId - The UKYC session id.
302
+ * @returns The session status.
303
+ */
304
+ getSessionStatus(params: GetSessionStatusParams): Promise<KycSessionStatus>;
305
+ }
306
+ export {};
307
+ //# sourceMappingURL=KycService.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KycService.d.mts","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oCAAoC;AAC9D,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,oCAAoC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC;AAE7E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