@metamask-previews/kyc-controller 0.0.0-preview-8bfa290fb → 0.0.0-preview-ec24abb79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -6
- package/dist/KycController.cjs +17 -31
- package/dist/KycController.cjs.map +1 -1
- package/dist/KycController.d.cts +3 -3
- package/dist/KycController.d.cts.map +1 -1
- package/dist/KycController.d.mts +3 -3
- package/dist/KycController.d.mts.map +1 -1
- package/dist/KycController.mjs +17 -31
- package/dist/KycController.mjs.map +1 -1
- package/dist/KycService-method-action-types.cjs.map +1 -1
- package/dist/KycService-method-action-types.d.cts +6 -23
- package/dist/KycService-method-action-types.d.cts.map +1 -1
- package/dist/KycService-method-action-types.d.mts +6 -23
- package/dist/KycService-method-action-types.d.mts.map +1 -1
- package/dist/KycService-method-action-types.mjs.map +1 -1
- package/dist/KycService.cjs +118 -91
- package/dist/KycService.cjs.map +1 -1
- package/dist/KycService.d.cts +12 -38
- package/dist/KycService.d.cts.map +1 -1
- package/dist/KycService.d.mts +12 -38
- package/dist/KycService.d.mts.map +1 -1
- package/dist/KycService.mjs +118 -91
- package/dist/KycService.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +6 -15
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +6 -15
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.cjs +9 -4
- package/dist/ukyc/wrapEncryptionKey.cjs.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.cts +10 -8
- package/dist/ukyc/wrapEncryptionKey.d.cts.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.mts +10 -8
- package/dist/ukyc/wrapEncryptionKey.d.mts.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.mjs +9 -4
- package/dist/ukyc/wrapEncryptionKey.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/logger.cjs +0 -9
- package/dist/logger.cjs.map +0 -1
- package/dist/logger.d.cts +0 -6
- package/dist/logger.d.cts.map +0 -1
- package/dist/logger.d.mts +0 -6
- package/dist/logger.d.mts.map +0 -1
- package/dist/logger.mjs +0 -6
- package/dist/logger.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService-method-action-types.cjs","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { KycService } from './KycService.js';\n\n/**\n * Resolves the customer's country from the geolocation source and converts it\n * to an ISO 3166-1 alpha-3 code.\n *\n * @returns The alpha-3 country code.\n * @throws If the country cannot be determined or mapped.\n */\nexport type KycServiceGetGeoCountryAction = {\n type: `KycService:getGeoCountry`;\n handler: KycService['getGeoCountry'];\n};\n\n/**\n * Fetches the disclaimers the customer must accept before a session is\n * created.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor. Defaults to `moonpay`.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The disclaimers.\n */\nexport type
|
|
1
|
+
{"version":3,"file":"KycService-method-action-types.cjs","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { KycService } from './KycService.js';\n\n/**\n * Resolves the customer's country from the geolocation source and converts it\n * to an ISO 3166-1 alpha-3 code.\n *\n * @returns The alpha-3 country code.\n * @throws If the country cannot be determined or mapped.\n */\nexport type KycServiceGetGeoCountryAction = {\n type: `KycService:getGeoCountry`;\n handler: KycService['getGeoCountry'];\n};\n\n/**\n * Fetches the disclaimers the customer must accept before a session is\n * created.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor. Defaults to `moonpay`.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The disclaimers.\n */\nexport type KycServiceFetchDisclaimersAction = {\n type: `KycService:fetchDisclaimers`;\n handler: KycService['fetchDisclaimers'];\n};\n\n/**\n * Creates a vendor session via the UKYC backend.\n *\n * @param params - The session parameters.\n * @returns The created session token.\n */\nexport type KycServiceCreateSessionAction = {\n type: `KycService:createSession`;\n handler: KycService['createSession'];\n};\n\n/**\n * Checks whether KYC is required for the given vendor, country, and\n * capabilities.\n *\n * @param params - The check parameters.\n * @returns Whether KYC is required.\n */\nexport type KycServiceCheckKycRequiredAction = {\n type: `KycService:checkKycRequired`;\n handler: KycService['checkKycRequired'];\n};\n\n/**\n * Creates (or resumes) an empty-shell customer for the authenticated\n * canonical user on the given identity vendor. Must run before showing\n * vendor T&C so the customer exists and resume logic can key off vendor\n * status.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor (e.g. `iron` for Money/VBA).\n * @param params.email - Email associated with the customer.\n * @returns The vendor customer record (subset validated for controller use).\n */\nexport type KycServiceCreateVendorCustomerAction = {\n type: `KycService:createVendorCustomer`;\n handler: KycService['createVendorCustomer'];\n};\n\n/**\n * Records vendor T&C acceptance (`POST /vendors/{vendor}/disclaimers`).\n * For Iron this creates content signings from the disclaimer ids the\n * customer accepted. Session-scoped idOS / KYC-provider consents are\n * recorded separately via {@link submitSessionDisclaimers}. Retries re-POST\n * the same ids, matching the legacy `POST /consents` signing step.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor (e.g. `iron`).\n * @param params.disclaimerIds - Accepted vendor T&C ids.\n * @returns The vendor signing records.\n */\nexport type KycServiceSubmitVendorDisclaimersAction = {\n type: `KycService:submitVendorDisclaimers`;\n handler: KycService['submitVendorDisclaimers'];\n};\n\n/**\n * Fetches the session-scoped idOS + KYC-provider disclaimer catalog\n * (`GET /sessions/{sessionId}/disclaimers`). Requires an existing UKYC\n * session; vendor T&Cs continue to come from {@link fetchDisclaimers}.\n *\n * @param params - The parameters.\n * @param params.sessionId - The UKYC session id.\n * @returns The catalog, including which documents are already consented.\n */\nexport type KycServiceFetchSessionDisclaimersAction = {\n type: `KycService:fetchSessionDisclaimers`;\n handler: KycService['fetchSessionDisclaimers'];\n};\n\n/**\n * Records idOS + KYC-provider consents for a UKYC session\n * (`POST /sessions/{sessionId}/disclaimers`). `key`/`version` pairs must\n * match the current catalog from {@link fetchSessionDisclaimers}. A 409\n * means those document versions were already recorded for the session.\n *\n * @param params - The consent parameters.\n * @returns The updated catalog after recording.\n */\nexport type KycServiceSubmitSessionDisclaimersAction = {\n type: `KycService:submitSessionDisclaimers`;\n handler: KycService['submitSessionDisclaimers'];\n};\n\n/**\n * Fetches the user-keyed simplified KYC status used by Money toast / banner\n * surfaces (`GET /kyc/status`).\n *\n * @returns The simplified status payload.\n */\nexport type KycServiceFetchKycStatusAction = {\n type: `KycService:fetchKycStatus`;\n handler: KycService['fetchKycStatus'];\n};\n\n/**\n * Fetches the idOS enclave JWKS used to verify the\n * `encryptionDataKey` schema's `jwtChain` from\n * {@link KycService.createUkycSession}.\n *\n * This is an unauthenticated request to a well-known path on the idOS enclave\n * host, distinct from the UKYC base URL.\n *\n * @returns The JWKS keys.\n */\nexport type KycServiceFetchIdosEnclaveJwksAction = {\n type: `KycService:fetchIdosEnclaveJwks`;\n handler: KycService['fetchIdosEnclaveJwks'];\n};\n\n/**\n * Fetches the idOS relay JWKS used to verify the `ukycCapabilityToken`\n * schema's `jwtChain` from {@link KycService.createUkycSession}.\n *\n * This is an unauthenticated request to a well-known path on the idOS relay\n * host, distinct from both the UKYC base URL and the idOS enclave.\n *\n * @returns The JWKS keys.\n */\nexport type KycServiceFetchIdosRelayJwksAction = {\n type: `KycService:fetchIdosRelayJwks`;\n handler: KycService['fetchIdosRelayJwks'];\n};\n\n/**\n * Creates a UKYC session for the SumSub document-verification sub-flow.\n *\n * The client registers its per-session X25519 public key so the server can\n * later open boxes sealed with the matching private key, and supplies the\n * customer's ISO 3166-1 alpha-3 country of residence. The response\n * carries per-secret encryption schemas (`encryptionDataKey` and\n * `ukycCapabilityToken`) so the client can wrap the `data_encryption_key` and\n * the read-only `ukyc_capability_token` and submit them via\n * {@link KycService.setAuthorizations}.\n *\n * @param params - The session parameters.\n * @returns The UKYC session id and encryption schemas.\n */\nexport type KycServiceCreateUkycSessionAction = {\n type: `KycService:createUkycSession`;\n handler: KycService['createUkycSession'];\n};\n\n/**\n * Submits the wrapped `data_encryption_key` and wrapped\n * `ukyc_capability_token` for a UKYC session. Both secrets are sealed with\n * `wrapEncryptionKey` against the encryption schemas returned by\n * {@link KycService.createUkycSession}.\n *\n * @param params - The wrapped authorizations.\n * @returns The session status after the authorizations are applied.\n */\nexport type KycServiceSetAuthorizationsAction = {\n type: `KycService:setAuthorizations`;\n handler: KycService['setAuthorizations'];\n};\n\n/**\n * Creates (or refreshes) the SumSub verification journey for a UKYC session,\n * returning the applicant access token used to launch the SDK.\n *\n * @param sessionId - The UKYC session id from `createUkycSession`.\n * @returns The applicant access token and status.\n */\nexport type KycServiceCreateJourneyAction = {\n type: `KycService:createJourney`;\n handler: KycService['createJourney'];\n};\n\n/**\n * Fetches the current status of a UKYC session. Polled after the SumSub SDK\n * completes to determine the final verification decision.\n *\n * @param params - The parameters.\n * @param params.sessionId - The UKYC session id.\n * @returns The session status.\n */\nexport type KycServiceGetSessionStatusAction = {\n type: `KycService:getSessionStatus`;\n handler: KycService['getSessionStatus'];\n};\n\n/**\n * Union of all KycService action types.\n */\nexport type KycServiceMethodActions =\n | KycServiceGetGeoCountryAction\n | KycServiceFetchDisclaimersAction\n | KycServiceCreateSessionAction\n | KycServiceCheckKycRequiredAction\n | KycServiceCreateVendorCustomerAction\n | KycServiceSubmitVendorDisclaimersAction\n | KycServiceFetchSessionDisclaimersAction\n | KycServiceSubmitSessionDisclaimersAction\n | KycServiceFetchKycStatusAction\n | KycServiceFetchIdosEnclaveJwksAction\n | KycServiceFetchIdosRelayJwksAction\n | KycServiceCreateUkycSessionAction\n | KycServiceSetAuthorizationsAction\n | KycServiceCreateJourneyAction\n | KycServiceGetSessionStatusAction;\n"]}
|
|
@@ -23,9 +23,9 @@ export type KycServiceGetGeoCountryAction = {
|
|
|
23
23
|
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
24
24
|
* @returns The disclaimers.
|
|
25
25
|
*/
|
|
26
|
-
export type
|
|
27
|
-
type: `KycService:
|
|
28
|
-
handler: KycService['
|
|
26
|
+
export type KycServiceFetchDisclaimersAction = {
|
|
27
|
+
type: `KycService:fetchDisclaimers`;
|
|
28
|
+
handler: KycService['fetchDisclaimers'];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Creates a vendor session via the UKYC backend.
|
|
@@ -79,27 +79,10 @@ export type KycServiceSubmitVendorDisclaimersAction = {
|
|
|
79
79
|
type: `KycService:submitVendorDisclaimers`;
|
|
80
80
|
handler: KycService['submitVendorDisclaimers'];
|
|
81
81
|
};
|
|
82
|
-
/**
|
|
83
|
-
* Fetches the global idOS + KYC-provider disclaimer catalog
|
|
84
|
-
* (`GET /disclaimers?country=`). Does not include
|
|
85
|
-
* `credentialReusabilityConsentGiven` — that is session-scoped via
|
|
86
|
-
* {@link fetchSessionDisclaimers}. Vendor T&Cs continue to come from
|
|
87
|
-
* {@link fetchVendorDisclaimers}.
|
|
88
|
-
*
|
|
89
|
-
* @param params - The parameters.
|
|
90
|
-
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
91
|
-
* @returns The catalog documents.
|
|
92
|
-
*/
|
|
93
|
-
export type KycServiceFetchDisclaimersCatalogAction = {
|
|
94
|
-
type: `KycService:fetchDisclaimersCatalog`;
|
|
95
|
-
handler: KycService['fetchDisclaimersCatalog'];
|
|
96
|
-
};
|
|
97
82
|
/**
|
|
98
83
|
* Fetches the session-scoped idOS + KYC-provider disclaimer catalog
|
|
99
|
-
* (`GET /sessions/{sessionId}/disclaimers`)
|
|
100
|
-
*
|
|
101
|
-
* pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
|
|
102
|
-
* T&Cs continue to come from {@link fetchVendorDisclaimers}.
|
|
84
|
+
* (`GET /sessions/{sessionId}/disclaimers`). Requires an existing UKYC
|
|
85
|
+
* session; vendor T&Cs continue to come from {@link fetchDisclaimers}.
|
|
103
86
|
*
|
|
104
87
|
* @param params - The parameters.
|
|
105
88
|
* @param params.sessionId - The UKYC session id.
|
|
@@ -216,5 +199,5 @@ export type KycServiceGetSessionStatusAction = {
|
|
|
216
199
|
/**
|
|
217
200
|
* Union of all KycService action types.
|
|
218
201
|
*/
|
|
219
|
-
export type KycServiceMethodActions = KycServiceGetGeoCountryAction |
|
|
202
|
+
export type KycServiceMethodActions = KycServiceGetGeoCountryAction | KycServiceFetchDisclaimersAction | KycServiceCreateSessionAction | KycServiceCheckKycRequiredAction | KycServiceCreateVendorCustomerAction | KycServiceSubmitVendorDisclaimersAction | KycServiceFetchSessionDisclaimersAction | KycServiceSubmitSessionDisclaimersAction | KycServiceFetchKycStatusAction | KycServiceFetchIdosEnclaveJwksAction | KycServiceFetchIdosRelayJwksAction | KycServiceCreateUkycSessionAction | KycServiceSetAuthorizationsAction | KycServiceCreateJourneyAction | KycServiceGetSessionStatusAction;
|
|
220
203
|
//# sourceMappingURL=KycService-method-action-types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService-method-action-types.d.cts","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAwB;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"KycService-method-action-types.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AAuC,GACvC,wCAAwC,GACxC,8BAA8B,GAC9B,oCAAoC,GACpC,kCAAkC,GAClC,iCAAiC,GACjC,iCAAiC,GACjC,6BAA6B,GAC7B,gCAAgC,CAAC"}
|
|
@@ -23,9 +23,9 @@ export type KycServiceGetGeoCountryAction = {
|
|
|
23
23
|
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
24
24
|
* @returns The disclaimers.
|
|
25
25
|
*/
|
|
26
|
-
export type
|
|
27
|
-
type: `KycService:
|
|
28
|
-
handler: KycService['
|
|
26
|
+
export type KycServiceFetchDisclaimersAction = {
|
|
27
|
+
type: `KycService:fetchDisclaimers`;
|
|
28
|
+
handler: KycService['fetchDisclaimers'];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Creates a vendor session via the UKYC backend.
|
|
@@ -79,27 +79,10 @@ export type KycServiceSubmitVendorDisclaimersAction = {
|
|
|
79
79
|
type: `KycService:submitVendorDisclaimers`;
|
|
80
80
|
handler: KycService['submitVendorDisclaimers'];
|
|
81
81
|
};
|
|
82
|
-
/**
|
|
83
|
-
* Fetches the global idOS + KYC-provider disclaimer catalog
|
|
84
|
-
* (`GET /disclaimers?country=`). Does not include
|
|
85
|
-
* `credentialReusabilityConsentGiven` — that is session-scoped via
|
|
86
|
-
* {@link fetchSessionDisclaimers}. Vendor T&Cs continue to come from
|
|
87
|
-
* {@link fetchVendorDisclaimers}.
|
|
88
|
-
*
|
|
89
|
-
* @param params - The parameters.
|
|
90
|
-
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
91
|
-
* @returns The catalog documents.
|
|
92
|
-
*/
|
|
93
|
-
export type KycServiceFetchDisclaimersCatalogAction = {
|
|
94
|
-
type: `KycService:fetchDisclaimersCatalog`;
|
|
95
|
-
handler: KycService['fetchDisclaimersCatalog'];
|
|
96
|
-
};
|
|
97
82
|
/**
|
|
98
83
|
* Fetches the session-scoped idOS + KYC-provider disclaimer catalog
|
|
99
|
-
* (`GET /sessions/{sessionId}/disclaimers`)
|
|
100
|
-
*
|
|
101
|
-
* pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
|
|
102
|
-
* T&Cs continue to come from {@link fetchVendorDisclaimers}.
|
|
84
|
+
* (`GET /sessions/{sessionId}/disclaimers`). Requires an existing UKYC
|
|
85
|
+
* session; vendor T&Cs continue to come from {@link fetchDisclaimers}.
|
|
103
86
|
*
|
|
104
87
|
* @param params - The parameters.
|
|
105
88
|
* @param params.sessionId - The UKYC session id.
|
|
@@ -216,5 +199,5 @@ export type KycServiceGetSessionStatusAction = {
|
|
|
216
199
|
/**
|
|
217
200
|
* Union of all KycService action types.
|
|
218
201
|
*/
|
|
219
|
-
export type KycServiceMethodActions = KycServiceGetGeoCountryAction |
|
|
202
|
+
export type KycServiceMethodActions = KycServiceGetGeoCountryAction | KycServiceFetchDisclaimersAction | KycServiceCreateSessionAction | KycServiceCheckKycRequiredAction | KycServiceCreateVendorCustomerAction | KycServiceSubmitVendorDisclaimersAction | KycServiceFetchSessionDisclaimersAction | KycServiceSubmitSessionDisclaimersAction | KycServiceFetchKycStatusAction | KycServiceFetchIdosEnclaveJwksAction | KycServiceFetchIdosRelayJwksAction | KycServiceCreateUkycSessionAction | KycServiceSetAuthorizationsAction | KycServiceCreateJourneyAction | KycServiceGetSessionStatusAction;
|
|
220
203
|
//# sourceMappingURL=KycService-method-action-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService-method-action-types.d.mts","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAwB;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"KycService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GACvC,uCAAuC,GACvC,wCAAwC,GACxC,8BAA8B,GAC9B,oCAAoC,GACpC,kCAAkC,GAClC,iCAAiC,GACjC,iCAAiC,GACjC,6BAA6B,GAC7B,gCAAgC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService-method-action-types.mjs","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { KycService } from './KycService.js';\n\n/**\n * Resolves the customer's country from the geolocation source and converts it\n * to an ISO 3166-1 alpha-3 code.\n *\n * @returns The alpha-3 country code.\n * @throws If the country cannot be determined or mapped.\n */\nexport type KycServiceGetGeoCountryAction = {\n type: `KycService:getGeoCountry`;\n handler: KycService['getGeoCountry'];\n};\n\n/**\n * Fetches the disclaimers the customer must accept before a session is\n * created.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor. Defaults to `moonpay`.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The disclaimers.\n */\nexport type
|
|
1
|
+
{"version":3,"file":"KycService-method-action-types.mjs","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { KycService } from './KycService.js';\n\n/**\n * Resolves the customer's country from the geolocation source and converts it\n * to an ISO 3166-1 alpha-3 code.\n *\n * @returns The alpha-3 country code.\n * @throws If the country cannot be determined or mapped.\n */\nexport type KycServiceGetGeoCountryAction = {\n type: `KycService:getGeoCountry`;\n handler: KycService['getGeoCountry'];\n};\n\n/**\n * Fetches the disclaimers the customer must accept before a session is\n * created.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor. Defaults to `moonpay`.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The disclaimers.\n */\nexport type KycServiceFetchDisclaimersAction = {\n type: `KycService:fetchDisclaimers`;\n handler: KycService['fetchDisclaimers'];\n};\n\n/**\n * Creates a vendor session via the UKYC backend.\n *\n * @param params - The session parameters.\n * @returns The created session token.\n */\nexport type KycServiceCreateSessionAction = {\n type: `KycService:createSession`;\n handler: KycService['createSession'];\n};\n\n/**\n * Checks whether KYC is required for the given vendor, country, and\n * capabilities.\n *\n * @param params - The check parameters.\n * @returns Whether KYC is required.\n */\nexport type KycServiceCheckKycRequiredAction = {\n type: `KycService:checkKycRequired`;\n handler: KycService['checkKycRequired'];\n};\n\n/**\n * Creates (or resumes) an empty-shell customer for the authenticated\n * canonical user on the given identity vendor. Must run before showing\n * vendor T&C so the customer exists and resume logic can key off vendor\n * status.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor (e.g. `iron` for Money/VBA).\n * @param params.email - Email associated with the customer.\n * @returns The vendor customer record (subset validated for controller use).\n */\nexport type KycServiceCreateVendorCustomerAction = {\n type: `KycService:createVendorCustomer`;\n handler: KycService['createVendorCustomer'];\n};\n\n/**\n * Records vendor T&C acceptance (`POST /vendors/{vendor}/disclaimers`).\n * For Iron this creates content signings from the disclaimer ids the\n * customer accepted. Session-scoped idOS / KYC-provider consents are\n * recorded separately via {@link submitSessionDisclaimers}. Retries re-POST\n * the same ids, matching the legacy `POST /consents` signing step.\n *\n * @param params - The parameters.\n * @param params.vendor - Identity vendor (e.g. `iron`).\n * @param params.disclaimerIds - Accepted vendor T&C ids.\n * @returns The vendor signing records.\n */\nexport type KycServiceSubmitVendorDisclaimersAction = {\n type: `KycService:submitVendorDisclaimers`;\n handler: KycService['submitVendorDisclaimers'];\n};\n\n/**\n * Fetches the session-scoped idOS + KYC-provider disclaimer catalog\n * (`GET /sessions/{sessionId}/disclaimers`). Requires an existing UKYC\n * session; vendor T&Cs continue to come from {@link fetchDisclaimers}.\n *\n * @param params - The parameters.\n * @param params.sessionId - The UKYC session id.\n * @returns The catalog, including which documents are already consented.\n */\nexport type KycServiceFetchSessionDisclaimersAction = {\n type: `KycService:fetchSessionDisclaimers`;\n handler: KycService['fetchSessionDisclaimers'];\n};\n\n/**\n * Records idOS + KYC-provider consents for a UKYC session\n * (`POST /sessions/{sessionId}/disclaimers`). `key`/`version` pairs must\n * match the current catalog from {@link fetchSessionDisclaimers}. A 409\n * means those document versions were already recorded for the session.\n *\n * @param params - The consent parameters.\n * @returns The updated catalog after recording.\n */\nexport type KycServiceSubmitSessionDisclaimersAction = {\n type: `KycService:submitSessionDisclaimers`;\n handler: KycService['submitSessionDisclaimers'];\n};\n\n/**\n * Fetches the user-keyed simplified KYC status used by Money toast / banner\n * surfaces (`GET /kyc/status`).\n *\n * @returns The simplified status payload.\n */\nexport type KycServiceFetchKycStatusAction = {\n type: `KycService:fetchKycStatus`;\n handler: KycService['fetchKycStatus'];\n};\n\n/**\n * Fetches the idOS enclave JWKS used to verify the\n * `encryptionDataKey` schema's `jwtChain` from\n * {@link KycService.createUkycSession}.\n *\n * This is an unauthenticated request to a well-known path on the idOS enclave\n * host, distinct from the UKYC base URL.\n *\n * @returns The JWKS keys.\n */\nexport type KycServiceFetchIdosEnclaveJwksAction = {\n type: `KycService:fetchIdosEnclaveJwks`;\n handler: KycService['fetchIdosEnclaveJwks'];\n};\n\n/**\n * Fetches the idOS relay JWKS used to verify the `ukycCapabilityToken`\n * schema's `jwtChain` from {@link KycService.createUkycSession}.\n *\n * This is an unauthenticated request to a well-known path on the idOS relay\n * host, distinct from both the UKYC base URL and the idOS enclave.\n *\n * @returns The JWKS keys.\n */\nexport type KycServiceFetchIdosRelayJwksAction = {\n type: `KycService:fetchIdosRelayJwks`;\n handler: KycService['fetchIdosRelayJwks'];\n};\n\n/**\n * Creates a UKYC session for the SumSub document-verification sub-flow.\n *\n * The client registers its per-session X25519 public key so the server can\n * later open boxes sealed with the matching private key, and supplies the\n * customer's ISO 3166-1 alpha-3 country of residence. The response\n * carries per-secret encryption schemas (`encryptionDataKey` and\n * `ukycCapabilityToken`) so the client can wrap the `data_encryption_key` and\n * the read-only `ukyc_capability_token` and submit them via\n * {@link KycService.setAuthorizations}.\n *\n * @param params - The session parameters.\n * @returns The UKYC session id and encryption schemas.\n */\nexport type KycServiceCreateUkycSessionAction = {\n type: `KycService:createUkycSession`;\n handler: KycService['createUkycSession'];\n};\n\n/**\n * Submits the wrapped `data_encryption_key` and wrapped\n * `ukyc_capability_token` for a UKYC session. Both secrets are sealed with\n * `wrapEncryptionKey` against the encryption schemas returned by\n * {@link KycService.createUkycSession}.\n *\n * @param params - The wrapped authorizations.\n * @returns The session status after the authorizations are applied.\n */\nexport type KycServiceSetAuthorizationsAction = {\n type: `KycService:setAuthorizations`;\n handler: KycService['setAuthorizations'];\n};\n\n/**\n * Creates (or refreshes) the SumSub verification journey for a UKYC session,\n * returning the applicant access token used to launch the SDK.\n *\n * @param sessionId - The UKYC session id from `createUkycSession`.\n * @returns The applicant access token and status.\n */\nexport type KycServiceCreateJourneyAction = {\n type: `KycService:createJourney`;\n handler: KycService['createJourney'];\n};\n\n/**\n * Fetches the current status of a UKYC session. Polled after the SumSub SDK\n * completes to determine the final verification decision.\n *\n * @param params - The parameters.\n * @param params.sessionId - The UKYC session id.\n * @returns The session status.\n */\nexport type KycServiceGetSessionStatusAction = {\n type: `KycService:getSessionStatus`;\n handler: KycService['getSessionStatus'];\n};\n\n/**\n * Union of all KycService action types.\n */\nexport type KycServiceMethodActions =\n | KycServiceGetGeoCountryAction\n | KycServiceFetchDisclaimersAction\n | KycServiceCreateSessionAction\n | KycServiceCheckKycRequiredAction\n | KycServiceCreateVendorCustomerAction\n | KycServiceSubmitVendorDisclaimersAction\n | KycServiceFetchSessionDisclaimersAction\n | KycServiceSubmitSessionDisclaimersAction\n | KycServiceFetchKycStatusAction\n | KycServiceFetchIdosEnclaveJwksAction\n | KycServiceFetchIdosRelayJwksAction\n | KycServiceCreateUkycSessionAction\n | KycServiceSetAuthorizationsAction\n | KycServiceCreateJourneyAction\n | KycServiceGetSessionStatusAction;\n"]}
|
package/dist/KycService.cjs
CHANGED
|
@@ -27,12 +27,11 @@ exports.serviceName = 'KycService';
|
|
|
27
27
|
// === MESSENGER ===
|
|
28
28
|
const MESSENGER_EXPOSED_METHODS = [
|
|
29
29
|
'getGeoCountry',
|
|
30
|
-
'
|
|
30
|
+
'fetchDisclaimers',
|
|
31
31
|
'createSession',
|
|
32
32
|
'checkKycRequired',
|
|
33
33
|
'createVendorCustomer',
|
|
34
34
|
'submitVendorDisclaimers',
|
|
35
|
-
'fetchDisclaimersCatalog',
|
|
36
35
|
'fetchSessionDisclaimers',
|
|
37
36
|
'submitSessionDisclaimers',
|
|
38
37
|
'fetchKycStatus',
|
|
@@ -129,15 +128,9 @@ const ConsentDocumentStruct = (0, superstruct_1.type)({
|
|
|
129
128
|
url: (0, superstruct_1.string)(),
|
|
130
129
|
consented: (0, superstruct_1.boolean)(),
|
|
131
130
|
});
|
|
132
|
-
const
|
|
131
|
+
const SessionDisclaimersResponseStruct = (0, superstruct_1.type)({
|
|
133
132
|
idOS: (0, superstruct_1.array)(ConsentDocumentStruct),
|
|
134
133
|
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
134
|
credentialReusabilityConsentGiven: (0, superstruct_1.boolean)(),
|
|
142
135
|
});
|
|
143
136
|
// === SERVICE DEFINITION ===
|
|
@@ -148,21 +141,13 @@ const SessionDisclaimersResponseStruct = (0, superstruct_1.type)({
|
|
|
148
141
|
* `fetch` when provided), and the auth bearer token and geolocation come from
|
|
149
142
|
* other controllers via the messenger.
|
|
150
143
|
*
|
|
151
|
-
* It extends {@link BaseDataService}, so
|
|
152
|
-
* `fetchQuery`:
|
|
153
|
-
* breaker) and
|
|
154
|
-
* `fetchDisclaimers`
|
|
155
|
-
*
|
|
144
|
+
* It extends {@link BaseDataService}, so every request is routed through
|
|
145
|
+
* `fetchQuery`: it is wrapped in the shared service policy (retries, circuit
|
|
146
|
+
* breaker) and its result is exposed via the service's `QueryClient`. Read-only
|
|
147
|
+
* endpoints (`fetchDisclaimers`, `fetchIdosEnclaveJwks`, `fetchIdosRelayJwks`) are cached
|
|
148
|
+
* with a `staleTime`; vendor-disclaimer, session-scoped disclaimer,
|
|
149
|
+
* session-creating, and status-polling endpoints opt out of caching
|
|
156
150
|
* (`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
151
|
*/
|
|
167
152
|
class KycService extends base_data_service_1.BaseDataService {
|
|
168
153
|
/**
|
|
@@ -247,11 +232,11 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
247
232
|
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
248
233
|
* @returns The disclaimers.
|
|
249
234
|
*/
|
|
250
|
-
async
|
|
235
|
+
async fetchDisclaimers({ vendor = 'moonpay', country, }) {
|
|
251
236
|
const url = new URL(`/vendors/${vendor}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
252
237
|
url.searchParams.set('country', country);
|
|
253
238
|
const data = await this.fetchQuery({
|
|
254
|
-
queryKey: [`${this.name}:
|
|
239
|
+
queryKey: [`${this.name}:fetchDisclaimers`, vendor, country],
|
|
255
240
|
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
|
|
256
241
|
staleTime: (0, utils_1.inMilliseconds)(5, utils_1.Duration.Minute),
|
|
257
242
|
});
|
|
@@ -265,9 +250,20 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
265
250
|
*/
|
|
266
251
|
async createSession(params) {
|
|
267
252
|
const url = new URL('/vendors/moonpay/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
268
|
-
const data = await
|
|
269
|
-
|
|
270
|
-
|
|
253
|
+
const data = await this.fetchQuery({
|
|
254
|
+
queryKey: [
|
|
255
|
+
`${this.name}:createSession`,
|
|
256
|
+
params.email,
|
|
257
|
+
params.termsAcceptedAt,
|
|
258
|
+
params.disclaimerIds,
|
|
259
|
+
],
|
|
260
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
261
|
+
method: 'POST',
|
|
262
|
+
body: JSON.stringify(params),
|
|
263
|
+
}),
|
|
264
|
+
// A session-creating mutation must never serve a stale/cached result.
|
|
265
|
+
staleTime: 0,
|
|
266
|
+
gcTime: 0,
|
|
271
267
|
});
|
|
272
268
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, CreateSessionResponseStruct, 'sessions');
|
|
273
269
|
}
|
|
@@ -298,9 +294,21 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
298
294
|
throw new Error('checkKycRequired: country is required for vendor "moonpay".');
|
|
299
295
|
}
|
|
300
296
|
}
|
|
301
|
-
const data = await
|
|
302
|
-
|
|
303
|
-
|
|
297
|
+
const data = await this.fetchQuery({
|
|
298
|
+
queryKey: [
|
|
299
|
+
`${this.name}:checkKycRequired`,
|
|
300
|
+
vendor,
|
|
301
|
+
params.accessToken ?? null,
|
|
302
|
+
params.country ?? null,
|
|
303
|
+
capabilities,
|
|
304
|
+
],
|
|
305
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
306
|
+
method: 'POST',
|
|
307
|
+
body: JSON.stringify(body),
|
|
308
|
+
}),
|
|
309
|
+
// The requirement can change server-side, so always re-check.
|
|
310
|
+
staleTime: 0,
|
|
311
|
+
gcTime: 0,
|
|
304
312
|
});
|
|
305
313
|
const { required } = __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, KycRequiredResponseStruct, 'kyc-required');
|
|
306
314
|
return { kycRequired: required };
|
|
@@ -318,9 +326,19 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
318
326
|
*/
|
|
319
327
|
async createVendorCustomer(params) {
|
|
320
328
|
const url = new URL(`/vendors/${params.vendor}/customers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
321
|
-
const data = await
|
|
322
|
-
|
|
323
|
-
|
|
329
|
+
const data = await this.fetchQuery({
|
|
330
|
+
queryKey: [
|
|
331
|
+
`${this.name}:createVendorCustomer`,
|
|
332
|
+
params.vendor,
|
|
333
|
+
params.email,
|
|
334
|
+
],
|
|
335
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
336
|
+
method: 'POST',
|
|
337
|
+
body: JSON.stringify({ email: params.email }),
|
|
338
|
+
}),
|
|
339
|
+
// Customer creation/resume must never serve a stale/cached result.
|
|
340
|
+
staleTime: 0,
|
|
341
|
+
gcTime: 0,
|
|
324
342
|
});
|
|
325
343
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, VendorCustomerResponseStruct, 'vendor customers');
|
|
326
344
|
}
|
|
@@ -338,52 +356,34 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
338
356
|
*/
|
|
339
357
|
async submitVendorDisclaimers(params) {
|
|
340
358
|
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
359
|
const data = await this.fetchQuery({
|
|
365
|
-
queryKey: [
|
|
366
|
-
|
|
360
|
+
queryKey: [
|
|
361
|
+
`${this.name}:submitVendorDisclaimers`,
|
|
362
|
+
params.vendor,
|
|
363
|
+
params.disclaimerIds,
|
|
364
|
+
],
|
|
365
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
366
|
+
method: 'POST',
|
|
367
|
+
body: JSON.stringify({ disclaimerIds: params.disclaimerIds }),
|
|
368
|
+
}),
|
|
367
369
|
staleTime: 0,
|
|
368
370
|
gcTime: 0,
|
|
369
371
|
});
|
|
370
|
-
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data,
|
|
372
|
+
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, VendorSigningsResponseStruct, 'vendor disclaimers');
|
|
371
373
|
}
|
|
372
374
|
/**
|
|
373
375
|
* Fetches the session-scoped idOS + KYC-provider disclaimer catalog
|
|
374
|
-
* (`GET /sessions/{sessionId}/disclaimers`)
|
|
375
|
-
*
|
|
376
|
-
* pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
|
|
377
|
-
* T&Cs continue to come from {@link fetchVendorDisclaimers}.
|
|
376
|
+
* (`GET /sessions/{sessionId}/disclaimers`). Requires an existing UKYC
|
|
377
|
+
* session; vendor T&Cs continue to come from {@link fetchDisclaimers}.
|
|
378
378
|
*
|
|
379
379
|
* @param params - The parameters.
|
|
380
380
|
* @param params.sessionId - The UKYC session id.
|
|
381
381
|
* @returns The catalog, including which documents are already consented.
|
|
382
382
|
*/
|
|
383
|
-
async fetchSessionDisclaimers(
|
|
384
|
-
const url = new URL(`/sessions/${encodeURIComponent(sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
383
|
+
async fetchSessionDisclaimers(params) {
|
|
384
|
+
const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
385
385
|
const data = await this.fetchQuery({
|
|
386
|
-
queryKey: [`${this.name}:fetchSessionDisclaimers`, sessionId],
|
|
386
|
+
queryKey: [`${this.name}:fetchSessionDisclaimers`, params.sessionId],
|
|
387
387
|
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
|
|
388
388
|
// Consent state can change after a POST, so always re-fetch.
|
|
389
389
|
staleTime: 0,
|
|
@@ -402,13 +402,24 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
402
402
|
*/
|
|
403
403
|
async submitSessionDisclaimers(params) {
|
|
404
404
|
const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
405
|
-
const data = await
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
405
|
+
const data = await this.fetchQuery({
|
|
406
|
+
queryKey: [
|
|
407
|
+
`${this.name}:submitSessionDisclaimers`,
|
|
408
|
+
params.sessionId,
|
|
409
|
+
params.idOS,
|
|
410
|
+
params.kycProvider,
|
|
411
|
+
params.credentialReusabilityConsentGiven,
|
|
412
|
+
],
|
|
413
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
414
|
+
method: 'POST',
|
|
415
|
+
body: JSON.stringify({
|
|
416
|
+
idOS: params.idOS,
|
|
417
|
+
kycProvider: params.kycProvider,
|
|
418
|
+
credentialReusabilityConsentGiven: params.credentialReusabilityConsentGiven,
|
|
419
|
+
}),
|
|
411
420
|
}),
|
|
421
|
+
staleTime: 0,
|
|
422
|
+
gcTime: 0,
|
|
412
423
|
});
|
|
413
424
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionDisclaimersResponseStruct, 'session disclaimers');
|
|
414
425
|
}
|
|
@@ -470,16 +481,22 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
470
481
|
*/
|
|
471
482
|
async createUkycSession(params) {
|
|
472
483
|
const url = new URL('/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
473
|
-
const data = await
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
484
|
+
const data = await this.fetchQuery({
|
|
485
|
+
queryKey: [`${this.name}:createUkycSession`, params.jwtToken],
|
|
486
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
487
|
+
method: 'POST',
|
|
488
|
+
body: JSON.stringify({
|
|
489
|
+
vendorId: params.vendor ?? 'moonpay',
|
|
490
|
+
vendorUserId: 'mockedId',
|
|
491
|
+
jwtToken: params.jwtToken,
|
|
492
|
+
sessionClientPublicKey: params.sessionClientPublicKey,
|
|
493
|
+
residenceCountry: params.residenceCountry,
|
|
494
|
+
vendorMetadata: params.vendorMetadata ?? {},
|
|
495
|
+
}),
|
|
482
496
|
}),
|
|
497
|
+
// A session-creating mutation must never serve a stale/cached result.
|
|
498
|
+
staleTime: 0,
|
|
499
|
+
gcTime: 0,
|
|
483
500
|
});
|
|
484
501
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, UkycSessionResponseStruct, 'UKYC sessions');
|
|
485
502
|
}
|
|
@@ -494,12 +511,17 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
494
511
|
*/
|
|
495
512
|
async setAuthorizations(params) {
|
|
496
513
|
const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/authorizations`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
497
|
-
const data = await
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
514
|
+
const data = await this.fetchQuery({
|
|
515
|
+
queryKey: [`${this.name}:setAuthorizations`, params.sessionId],
|
|
516
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
517
|
+
method: 'POST',
|
|
518
|
+
body: JSON.stringify({
|
|
519
|
+
wrappedEncryptionDataKey: params.wrappedEncryptionDataKey,
|
|
520
|
+
wrappedUkycCapabilityToken: params.wrappedUkycCapabilityToken,
|
|
521
|
+
}),
|
|
502
522
|
}),
|
|
523
|
+
staleTime: 0,
|
|
524
|
+
gcTime: 0,
|
|
503
525
|
});
|
|
504
526
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionStatusResponseStruct, 'authorizations');
|
|
505
527
|
}
|
|
@@ -512,7 +534,13 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
512
534
|
*/
|
|
513
535
|
async createJourney(sessionId) {
|
|
514
536
|
const url = new URL(`/sessions/${encodeURIComponent(sessionId)}/journey`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
515
|
-
const data = await
|
|
537
|
+
const data = await this.fetchQuery({
|
|
538
|
+
queryKey: [`${this.name}:createJourney`, sessionId],
|
|
539
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'POST' }),
|
|
540
|
+
// Journeys are (re)created on demand; do not reuse a cached token.
|
|
541
|
+
staleTime: 0,
|
|
542
|
+
gcTime: 0,
|
|
543
|
+
});
|
|
516
544
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, ApplicantAccessTokenResponseStruct, 'journey');
|
|
517
545
|
}
|
|
518
546
|
/**
|
|
@@ -575,9 +603,8 @@ async function _KycService_fetchWellKnownJwks(baseUrl, queryName, responseLabel,
|
|
|
575
603
|
/**
|
|
576
604
|
* Performs a single JSON request.
|
|
577
605
|
*
|
|
578
|
-
*
|
|
579
|
-
* wraps it in the shared service policy (retries, circuit breaker).
|
|
580
|
-
* endpoints call it directly, so they are executed exactly once. Requests
|
|
606
|
+
* This is meant to be used as the `queryFn` for {@link fetchQuery}, which
|
|
607
|
+
* wraps it in the shared service policy (retries, circuit breaker). Requests
|
|
581
608
|
* are authenticated with the wallet bearer token by default; pass
|
|
582
609
|
* `{ authenticated: false }` for calls to services that do not expect it
|
|
583
610
|
* (e.g. the idOS enclave or idOS relay JWKS endpoints).
|