@metamask-previews/kyc-controller 0.0.0-preview-e12b5ece6 → 0.0.0-preview-e0510042f
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 -12
- package/dist/KycController-method-action-types.cjs.map +1 -1
- package/dist/KycController-method-action-types.d.cts +4 -6
- package/dist/KycController-method-action-types.d.cts.map +1 -1
- package/dist/KycController-method-action-types.d.mts +4 -6
- package/dist/KycController-method-action-types.d.mts.map +1 -1
- package/dist/KycController-method-action-types.mjs.map +1 -1
- package/dist/KycController.cjs +150 -186
- package/dist/KycController.cjs.map +1 -1
- package/dist/KycController.d.cts +37 -43
- package/dist/KycController.d.cts.map +1 -1
- package/dist/KycController.d.mts +37 -43
- package/dist/KycController.d.mts.map +1 -1
- package/dist/KycController.mjs +149 -183
- 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 +119 -100
- 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 +119 -100
- package/dist/KycService.mjs.map +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +5 -53
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +5 -53
- 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
- package/dist/vendorDisclaimerAcceptance.cjs +0 -74
- package/dist/vendorDisclaimerAcceptance.cjs.map +0 -1
- package/dist/vendorDisclaimerAcceptance.d.cts +0 -39
- package/dist/vendorDisclaimerAcceptance.d.cts.map +0 -1
- package/dist/vendorDisclaimerAcceptance.d.mts +0 -39
- package/dist/vendorDisclaimerAcceptance.d.mts.map +0 -1
- package/dist/vendorDisclaimerAcceptance.mjs +0 -67
- package/dist/vendorDisclaimerAcceptance.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=`). Carries no consent state — per-document
|
|
85
|
-
* `consented` flags and `credentialReusabilityConsentGiven` are
|
|
86
|
-
* session-scoped via {@link fetchSessionDisclaimers}. Vendor T&Cs continue to
|
|
87
|
-
* come from {@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.d.cts","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -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=`). Carries no consent state — per-document
|
|
85
|
-
* `consented` flags and `credentialReusabilityConsentGiven` are
|
|
86
|
-
* session-scoped via {@link fetchSessionDisclaimers}. Vendor T&Cs continue to
|
|
87
|
-
* come from {@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-method-action-types.d.mts","sourceRoot":"","sources":["../src/KycService-method-action-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -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',
|
|
@@ -122,27 +121,13 @@ const KycUserStatusResponseStruct = (0, superstruct_1.type)({
|
|
|
122
121
|
sumsubSessionId: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
123
122
|
errorCode: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
124
123
|
});
|
|
125
|
-
const
|
|
124
|
+
const ConsentDocumentStruct = (0, superstruct_1.type)({
|
|
126
125
|
key: (0, superstruct_1.string)(),
|
|
127
126
|
version: (0, superstruct_1.string)(),
|
|
128
127
|
title: (0, superstruct_1.string)(),
|
|
129
128
|
url: (0, superstruct_1.string)(),
|
|
130
|
-
};
|
|
131
|
-
const CatalogDocumentStruct = (0, superstruct_1.type)(CatalogDocumentFields);
|
|
132
|
-
// Session documents also report whether that version was already consented to.
|
|
133
|
-
const ConsentDocumentStruct = (0, superstruct_1.type)({
|
|
134
|
-
...CatalogDocumentFields,
|
|
135
129
|
consented: (0, superstruct_1.boolean)(),
|
|
136
130
|
});
|
|
137
|
-
/**
|
|
138
|
-
* Global catalog from `GET /disclaimers` (no per-document `consented` flag and
|
|
139
|
-
* no credential-reuse flag).
|
|
140
|
-
*/
|
|
141
|
-
const GlobalDisclaimersResponseStruct = (0, superstruct_1.type)({
|
|
142
|
-
idOS: (0, superstruct_1.array)(CatalogDocumentStruct),
|
|
143
|
-
kycProvider: (0, superstruct_1.array)(CatalogDocumentStruct),
|
|
144
|
-
});
|
|
145
|
-
/** Session catalog from `GET`/`POST /sessions/{id}/disclaimers`. */
|
|
146
131
|
const SessionDisclaimersResponseStruct = (0, superstruct_1.type)({
|
|
147
132
|
idOS: (0, superstruct_1.array)(ConsentDocumentStruct),
|
|
148
133
|
kycProvider: (0, superstruct_1.array)(ConsentDocumentStruct),
|
|
@@ -156,21 +141,13 @@ const SessionDisclaimersResponseStruct = (0, superstruct_1.type)({
|
|
|
156
141
|
* `fetch` when provided), and the auth bearer token and geolocation come from
|
|
157
142
|
* other controllers via the messenger.
|
|
158
143
|
*
|
|
159
|
-
* It extends {@link BaseDataService}, so
|
|
160
|
-
* `fetchQuery`:
|
|
161
|
-
* breaker) and
|
|
162
|
-
* `fetchDisclaimers`
|
|
163
|
-
*
|
|
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
|
|
164
150
|
* (`staleTime`/`gcTime` of `0`) so they never serve a stale result.
|
|
165
|
-
*
|
|
166
|
-
* Write endpoints (every `POST`) deliberately bypass `fetchQuery`. The query
|
|
167
|
-
* cache is built for idempotent reads: it deduplicates concurrent requests
|
|
168
|
-
* sharing a `queryKey`, retains responses for replay, and publishes them on the
|
|
169
|
-
* messenger via `cacheUpdated`. None of that is safe for calls that create
|
|
170
|
-
* sessions, customers, or consents — two overlapping `createVendorCustomer`
|
|
171
|
-
* calls would collapse into a single `POST`, and session tokens would be
|
|
172
|
-
* broadcast as cache payloads. Writes therefore call `#requestJson` directly,
|
|
173
|
-
* which also means they are not retried by the service policy.
|
|
174
151
|
*/
|
|
175
152
|
class KycService extends base_data_service_1.BaseDataService {
|
|
176
153
|
/**
|
|
@@ -235,7 +212,7 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
235
212
|
// Guard nullish/empty geolocation with the documented domain error rather
|
|
236
213
|
// than letting `assert(location, string())` surface a superstruct
|
|
237
214
|
// assertion error (which would change how the failure reads in
|
|
238
|
-
// `
|
|
215
|
+
// `disclaimersError`).
|
|
239
216
|
const alpha2 = typeof location === 'string' ? location.split('-')[0].toUpperCase() : '';
|
|
240
217
|
if (!alpha2 || alpha2 === 'UNKNOWN') {
|
|
241
218
|
throw new Error(`Unable to determine country from geolocation (got "${String(location)}").`);
|
|
@@ -255,11 +232,11 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
255
232
|
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
256
233
|
* @returns The disclaimers.
|
|
257
234
|
*/
|
|
258
|
-
async
|
|
235
|
+
async fetchDisclaimers({ vendor = 'moonpay', country, }) {
|
|
259
236
|
const url = new URL(`/vendors/${vendor}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
260
237
|
url.searchParams.set('country', country);
|
|
261
238
|
const data = await this.fetchQuery({
|
|
262
|
-
queryKey: [`${this.name}:
|
|
239
|
+
queryKey: [`${this.name}:fetchDisclaimers`, vendor, country],
|
|
263
240
|
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
|
|
264
241
|
staleTime: (0, utils_1.inMilliseconds)(5, utils_1.Duration.Minute),
|
|
265
242
|
});
|
|
@@ -273,9 +250,20 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
273
250
|
*/
|
|
274
251
|
async createSession(params) {
|
|
275
252
|
const url = new URL('/vendors/moonpay/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
276
|
-
const data = await
|
|
277
|
-
|
|
278
|
-
|
|
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,
|
|
279
267
|
});
|
|
280
268
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, CreateSessionResponseStruct, 'sessions');
|
|
281
269
|
}
|
|
@@ -306,9 +294,21 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
306
294
|
throw new Error('checkKycRequired: country is required for vendor "moonpay".');
|
|
307
295
|
}
|
|
308
296
|
}
|
|
309
|
-
const data = await
|
|
310
|
-
|
|
311
|
-
|
|
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,
|
|
312
312
|
});
|
|
313
313
|
const { required } = __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, KycRequiredResponseStruct, 'kyc-required');
|
|
314
314
|
return { kycRequired: required };
|
|
@@ -326,9 +326,19 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
326
326
|
*/
|
|
327
327
|
async createVendorCustomer(params) {
|
|
328
328
|
const url = new URL(`/vendors/${params.vendor}/customers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
329
|
-
const data = await
|
|
330
|
-
|
|
331
|
-
|
|
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,
|
|
332
342
|
});
|
|
333
343
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, VendorCustomerResponseStruct, 'vendor customers');
|
|
334
344
|
}
|
|
@@ -346,52 +356,34 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
346
356
|
*/
|
|
347
357
|
async submitVendorDisclaimers(params) {
|
|
348
358
|
const url = new URL(`/vendors/${encodeURIComponent(params.vendor)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
349
|
-
const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
350
|
-
method: 'POST',
|
|
351
|
-
body: JSON.stringify({ disclaimerIds: params.disclaimerIds }),
|
|
352
|
-
});
|
|
353
|
-
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, VendorSigningsResponseStruct, 'vendor disclaimers');
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Fetches the global idOS + KYC-provider disclaimer catalog
|
|
357
|
-
* (`GET /disclaimers?country=`). Carries no consent state — per-document
|
|
358
|
-
* `consented` flags and `credentialReusabilityConsentGiven` are
|
|
359
|
-
* session-scoped via {@link fetchSessionDisclaimers}. Vendor T&Cs continue to
|
|
360
|
-
* come from {@link fetchVendorDisclaimers}.
|
|
361
|
-
*
|
|
362
|
-
* @param params - The parameters.
|
|
363
|
-
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
364
|
-
* @returns The catalog documents.
|
|
365
|
-
*/
|
|
366
|
-
async fetchDisclaimersCatalog({ country, }) {
|
|
367
|
-
if (country.length !== 3) {
|
|
368
|
-
throw new Error(`KycService.fetchDisclaimersCatalog: country must be an ISO 3166-1 alpha-3 code (received "${country}").`);
|
|
369
|
-
}
|
|
370
|
-
const url = new URL('/disclaimers', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
371
|
-
url.searchParams.set('country', country);
|
|
372
359
|
const data = await this.fetchQuery({
|
|
373
|
-
queryKey: [
|
|
374
|
-
|
|
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
|
+
}),
|
|
375
369
|
staleTime: 0,
|
|
376
370
|
gcTime: 0,
|
|
377
371
|
});
|
|
378
|
-
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');
|
|
379
373
|
}
|
|
380
374
|
/**
|
|
381
375
|
* Fetches the session-scoped idOS + KYC-provider disclaimer catalog
|
|
382
|
-
* (`GET /sessions/{sessionId}/disclaimers`)
|
|
383
|
-
*
|
|
384
|
-
* pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
|
|
385
|
-
* 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}.
|
|
386
378
|
*
|
|
387
379
|
* @param params - The parameters.
|
|
388
380
|
* @param params.sessionId - The UKYC session id.
|
|
389
381
|
* @returns The catalog, including which documents are already consented.
|
|
390
382
|
*/
|
|
391
|
-
async fetchSessionDisclaimers(
|
|
392
|
-
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"));
|
|
393
385
|
const data = await this.fetchQuery({
|
|
394
|
-
queryKey: [`${this.name}:fetchSessionDisclaimers`, sessionId],
|
|
386
|
+
queryKey: [`${this.name}:fetchSessionDisclaimers`, params.sessionId],
|
|
395
387
|
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
|
|
396
388
|
// Consent state can change after a POST, so always re-fetch.
|
|
397
389
|
staleTime: 0,
|
|
@@ -410,13 +402,24 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
410
402
|
*/
|
|
411
403
|
async submitSessionDisclaimers(params) {
|
|
412
404
|
const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
413
|
-
const data = await
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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
|
+
}),
|
|
419
420
|
}),
|
|
421
|
+
staleTime: 0,
|
|
422
|
+
gcTime: 0,
|
|
420
423
|
});
|
|
421
424
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionDisclaimersResponseStruct, 'session disclaimers');
|
|
422
425
|
}
|
|
@@ -478,16 +481,22 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
478
481
|
*/
|
|
479
482
|
async createUkycSession(params) {
|
|
480
483
|
const url = new URL('/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
481
|
-
const data = await
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
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
|
+
}),
|
|
490
496
|
}),
|
|
497
|
+
// A session-creating mutation must never serve a stale/cached result.
|
|
498
|
+
staleTime: 0,
|
|
499
|
+
gcTime: 0,
|
|
491
500
|
});
|
|
492
501
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, UkycSessionResponseStruct, 'UKYC sessions');
|
|
493
502
|
}
|
|
@@ -502,12 +511,17 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
502
511
|
*/
|
|
503
512
|
async setAuthorizations(params) {
|
|
504
513
|
const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/authorizations`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
505
|
-
const data = await
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
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
|
+
}),
|
|
510
522
|
}),
|
|
523
|
+
staleTime: 0,
|
|
524
|
+
gcTime: 0,
|
|
511
525
|
});
|
|
512
526
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionStatusResponseStruct, 'authorizations');
|
|
513
527
|
}
|
|
@@ -520,7 +534,13 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
520
534
|
*/
|
|
521
535
|
async createJourney(sessionId) {
|
|
522
536
|
const url = new URL(`/sessions/${encodeURIComponent(sessionId)}/journey`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
523
|
-
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
|
+
});
|
|
524
544
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, ApplicantAccessTokenResponseStruct, 'journey');
|
|
525
545
|
}
|
|
526
546
|
/**
|
|
@@ -583,9 +603,8 @@ async function _KycService_fetchWellKnownJwks(baseUrl, queryName, responseLabel,
|
|
|
583
603
|
/**
|
|
584
604
|
* Performs a single JSON request.
|
|
585
605
|
*
|
|
586
|
-
*
|
|
587
|
-
* wraps it in the shared service policy (retries, circuit breaker).
|
|
588
|
-
* 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
|
|
589
608
|
* are authenticated with the wallet bearer token by default; pass
|
|
590
609
|
* `{ authenticated: false }` for calls to services that do not expect it
|
|
591
610
|
* (e.g. the idOS enclave or idOS relay JWKS endpoints).
|