@metamask-previews/kyc-controller 0.0.0-preview-b63fbdb38 → 0.0.0-preview-e12b5ece6
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 +12 -0
- package/dist/KycController-method-action-types.cjs.map +1 -1
- package/dist/KycController-method-action-types.d.cts +6 -4
- package/dist/KycController-method-action-types.d.cts.map +1 -1
- package/dist/KycController-method-action-types.d.mts +6 -4
- 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 +186 -150
- package/dist/KycController.cjs.map +1 -1
- package/dist/KycController.d.cts +43 -37
- package/dist/KycController.d.cts.map +1 -1
- package/dist/KycController.d.mts +43 -37
- package/dist/KycController.d.mts.map +1 -1
- package/dist/KycController.mjs +183 -149
- 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 +23 -6
- package/dist/KycService-method-action-types.d.cts.map +1 -1
- package/dist/KycService-method-action-types.d.mts +23 -6
- 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 +100 -119
- package/dist/KycService.cjs.map +1 -1
- package/dist/KycService.d.cts +38 -12
- package/dist/KycService.d.cts.map +1 -1
- package/dist/KycService.d.mts +38 -12
- package/dist/KycService.d.mts.map +1 -1
- package/dist/KycService.mjs +100 -119
- package/dist/KycService.mjs.map +1 -1
- package/dist/index.cjs +3 -1
- 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/logger.cjs +9 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +6 -0
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +6 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/logger.mjs +6 -0
- package/dist/logger.mjs.map +1 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +53 -5
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +53 -5
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.cjs +4 -9
- package/dist/ukyc/wrapEncryptionKey.cjs.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.cts +8 -10
- package/dist/ukyc/wrapEncryptionKey.d.cts.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.mts +8 -10
- package/dist/ukyc/wrapEncryptionKey.d.mts.map +1 -1
- package/dist/ukyc/wrapEncryptionKey.mjs +4 -9
- package/dist/ukyc/wrapEncryptionKey.mjs.map +1 -1
- package/dist/vendorDisclaimerAcceptance.cjs +74 -0
- package/dist/vendorDisclaimerAcceptance.cjs.map +1 -0
- package/dist/vendorDisclaimerAcceptance.d.cts +39 -0
- package/dist/vendorDisclaimerAcceptance.d.cts.map +1 -0
- package/dist/vendorDisclaimerAcceptance.d.mts +39 -0
- package/dist/vendorDisclaimerAcceptance.d.mts.map +1 -0
- package/dist/vendorDisclaimerAcceptance.mjs +67 -0
- package/dist/vendorDisclaimerAcceptance.mjs.map +1 -0
- package/package.json +2 -2
|
@@ -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 KycServiceFetchVendorDisclaimersAction = {\n type: `KycService:fetchVendorDisclaimers`;\n handler: KycService['fetchVendorDisclaimers'];\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 global idOS + KYC-provider disclaimer catalog\n * (`GET /disclaimers?country=`). Carries no consent state — per-document\n * `consented` flags and `credentialReusabilityConsentGiven` are\n * session-scoped via {@link fetchSessionDisclaimers}. Vendor T&Cs continue to\n * come from {@link fetchVendorDisclaimers}.\n *\n * @param params - The parameters.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The catalog documents.\n */\nexport type KycServiceFetchDisclaimersCatalogAction = {\n type: `KycService:fetchDisclaimersCatalog`;\n handler: KycService['fetchDisclaimersCatalog'];\n};\n\n/**\n * Fetches the session-scoped idOS + KYC-provider disclaimer catalog\n * (`GET /sessions/{sessionId}/disclaimers`), including per-session\n * `consented` flags and `credentialReusabilityConsentGiven`. For the\n * pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor\n * T&Cs continue to come from {@link fetchVendorDisclaimers}.\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 | KycServiceFetchVendorDisclaimersAction\n | KycServiceCreateSessionAction\n | KycServiceCheckKycRequiredAction\n | KycServiceCreateVendorCustomerAction\n | KycServiceSubmitVendorDisclaimersAction\n | KycServiceFetchDisclaimersCatalogAction\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 KycServiceFetchVendorDisclaimersAction = {
|
|
27
|
+
type: `KycService:fetchVendorDisclaimers`;
|
|
28
|
+
handler: KycService['fetchVendorDisclaimers'];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Creates a vendor session via the UKYC backend.
|
|
@@ -79,10 +79,27 @@ 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
|
+
};
|
|
82
97
|
/**
|
|
83
98
|
* Fetches the session-scoped idOS + KYC-provider disclaimer catalog
|
|
84
|
-
* (`GET /sessions/{sessionId}/disclaimers`)
|
|
85
|
-
*
|
|
99
|
+
* (`GET /sessions/{sessionId}/disclaimers`), including per-session
|
|
100
|
+
* `consented` flags and `credentialReusabilityConsentGiven`. For the
|
|
101
|
+
* pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
|
|
102
|
+
* T&Cs continue to come from {@link fetchVendorDisclaimers}.
|
|
86
103
|
*
|
|
87
104
|
* @param params - The parameters.
|
|
88
105
|
* @param params.sessionId - The UKYC session id.
|
|
@@ -199,5 +216,5 @@ export type KycServiceGetSessionStatusAction = {
|
|
|
199
216
|
/**
|
|
200
217
|
* Union of all KycService action types.
|
|
201
218
|
*/
|
|
202
|
-
export type KycServiceMethodActions = KycServiceGetGeoCountryAction |
|
|
219
|
+
export type KycServiceMethodActions = KycServiceGetGeoCountryAction | KycServiceFetchVendorDisclaimersAction | KycServiceCreateSessionAction | KycServiceCheckKycRequiredAction | KycServiceCreateVendorCustomerAction | KycServiceSubmitVendorDisclaimersAction | KycServiceFetchDisclaimersCatalogAction | KycServiceFetchSessionDisclaimersAction | KycServiceSubmitSessionDisclaimersAction | KycServiceFetchKycStatusAction | KycServiceFetchIdosEnclaveJwksAction | KycServiceFetchIdosRelayJwksAction | KycServiceCreateUkycSessionAction | KycServiceSetAuthorizationsAction | KycServiceCreateJourneyAction | KycServiceGetSessionStatusAction;
|
|
203
220
|
//# 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":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAwB;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC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BAA8B,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 KycServiceFetchVendorDisclaimersAction = {
|
|
27
|
+
type: `KycService:fetchVendorDisclaimers`;
|
|
28
|
+
handler: KycService['fetchVendorDisclaimers'];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Creates a vendor session via the UKYC backend.
|
|
@@ -79,10 +79,27 @@ 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
|
+
};
|
|
82
97
|
/**
|
|
83
98
|
* Fetches the session-scoped idOS + KYC-provider disclaimer catalog
|
|
84
|
-
* (`GET /sessions/{sessionId}/disclaimers`)
|
|
85
|
-
*
|
|
99
|
+
* (`GET /sessions/{sessionId}/disclaimers`), including per-session
|
|
100
|
+
* `consented` flags and `credentialReusabilityConsentGiven`. For the
|
|
101
|
+
* pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
|
|
102
|
+
* T&Cs continue to come from {@link fetchVendorDisclaimers}.
|
|
86
103
|
*
|
|
87
104
|
* @param params - The parameters.
|
|
88
105
|
* @param params.sessionId - The UKYC session id.
|
|
@@ -199,5 +216,5 @@ export type KycServiceGetSessionStatusAction = {
|
|
|
199
216
|
/**
|
|
200
217
|
* Union of all KycService action types.
|
|
201
218
|
*/
|
|
202
|
-
export type KycServiceMethodActions = KycServiceGetGeoCountryAction |
|
|
219
|
+
export type KycServiceMethodActions = KycServiceGetGeoCountryAction | KycServiceFetchVendorDisclaimersAction | KycServiceCreateSessionAction | KycServiceCheckKycRequiredAction | KycServiceCreateVendorCustomerAction | KycServiceSubmitVendorDisclaimersAction | KycServiceFetchDisclaimersCatalogAction | KycServiceFetchSessionDisclaimersAction | KycServiceSubmitSessionDisclaimersAction | KycServiceFetchKycStatusAction | KycServiceFetchIdosEnclaveJwksAction | KycServiceFetchIdosRelayJwksAction | KycServiceCreateUkycSessionAction | KycServiceSetAuthorizationsAction | KycServiceCreateJourneyAction | KycServiceGetSessionStatusAction;
|
|
203
220
|
//# 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":"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,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;CACzC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,UAAU,CAAC,sBAAsB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,I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U,CAAC,kBAAkB,CAAC,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,6BAA6B,GAC7B,sCAAsC,GACtC,6BAA6B,GAC7B,gCAAgC,GAChC,oCAAoC,GACpC,uCAAuC,GACvC,uCAAuC,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 KycServiceFetchVendorDisclaimersAction = {\n type: `KycService:fetchVendorDisclaimers`;\n handler: KycService['fetchVendorDisclaimers'];\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 global idOS + KYC-provider disclaimer catalog\n * (`GET /disclaimers?country=`). Carries no consent state — per-document\n * `consented` flags and `credentialReusabilityConsentGiven` are\n * session-scoped via {@link fetchSessionDisclaimers}. Vendor T&Cs continue to\n * come from {@link fetchVendorDisclaimers}.\n *\n * @param params - The parameters.\n * @param params.country - ISO 3166-1 alpha-3 country code.\n * @returns The catalog documents.\n */\nexport type KycServiceFetchDisclaimersCatalogAction = {\n type: `KycService:fetchDisclaimersCatalog`;\n handler: KycService['fetchDisclaimersCatalog'];\n};\n\n/**\n * Fetches the session-scoped idOS + KYC-provider disclaimer catalog\n * (`GET /sessions/{sessionId}/disclaimers`), including per-session\n * `consented` flags and `credentialReusabilityConsentGiven`. For the\n * pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor\n * T&Cs continue to come from {@link fetchVendorDisclaimers}.\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 | KycServiceFetchVendorDisclaimersAction\n | KycServiceCreateSessionAction\n | KycServiceCheckKycRequiredAction\n | KycServiceCreateVendorCustomerAction\n | KycServiceSubmitVendorDisclaimersAction\n | KycServiceFetchDisclaimersCatalogAction\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,11 +27,12 @@ exports.serviceName = 'KycService';
|
|
|
27
27
|
// === MESSENGER ===
|
|
28
28
|
const MESSENGER_EXPOSED_METHODS = [
|
|
29
29
|
'getGeoCountry',
|
|
30
|
-
'
|
|
30
|
+
'fetchVendorDisclaimers',
|
|
31
31
|
'createSession',
|
|
32
32
|
'checkKycRequired',
|
|
33
33
|
'createVendorCustomer',
|
|
34
34
|
'submitVendorDisclaimers',
|
|
35
|
+
'fetchDisclaimersCatalog',
|
|
35
36
|
'fetchSessionDisclaimers',
|
|
36
37
|
'submitSessionDisclaimers',
|
|
37
38
|
'fetchKycStatus',
|
|
@@ -121,13 +122,27 @@ const KycUserStatusResponseStruct = (0, superstruct_1.type)({
|
|
|
121
122
|
sumsubSessionId: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
122
123
|
errorCode: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
123
124
|
});
|
|
124
|
-
const
|
|
125
|
+
const CatalogDocumentFields = {
|
|
125
126
|
key: (0, superstruct_1.string)(),
|
|
126
127
|
version: (0, superstruct_1.string)(),
|
|
127
128
|
title: (0, superstruct_1.string)(),
|
|
128
129
|
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,
|
|
129
135
|
consented: (0, superstruct_1.boolean)(),
|
|
130
136
|
});
|
|
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`. */
|
|
131
146
|
const SessionDisclaimersResponseStruct = (0, superstruct_1.type)({
|
|
132
147
|
idOS: (0, superstruct_1.array)(ConsentDocumentStruct),
|
|
133
148
|
kycProvider: (0, superstruct_1.array)(ConsentDocumentStruct),
|
|
@@ -141,13 +156,21 @@ const SessionDisclaimersResponseStruct = (0, superstruct_1.type)({
|
|
|
141
156
|
* `fetch` when provided), and the auth bearer token and geolocation come from
|
|
142
157
|
* other controllers via the messenger.
|
|
143
158
|
*
|
|
144
|
-
* It extends {@link BaseDataService}, so
|
|
145
|
-
* `fetchQuery`:
|
|
146
|
-
* breaker) and
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* session-creating, and status-polling endpoints opt out of caching
|
|
159
|
+
* It extends {@link BaseDataService}, so read-only endpoints are routed through
|
|
160
|
+
* `fetchQuery`: they are wrapped in the shared service policy (retries, circuit
|
|
161
|
+
* breaker) and their results are exposed via the service's `QueryClient`.
|
|
162
|
+
* `fetchDisclaimers` and `fetchJwks` are cached with a `staleTime`;
|
|
163
|
+
* session-scoped disclaimer and status-polling reads opt out of caching
|
|
150
164
|
* (`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.
|
|
151
174
|
*/
|
|
152
175
|
class KycService extends base_data_service_1.BaseDataService {
|
|
153
176
|
/**
|
|
@@ -212,7 +235,7 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
212
235
|
// Guard nullish/empty geolocation with the documented domain error rather
|
|
213
236
|
// than letting `assert(location, string())` surface a superstruct
|
|
214
237
|
// assertion error (which would change how the failure reads in
|
|
215
|
-
// `
|
|
238
|
+
// `vendorError`).
|
|
216
239
|
const alpha2 = typeof location === 'string' ? location.split('-')[0].toUpperCase() : '';
|
|
217
240
|
if (!alpha2 || alpha2 === 'UNKNOWN') {
|
|
218
241
|
throw new Error(`Unable to determine country from geolocation (got "${String(location)}").`);
|
|
@@ -232,11 +255,11 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
232
255
|
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
233
256
|
* @returns The disclaimers.
|
|
234
257
|
*/
|
|
235
|
-
async
|
|
258
|
+
async fetchVendorDisclaimers({ vendor = 'moonpay', country, }) {
|
|
236
259
|
const url = new URL(`/vendors/${vendor}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
237
260
|
url.searchParams.set('country', country);
|
|
238
261
|
const data = await this.fetchQuery({
|
|
239
|
-
queryKey: [`${this.name}:
|
|
262
|
+
queryKey: [`${this.name}:fetchVendorDisclaimers`, vendor, country],
|
|
240
263
|
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
|
|
241
264
|
staleTime: (0, utils_1.inMilliseconds)(5, utils_1.Duration.Minute),
|
|
242
265
|
});
|
|
@@ -250,20 +273,9 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
250
273
|
*/
|
|
251
274
|
async createSession(params) {
|
|
252
275
|
const url = new URL('/vendors/moonpay/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
253
|
-
const data = await this.
|
|
254
|
-
|
|
255
|
-
|
|
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,
|
|
276
|
+
const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
277
|
+
method: 'POST',
|
|
278
|
+
body: JSON.stringify(params),
|
|
267
279
|
});
|
|
268
280
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, CreateSessionResponseStruct, 'sessions');
|
|
269
281
|
}
|
|
@@ -294,21 +306,9 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
294
306
|
throw new Error('checkKycRequired: country is required for vendor "moonpay".');
|
|
295
307
|
}
|
|
296
308
|
}
|
|
297
|
-
const data = await this.
|
|
298
|
-
|
|
299
|
-
|
|
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,
|
|
309
|
+
const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
310
|
+
method: 'POST',
|
|
311
|
+
body: JSON.stringify(body),
|
|
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,19 +326,9 @@ 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 this.
|
|
330
|
-
|
|
331
|
-
|
|
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,
|
|
329
|
+
const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
330
|
+
method: 'POST',
|
|
331
|
+
body: JSON.stringify({ email: params.email }),
|
|
342
332
|
});
|
|
343
333
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, VendorCustomerResponseStruct, 'vendor customers');
|
|
344
334
|
}
|
|
@@ -356,34 +346,52 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
356
346
|
*/
|
|
357
347
|
async submitVendorDisclaimers(params) {
|
|
358
348
|
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);
|
|
359
372
|
const data = await this.fetchQuery({
|
|
360
|
-
queryKey: [
|
|
361
|
-
|
|
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
|
-
}),
|
|
373
|
+
queryKey: [`${this.name}:fetchDisclaimersCatalog`, country],
|
|
374
|
+
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
|
|
369
375
|
staleTime: 0,
|
|
370
376
|
gcTime: 0,
|
|
371
377
|
});
|
|
372
|
-
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data,
|
|
378
|
+
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, GlobalDisclaimersResponseStruct, 'disclaimers');
|
|
373
379
|
}
|
|
374
380
|
/**
|
|
375
381
|
* Fetches the session-scoped idOS + KYC-provider disclaimer catalog
|
|
376
|
-
* (`GET /sessions/{sessionId}/disclaimers`)
|
|
377
|
-
*
|
|
382
|
+
* (`GET /sessions/{sessionId}/disclaimers`), including per-session
|
|
383
|
+
* `consented` flags and `credentialReusabilityConsentGiven`. For the
|
|
384
|
+
* pre-session global catalog use {@link fetchDisclaimersCatalog}. Vendor
|
|
385
|
+
* T&Cs continue to come from {@link fetchVendorDisclaimers}.
|
|
378
386
|
*
|
|
379
387
|
* @param params - The parameters.
|
|
380
388
|
* @param params.sessionId - The UKYC session id.
|
|
381
389
|
* @returns The catalog, including which documents are already consented.
|
|
382
390
|
*/
|
|
383
|
-
async fetchSessionDisclaimers(
|
|
384
|
-
const url = new URL(`/sessions/${encodeURIComponent(
|
|
391
|
+
async fetchSessionDisclaimers({ sessionId, }) {
|
|
392
|
+
const url = new URL(`/sessions/${encodeURIComponent(sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
385
393
|
const data = await this.fetchQuery({
|
|
386
|
-
queryKey: [`${this.name}:fetchSessionDisclaimers`,
|
|
394
|
+
queryKey: [`${this.name}:fetchSessionDisclaimers`, sessionId],
|
|
387
395
|
queryFn: async () => __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'GET' }),
|
|
388
396
|
// Consent state can change after a POST, so always re-fetch.
|
|
389
397
|
staleTime: 0,
|
|
@@ -402,24 +410,13 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
402
410
|
*/
|
|
403
411
|
async submitSessionDisclaimers(params) {
|
|
404
412
|
const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
405
|
-
const data = await this.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
params.
|
|
409
|
-
params.
|
|
410
|
-
params.
|
|
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
|
-
}),
|
|
413
|
+
const data = await __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,
|
|
420
419
|
}),
|
|
421
|
-
staleTime: 0,
|
|
422
|
-
gcTime: 0,
|
|
423
420
|
});
|
|
424
421
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionDisclaimersResponseStruct, 'session disclaimers');
|
|
425
422
|
}
|
|
@@ -481,22 +478,16 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
481
478
|
*/
|
|
482
479
|
async createUkycSession(params) {
|
|
483
480
|
const url = new URL('/sessions', __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
484
|
-
const data = await this.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
residenceCountry: params.residenceCountry,
|
|
494
|
-
vendorMetadata: params.vendorMetadata ?? {},
|
|
495
|
-
}),
|
|
481
|
+
const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
482
|
+
method: 'POST',
|
|
483
|
+
body: JSON.stringify({
|
|
484
|
+
vendorId: params.vendor ?? 'moonpay',
|
|
485
|
+
vendorUserId: 'mockedId',
|
|
486
|
+
jwtToken: params.jwtToken,
|
|
487
|
+
sessionClientPublicKey: params.sessionClientPublicKey,
|
|
488
|
+
residenceCountry: params.residenceCountry,
|
|
489
|
+
vendorMetadata: params.vendorMetadata ?? {},
|
|
496
490
|
}),
|
|
497
|
-
// A session-creating mutation must never serve a stale/cached result.
|
|
498
|
-
staleTime: 0,
|
|
499
|
-
gcTime: 0,
|
|
500
491
|
});
|
|
501
492
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, UkycSessionResponseStruct, 'UKYC sessions');
|
|
502
493
|
}
|
|
@@ -511,17 +502,12 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
511
502
|
*/
|
|
512
503
|
async setAuthorizations(params) {
|
|
513
504
|
const url = new URL(`/sessions/${encodeURIComponent(params.sessionId)}/authorizations`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
514
|
-
const data = await this.
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
wrappedEncryptionDataKey: params.wrappedEncryptionDataKey,
|
|
520
|
-
wrappedUkycCapabilityToken: params.wrappedUkycCapabilityToken,
|
|
521
|
-
}),
|
|
505
|
+
const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, {
|
|
506
|
+
method: 'POST',
|
|
507
|
+
body: JSON.stringify({
|
|
508
|
+
wrappedEncryptionDataKey: params.wrappedEncryptionDataKey,
|
|
509
|
+
wrappedUkycCapabilityToken: params.wrappedUkycCapabilityToken,
|
|
522
510
|
}),
|
|
523
|
-
staleTime: 0,
|
|
524
|
-
gcTime: 0,
|
|
525
511
|
});
|
|
526
512
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, SessionStatusResponseStruct, 'authorizations');
|
|
527
513
|
}
|
|
@@ -534,13 +520,7 @@ class KycService extends base_data_service_1.BaseDataService {
|
|
|
534
520
|
*/
|
|
535
521
|
async createJourney(sessionId) {
|
|
536
522
|
const url = new URL(`/sessions/${encodeURIComponent(sessionId)}/journey`, __classPrivateFieldGet(this, _KycService_baseUrl, "f"));
|
|
537
|
-
const data = await this.
|
|
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
|
-
});
|
|
523
|
+
const data = await __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_requestJson).call(this, url, { method: 'POST' });
|
|
544
524
|
return __classPrivateFieldGet(this, _KycService_instances, "m", _KycService_validateResponse).call(this, data, ApplicantAccessTokenResponseStruct, 'journey');
|
|
545
525
|
}
|
|
546
526
|
/**
|
|
@@ -603,8 +583,9 @@ async function _KycService_fetchWellKnownJwks(baseUrl, queryName, responseLabel,
|
|
|
603
583
|
/**
|
|
604
584
|
* Performs a single JSON request.
|
|
605
585
|
*
|
|
606
|
-
*
|
|
607
|
-
* wraps it in the shared service policy (retries, circuit breaker).
|
|
586
|
+
* Read endpoints pass this as the `queryFn` to {@link fetchQuery}, which
|
|
587
|
+
* wraps it in the shared service policy (retries, circuit breaker). Write
|
|
588
|
+
* endpoints call it directly, so they are executed exactly once. Requests
|
|
608
589
|
* are authenticated with the wallet bearer token by default; pass
|
|
609
590
|
* `{ authenticated: false }` for calls to services that do not expect it
|
|
610
591
|
* (e.g. the idOS enclave or idOS relay JWKS endpoints).
|