@metamask-previews/kyc-controller 0.0.0-preview-4f4c98e → 0.0.0-preview-eb263b0ee
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/dist/KycController-method-action-types.cjs +7 -0
- package/dist/KycController-method-action-types.cjs.map +1 -0
- package/dist/{KycController-method-action-types.d.ts → KycController-method-action-types.d.cts} +2 -2
- package/dist/KycController-method-action-types.d.cts.map +1 -0
- package/dist/KycController-method-action-types.d.mts +237 -0
- package/dist/KycController-method-action-types.d.mts.map +1 -0
- package/dist/{KycController-method-action-types.js → KycController-method-action-types.mjs} +1 -1
- package/dist/KycController-method-action-types.mjs.map +1 -0
- package/dist/KycController.cjs +1843 -0
- package/dist/KycController.cjs.map +1 -0
- package/dist/{KycController.d.ts → KycController.d.cts} +9 -9
- package/dist/KycController.d.cts.map +1 -0
- package/dist/KycController.d.mts +393 -0
- package/dist/KycController.d.mts.map +1 -0
- package/dist/{KycController.js → KycController.mjs} +10 -10
- package/dist/KycController.mjs.map +1 -0
- package/dist/KycService-method-action-types.cjs +7 -0
- package/dist/KycService-method-action-types.cjs.map +1 -0
- package/dist/{KycService-method-action-types.d.ts → KycService-method-action-types.d.cts} +2 -2
- package/dist/KycService-method-action-types.d.cts.map +1 -0
- package/dist/KycService-method-action-types.d.mts +186 -0
- package/dist/KycService-method-action-types.d.mts.map +1 -0
- package/dist/{KycService-method-action-types.js → KycService-method-action-types.mjs} +1 -1
- package/dist/KycService-method-action-types.mjs.map +1 -0
- package/dist/KycService.cjs +628 -0
- package/dist/KycService.cjs.map +1 -0
- package/dist/{KycService.d.ts → KycService.d.cts} +12 -12
- package/dist/KycService.d.cts.map +1 -0
- package/dist/KycService.d.mts +494 -0
- package/dist/KycService.d.mts.map +1 -0
- package/dist/{KycService.js → KycService.mjs} +7 -7
- package/dist/{KycService.js.map → KycService.mjs.map} +1 -1
- package/dist/countryCodes.cjs +274 -0
- package/dist/countryCodes.cjs.map +1 -0
- package/dist/{countryCodes.d.ts → countryCodes.d.cts} +1 -1
- package/dist/countryCodes.d.cts.map +1 -0
- package/dist/countryCodes.d.mts +18 -0
- package/dist/countryCodes.d.mts.map +1 -0
- package/dist/{countryCodes.js → countryCodes.mjs} +1 -1
- package/dist/countryCodes.mjs.map +1 -0
- package/dist/crypto.cjs +154 -0
- package/dist/crypto.cjs.map +1 -0
- package/dist/{crypto.d.ts → crypto.d.cts} +1 -1
- package/dist/crypto.d.cts.map +1 -0
- package/dist/crypto.d.mts +84 -0
- package/dist/crypto.d.mts.map +1 -0
- package/dist/{crypto.js → crypto.mjs} +7 -7
- package/dist/crypto.mjs.map +1 -0
- package/dist/encoding.cjs +40 -0
- package/dist/encoding.cjs.map +1 -0
- package/dist/{encoding.d.ts → encoding.d.cts} +1 -1
- package/dist/encoding.d.cts.map +1 -0
- package/dist/encoding.d.mts +24 -0
- package/dist/encoding.d.mts.map +1 -0
- package/dist/{encoding.js → encoding.mjs} +2 -2
- package/dist/encoding.mjs.map +1 -0
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +19 -19
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -0
- package/dist/selectors.cjs +30 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/{selectors.d.ts → selectors.d.cts} +4 -4
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +24 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/{selectors.js → selectors.mjs} +2 -2
- package/dist/selectors.mjs.map +1 -0
- package/dist/types.cjs +10 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +1 -1
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +208 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/{types.js → types.mjs} +1 -1
- package/dist/types.mjs.map +1 -0
- package/dist/ukyc/constants.cjs +75 -0
- package/dist/ukyc/constants.cjs.map +1 -0
- package/dist/ukyc/{constants.d.ts → constants.d.cts} +9 -9
- package/dist/ukyc/constants.d.cts.map +1 -0
- package/dist/ukyc/constants.d.mts +69 -0
- package/dist/ukyc/constants.d.mts.map +1 -0
- package/dist/ukyc/{constants.js → constants.mjs} +1 -1
- package/dist/ukyc/constants.mjs.map +1 -0
- package/dist/ukyc/deriveClientMaterial.cjs +65 -0
- package/dist/ukyc/deriveClientMaterial.cjs.map +1 -0
- package/dist/ukyc/{deriveClientMaterial.d.ts → deriveClientMaterial.d.cts} +1 -1
- package/dist/ukyc/deriveClientMaterial.d.cts.map +1 -0
- package/dist/ukyc/deriveClientMaterial.d.mts +54 -0
- package/dist/ukyc/deriveClientMaterial.d.mts.map +1 -0
- package/dist/ukyc/{deriveClientMaterial.js → deriveClientMaterial.mjs} +7 -7
- package/dist/ukyc/deriveClientMaterial.mjs.map +1 -0
- package/dist/ukyc/jwtChain.cjs +54 -0
- package/dist/ukyc/jwtChain.cjs.map +1 -0
- package/dist/ukyc/{jwtChain.d.ts → jwtChain.d.cts} +1 -1
- package/dist/ukyc/jwtChain.d.cts.map +1 -0
- package/dist/ukyc/jwtChain.d.mts +40 -0
- package/dist/ukyc/jwtChain.d.mts.map +1 -0
- package/dist/ukyc/{jwtChain.js → jwtChain.mjs} +4 -4
- package/dist/ukyc/jwtChain.mjs.map +1 -0
- package/dist/ukyc/localUserSecret.cjs +98 -0
- package/dist/ukyc/localUserSecret.cjs.map +1 -0
- package/dist/ukyc/{localUserSecret.d.ts → localUserSecret.d.cts} +1 -1
- package/dist/ukyc/localUserSecret.d.cts.map +1 -0
- package/dist/ukyc/localUserSecret.d.mts +65 -0
- package/dist/ukyc/localUserSecret.d.mts.map +1 -0
- package/dist/ukyc/{localUserSecret.js → localUserSecret.mjs} +4 -4
- package/dist/ukyc/localUserSecret.mjs.map +1 -0
- package/dist/ukyc/storageAccessToken.cjs +139 -0
- package/dist/ukyc/storageAccessToken.cjs.map +1 -0
- package/dist/ukyc/{storageAccessToken.d.ts → storageAccessToken.d.cts} +2 -2
- package/dist/ukyc/storageAccessToken.d.cts.map +1 -0
- package/dist/ukyc/storageAccessToken.d.mts +99 -0
- package/dist/ukyc/storageAccessToken.d.mts.map +1 -0
- package/dist/ukyc/{storageAccessToken.js → storageAccessToken.mjs} +5 -5
- package/dist/ukyc/storageAccessToken.mjs.map +1 -0
- package/dist/ukyc/testToken.cjs +61 -0
- package/dist/ukyc/testToken.cjs.map +1 -0
- package/dist/ukyc/{testToken.d.ts → testToken.d.cts} +2 -2
- package/dist/ukyc/testToken.d.cts.map +1 -0
- package/dist/ukyc/testToken.d.mts +50 -0
- package/dist/ukyc/testToken.d.mts.map +1 -0
- package/dist/ukyc/{testToken.js → testToken.mjs} +5 -5
- package/dist/ukyc/testToken.mjs.map +1 -0
- package/dist/ukyc/wrapEncryptionKey.cjs +37 -0
- package/dist/ukyc/wrapEncryptionKey.cjs.map +1 -0
- package/dist/ukyc/{wrapEncryptionKey.d.ts → wrapEncryptionKey.d.cts} +1 -1
- package/dist/ukyc/wrapEncryptionKey.d.cts.map +1 -0
- package/dist/ukyc/wrapEncryptionKey.d.mts +41 -0
- package/dist/ukyc/wrapEncryptionKey.d.mts.map +1 -0
- package/dist/ukyc/{wrapEncryptionKey.js → wrapEncryptionKey.mjs} +4 -3
- package/dist/ukyc/wrapEncryptionKey.mjs.map +1 -0
- package/dist/ukyc/wrapUserKey.cjs +80 -0
- package/dist/ukyc/wrapUserKey.cjs.map +1 -0
- package/dist/ukyc/{wrapUserKey.d.ts → wrapUserKey.d.cts} +1 -1
- package/dist/ukyc/wrapUserKey.d.cts.map +1 -0
- package/dist/ukyc/wrapUserKey.d.mts +26 -0
- package/dist/ukyc/wrapUserKey.d.mts.map +1 -0
- package/dist/ukyc/{wrapUserKey.js → wrapUserKey.mjs} +8 -8
- package/dist/ukyc/wrapUserKey.mjs.map +1 -0
- package/dist/ukyc/wrappedRelayPayload.cjs +32 -0
- package/dist/ukyc/wrappedRelayPayload.cjs.map +1 -0
- package/dist/ukyc/{wrappedRelayPayload.d.ts → wrappedRelayPayload.d.cts} +3 -3
- package/dist/ukyc/wrappedRelayPayload.d.cts.map +1 -0
- package/dist/ukyc/wrappedRelayPayload.d.mts +35 -0
- package/dist/ukyc/wrappedRelayPayload.d.mts.map +1 -0
- package/dist/ukyc/{wrappedRelayPayload.js → wrappedRelayPayload.mjs} +2 -2
- package/dist/ukyc/wrappedRelayPayload.mjs.map +1 -0
- package/package.json +17 -13
- package/dist/KycController-method-action-types.d.ts.map +0 -1
- package/dist/KycController-method-action-types.js.map +0 -1
- package/dist/KycController.d.ts.map +0 -1
- package/dist/KycController.js.map +0 -1
- package/dist/KycService-method-action-types.d.ts.map +0 -1
- package/dist/KycService-method-action-types.js.map +0 -1
- package/dist/KycService.d.ts.map +0 -1
- package/dist/countryCodes.d.ts.map +0 -1
- package/dist/countryCodes.js.map +0 -1
- package/dist/crypto.d.ts.map +0 -1
- package/dist/crypto.js.map +0 -1
- package/dist/encoding.d.ts.map +0 -1
- package/dist/encoding.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/selectors.d.ts.map +0 -1
- package/dist/selectors.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ukyc/constants.d.ts.map +0 -1
- package/dist/ukyc/constants.js.map +0 -1
- package/dist/ukyc/deriveClientMaterial.d.ts.map +0 -1
- package/dist/ukyc/deriveClientMaterial.js.map +0 -1
- package/dist/ukyc/jwtChain.d.ts.map +0 -1
- package/dist/ukyc/jwtChain.js.map +0 -1
- package/dist/ukyc/localUserSecret.d.ts.map +0 -1
- package/dist/ukyc/localUserSecret.js.map +0 -1
- package/dist/ukyc/storageAccessToken.d.ts.map +0 -1
- package/dist/ukyc/storageAccessToken.js.map +0 -1
- package/dist/ukyc/testToken.d.ts.map +0 -1
- package/dist/ukyc/testToken.js.map +0 -1
- package/dist/ukyc/wrapEncryptionKey.d.ts.map +0 -1
- package/dist/ukyc/wrapEncryptionKey.js.map +0 -1
- package/dist/ukyc/wrapUserKey.d.ts.map +0 -1
- package/dist/ukyc/wrapUserKey.js.map +0 -1
- package/dist/ukyc/wrappedRelayPayload.d.ts.map +0 -1
- package/dist/ukyc/wrappedRelayPayload.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KycService.d.mts","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oCAAoC;AAC9D,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,oCAAoC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC;AAE7E,OAAO,KAAK,EAAE,yCAAyC,EAAE,yCAAyC;AAClG,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EAAE,4CAA4C,EAAE,+CAA+C;AAC3G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B;AAa3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,6BAA6B;AAG9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,6CAA4C;AACnF,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EACjB,oBAAmB;AAKpB;;GAEG;AACH,eAAO,MAAM,WAAW,eAAe,CAAC;AAqBxC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAC3C,kCAAkC,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,uBAAuB,GACvB,iCAAiC,CAAC;AAEtC;;GAEG;AACH,KAAK,cAAc,GACf,4CAA4C,GAC5C,yCAAyC,CAAC;AAE9C;;G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AAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;IAoDpC;;;;;;;;;;OAUG;IACG,oBAAoB,CACxB,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,sBAAsB,CAAC;IAwBlC;;;;;;;;;;;OAWG;IACG,uBAAuB,CAC3B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IA0B9B;;;;;;;;OAQG;IACG,uBAAuB,CAC3B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,qBAAqB,CAAC;IAmBjC;;;;;;;;OAQG;IACG,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,qBAAqB,CAAC;IAiCjC;;;;;OAKG;IACG,cAAc,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAgBtD;;;;;;;;OAQG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAgBxC;;;;;;;;;;OAUG;IACG,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAyB/B;;;;;;;;OAQG;IACG,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IAyB5B;;;;;;OAMG;IACG,aAAa,CACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,4BAA4B,CAAC;IAmBxC;;;;;;;OAOG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;CAqI7B"}
|
|
@@ -10,12 +10,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _KycService_instances, _KycService_fetch, _KycService_baseUrl, _KycService_fractalEncryptionBaseUrl, _KycService_validateResponse, _KycService_requestJson;
|
|
13
|
-
import { BaseDataService } from
|
|
14
|
-
import { HttpError } from
|
|
15
|
-
import { array, assert, boolean, enums, optional, string, StructError, type
|
|
16
|
-
import { Duration, inMilliseconds } from
|
|
17
|
-
import { alpha2ToAlpha3 } from
|
|
18
|
-
import { UKYC_JWKS_PATH } from
|
|
13
|
+
import { BaseDataService } from "@metamask/base-data-service";
|
|
14
|
+
import { HttpError } from "@metamask/controller-utils";
|
|
15
|
+
import { array, assert, boolean, enums, optional, string, StructError, type } from "@metamask/superstruct";
|
|
16
|
+
import { Duration, inMilliseconds } from "@metamask/utils";
|
|
17
|
+
import { alpha2ToAlpha3 } from "./countryCodes.mjs";
|
|
18
|
+
import { UKYC_JWKS_PATH } from "./ukyc/constants.mjs";
|
|
19
19
|
// === GENERAL ===
|
|
20
20
|
/**
|
|
21
21
|
* The name of the {@link KycService}, used to namespace the service's actions.
|
|
@@ -621,4 +621,4 @@ async function _KycService_requestJson(url, init, options = {}) {
|
|
|
621
621
|
}
|
|
622
622
|
return (await response.json());
|
|
623
623
|
};
|
|
624
|
-
//# sourceMappingURL=KycService.
|
|
624
|
+
//# sourceMappingURL=KycService.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService.js","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAO9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAKvD,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,WAAW,EACX,IAAI,GACL,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAWnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,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ACd,CAAC;IAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAS,CAAC;AACzC,CAAC","sourcesContent":["import { BaseDataService } from '@metamask/base-data-service';\nimport type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport type { CreateServicePolicyOptions } from '@metamask/controller-utils';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { GeolocationControllerGetGeolocationAction } from '@metamask/geolocation-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n array,\n assert,\n boolean,\n enums,\n optional,\n string,\n StructError,\n type,\n} from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { Duration, inMilliseconds } from '@metamask/utils';\nimport type { QueryClientConfig } from '@tanstack/query-core';\n\nimport { alpha2ToAlpha3 } from './countryCodes.js';\nimport type { KycServiceMethodActions } from './KycService-method-action-types.js';\nimport type {\n KycConsentRecord,\n KycDisclaimer,\n KycSessionDisclaimers,\n KycSessionStatus,\n KycUserStatusResponse,\n KycVendor,\n KycVendorSigning,\n} from './types.js';\nimport { UKYC_JWKS_PATH } from './ukyc/constants.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link KycService}, used to namespace the service's actions.\n */\nexport const serviceName = 'KycService';\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getGeoCountry',\n 'fetchDisclaimers',\n 'createSession',\n 'checkKycRequired',\n 'createVendorCustomer',\n 'submitVendorDisclaimers',\n 'fetchSessionDisclaimers',\n 'submitSessionDisclaimers',\n 'fetchKycStatus',\n 'fetchJwks',\n 'createUkycSession',\n 'setAuthorizations',\n 'createJourney',\n 'getSessionStatus',\n] as const;\n\n/**\n * Invalidates cached queries serviced by {@link KycService}.\n */\nexport type KycServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link KycService} exposes to other consumers.\n */\nexport type KycServiceActions =\n | KycServiceMethodActions\n | KycServiceInvalidateQueriesAction;\n\n/**\n * Actions from other messengers that {@link KycService} calls.\n */\ntype AllowedActions =\n | AuthenticationControllerGetBearerTokenAction\n | GeolocationControllerGetGeolocationAction;\n\n/**\n * Published when {@link KycService}'s cache is updated.\n */\nexport type KycServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a single key within {@link KycService}'s cache is updated.\n */\nexport type KycServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link KycService} exposes to other consumers.\n */\nexport type KycServiceEvents =\n | KycServiceCacheUpdatedEvent\n | KycServiceGranularCacheUpdatedEvent;\n\n/**\n * Events from other messengers that {@link KycService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger restricted to actions and events accessed by\n * {@link KycService}.\n */\nexport type KycServiceMessenger = Messenger<\n typeof serviceName,\n KycServiceActions | AllowedActions,\n KycServiceEvents | AllowedEvents\n>;\n\n/**\n * Options for constructing a {@link KycService}.\n */\nexport type KycServiceOptions = {\n messenger: KycServiceMessenger;\n /**\n * A function used to make HTTP requests. Defaults to the runtime's native\n * `fetch`, so consumers do not need to inject one on platforms where `fetch`\n * is available globally (browser, React Native, Node 18+).\n */\n fetch?: typeof fetch;\n /**\n * Mandatory value that sets the base url to KYC api\n */\n baseUrl: string;\n /**\n * Base URL of the Fractal encryption service, from which the JWKS used to\n * verify encryption-schema `jwtChain`s is fetched.\n */\n fractalEncryptionBaseUrl?: string;\n /**\n * Shared configuration applied to all queries exposed by the service (e.g. a\n * default `staleTime`/`gcTime`). Each data service gets its own\n * `QueryClient`.\n */\n queryClientConfig?: QueryClientConfig;\n policyOptions?: CreateServicePolicyOptions;\n};\n\n// === API RESPONSE SCHEMAS ===\n\nconst DisclaimerStruct = type({\n id: string(),\n display_name: string(),\n url: string(),\n});\nconst DisclaimersResponseStruct = array(DisclaimerStruct);\n\nconst VendorSigningStruct = type({\n id: string(),\n customer_id: string(),\n content_id: optional(string()),\n});\nconst VendorSigningsResponseStruct = array(VendorSigningStruct);\n\nconst CreateSessionResponseStruct = type({ sessionToken: string() });\n\n// The live KYC API returns the flag under `required`; the service normalizes\n// this to `kycRequired` for consumers (see `checkKycRequired`).\nconst KycRequiredResponseStruct = type({ required: boolean() });\n\n// The session server's public key, in JWK-like form, returned inside an\n// encryption schema from `POST /sessions`. `x` is the base64url public key\n// used to wrap a secret for that schema.\nconst ServerPublicKeyStruct = type({\n kty: string(),\n crv: string(),\n x: string(),\n kid: optional(string()),\n alg: optional(string()),\n use: optional(string()),\n});\n\nconst EncryptionSchemaStruct = type({\n serverPublicKey: ServerPublicKeyStruct,\n jwtChain: string(),\n});\nexport type EncryptionSchema = Infer<typeof EncryptionSchemaStruct>;\n\n// A single Ed25519 (OKP) JWK. `type` (not `object`) keeps optional/extra JWK\n// fields (`use`, `alg`) from failing validation.\nconst JwkStruct = type({\n kty: string(),\n crv: string(),\n x: string(),\n kid: string(),\n});\nconst JwksResponseStruct = type({ keys: array(JwkStruct) });\nexport type JwksResponse = Infer<typeof JwksResponseStruct>;\n\nconst UkycSessionResponseStruct = type({\n sessionId: string(),\n // Per-secret wrapping material so the client can seal the\n // `data_encryption_key` and the `ukyc_capability_token` independently.\n encryptionDataKey: EncryptionSchemaStruct,\n ukycCapabilityToken: EncryptionSchemaStruct,\n});\nexport type UkycSessionResponse = Infer<typeof UkycSessionResponseStruct>;\n\nconst ApplicantAccessTokenResponseStruct = type({\n status: string(),\n applicantAccessToken: string(),\n});\nexport type ApplicantAccessTokenResponse = Infer<\n typeof ApplicantAccessTokenResponseStruct\n>;\n\nconst SessionStatusResponseStruct = type({\n finalStatus: string(),\n statusMessage: optional(string()),\n externalUserId: string(),\n kycStatus: string(),\n vendor: string(),\n vendorStatus: string(),\n});\n\n// Vendor customer subset — `type` (not `object`) keeps extra vendor fields from\n// failing validation while still requiring the fields the controller needs.\nconst VendorCustomerResponseStruct = type({\n id: string(),\n email: string(),\n status: string(),\n});\nexport type VendorCustomerResponse = Infer<typeof VendorCustomerResponseStruct>;\n\nconst KYC_USER_STATUSES = [\n 'not-started',\n 'pending',\n 'need-more-information',\n 'terminal-failure',\n 'completed',\n] as const;\n\nconst KycUserStatusResponseStruct = type({\n status: enums([...KYC_USER_STATUSES]),\n sumsubSessionId: optional(string()),\n errorCode: optional(string()),\n});\n\nconst ConsentDocumentStruct = type({\n key: string(),\n version: string(),\n title: string(),\n url: string(),\n consented: boolean(),\n});\n\nconst SessionDisclaimersResponseStruct = type({\n idOS: array(ConsentDocumentStruct),\n kycProvider: array(ConsentDocumentStruct),\n credentialReusabilityConsentGiven: boolean(),\n});\n\n// === PARAM TYPES ===\n\nexport type CreateSessionParams = {\n email: string;\n termsAcceptedAt: string;\n disclaimerIds: string[];\n};\n\nexport type CheckKycRequiredParams = {\n /**\n * Identity vendor to check. Defaults to `moonpay` for the existing\n * Check/Auth path.\n */\n vendor?: KycVendor;\n /**\n * MoonPay access token. Required when `vendor` is `moonpay` (or omitted).\n */\n accessToken?: string;\n /**\n * ISO 3166-1 alpha-3 country code. Required when `vendor` is `moonpay`.\n */\n country?: string;\n capabilities?: { product: string }[];\n};\n\nexport type CreateVendorCustomerParams = {\n vendor: KycVendor;\n email: string;\n};\n\nexport type SubmitVendorDisclaimersParams = {\n /** Identity vendor whose T&Cs were accepted (currently `iron`). */\n vendor: KycVendor;\n /** Disclaimer ids from {@link KycService.fetchDisclaimers}. */\n disclaimerIds: string[];\n};\n\nexport type FetchSessionDisclaimersParams = {\n /** UKYC session id from {@link KycService.createUkycSession}. */\n sessionId: string;\n};\n\nexport type SubmitSessionDisclaimersParams = {\n /** UKYC session id from {@link KycService.createUkycSession}. */\n sessionId: string;\n /** Consents to the idOS legal documents (`key`/`version` from the catalog). */\n idOS: KycConsentRecord[];\n /**\n * Consents to the KYC provider (SumSub) legal documents (`key`/`version`\n * from the catalog).\n */\n kycProvider: KycConsentRecord[];\n /** Consent to reuse the user's existing idOS credentials. */\n credentialReusabilityConsentGiven: boolean;\n};\n\nexport type CreateUkycSessionParams = {\n jwtToken: string;\n /**\n * Identity vendor for the UKYC session. Defaults to `moonpay` for the\n * existing Check/Auth flow. Pass a non-MoonPay vendor (e.g. `iron`) for\n * the consents path (no MoonPay metadata required).\n */\n vendor?: KycVendor;\n /**\n * Vendor-specific metadata. Required for MoonPay (`moonPayAccessToken` /\n * `moonPayUserId`); optional / omitted for other vendors.\n */\n vendorMetadata?: Record<string, unknown>;\n};\n\n/**\n * Encrypted capability authorization payload (base64url nonce + ciphertext)\n * accepted by `POST /sessions/:sessionId/authorizations`. Produced by\n * `wrapEncryptionKey` for both the `data_encryption_key` and the\n * `ukyc_capability_token`.\n */\nexport type CapabilityAuthorization = {\n nonce: string;\n data: string;\n};\n\nexport type SetAuthorizationsParams = {\n sessionId: string;\n wrappedEncryptionDataKey: CapabilityAuthorization;\n wrappedUkycCapabilityToken: CapabilityAuthorization;\n};\n\nexport type GetSessionStatusParams = {\n sessionId: string;\n};\n\n// === SERVICE DEFINITION ===\n\n/**\n * `KycService` communicates with the Universal KYC (UKYC) backend to drive the\n * identity + document-verification flow. It is stateless and platform-agnostic:\n * HTTP is performed through the runtime's native `fetch` (or an injected\n * `fetch` when provided), and the auth bearer token and geolocation come from\n * other controllers via the messenger.\n *\n * It extends {@link BaseDataService}, so every request is routed through\n * `fetchQuery`: it is wrapped in the shared service policy (retries, circuit\n * breaker) and its result is exposed via the service's `QueryClient`. Read-only\n * endpoints (`fetchDisclaimers`, `fetchJwks`) are cached with a `staleTime`;\n * vendor-disclaimer, session-scoped disclaimer, session-creating, and\n * status-polling endpoints opt out of caching (`staleTime`/`gcTime` of `0`)\n * so they never serve a stale result.\n */\nexport class KycService extends BaseDataService<\n typeof serviceName,\n KycServiceMessenger\n> {\n readonly #fetch: typeof fetch;\n\n readonly #baseUrl: string;\n\n readonly #fractalEncryptionBaseUrl: string;\n\n /**\n * Constructs a new KycService.\n *\n * @param options - The constructor options.\n * @param options.messenger - The messenger suited for this service.\n * @param options.fetch - A function used to make HTTP requests. Defaults to\n * the runtime's native `fetch`.\n * @param options.baseUrl - Base URL of the KYC API\n * @param options.fractalEncryptionBaseUrl - Base URL of the Fractal\n * encryption service, from which the JWKS used to verify encryption-schema\n * `jwtChain`s is fetched.\n * @param options.queryClientConfig - Shared configuration for all queries\n * exposed by the service.\n * @param options.policyOptions - Options for the request service policy.\n */\n constructor({\n messenger,\n fetch: fetchFunction,\n baseUrl,\n fractalEncryptionBaseUrl,\n queryClientConfig = {},\n policyOptions = {},\n }: KycServiceOptions) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions,\n });\n // Fall back to the runtime's native `fetch`, bound to `globalThis` so it\n // can be invoked as a method of this instance without an illegal-invocation\n // error on platforms that check the receiver.\n if (fetchFunction) {\n this.#fetch = fetchFunction;\n } else if (typeof globalThis.fetch === 'function') {\n this.#fetch = globalThis.fetch.bind(globalThis);\n } else {\n throw new Error(\n 'KycService: fetch is not available globally and was not provided in options. Please inject a fetch implementation.',\n );\n }\n if (!baseUrl) {\n throw new Error('KycService: baseUrl is required');\n }\n this.#baseUrl = baseUrl;\n this.#fractalEncryptionBaseUrl = fractalEncryptionBaseUrl ?? '';\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\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 */\n async getGeoCountry(): Promise<string> {\n const location = await this.messenger.call(\n 'GeolocationController:getGeolocation',\n );\n // Guard nullish/empty geolocation with the documented domain error rather\n // than letting `assert(location, string())` surface a superstruct\n // assertion error (which would change how the failure reads in\n // `disclaimersError`).\n const alpha2 =\n typeof location === 'string' ? location.split('-')[0].toUpperCase() : '';\n if (!alpha2 || alpha2 === 'UNKNOWN') {\n throw new Error(\n `Unable to determine country from geolocation (got \"${String(\n location,\n )}\").`,\n );\n }\n const alpha3 = alpha2ToAlpha3(alpha2);\n if (!alpha3) {\n throw new Error(\n `Unable to map country code \"${alpha2}\" to an ISO 3166-1 alpha-3 code.`,\n );\n }\n return alpha3;\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 */\n async fetchDisclaimers({\n vendor = 'moonpay',\n country,\n }: {\n vendor?: KycVendor;\n country: string;\n }): Promise<KycDisclaimer[]> {\n const url = new URL(`/vendors/${vendor}/disclaimers`, this.#baseUrl);\n url.searchParams.set('country', country);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchDisclaimers`, vendor, country],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n staleTime: inMilliseconds(5, Duration.Minute),\n });\n return this.#validateResponse(\n data,\n DisclaimersResponseStruct,\n 'disclaimers',\n ) as KycDisclaimer[];\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 */\n async createSession(\n params: CreateSessionParams,\n ): Promise<Infer<typeof CreateSessionResponseStruct>> {\n const url = new URL('/vendors/moonpay/sessions', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:createSession`,\n params.email,\n params.termsAcceptedAt,\n params.disclaimerIds,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify(params),\n }),\n // A session-creating mutation must never serve a stale/cached result.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n CreateSessionResponseStruct,\n 'sessions',\n );\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 */\n async checkKycRequired(\n params: CheckKycRequiredParams,\n ): Promise<{ kycRequired: boolean }> {\n const vendor = params.vendor ?? 'moonpay';\n const url = new URL(`/vendors/${vendor}/kyc-required`, this.#baseUrl);\n const capabilities = params.capabilities ?? [{ product: 'ramps' }];\n const body =\n vendor === 'moonpay'\n ? {\n accessToken: params.accessToken,\n country: params.country,\n capabilities,\n }\n : {};\n\n // MoonPay requires accessToken and country; validate before making the request.\n if (vendor === 'moonpay') {\n if (!params.accessToken) {\n throw new Error(\n 'checkKycRequired: accessToken is required for vendor \"moonpay\".',\n );\n }\n if (!params.country) {\n throw new Error(\n 'checkKycRequired: country is required for vendor \"moonpay\".',\n );\n }\n }\n\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:checkKycRequired`,\n vendor,\n params.accessToken ?? null,\n params.country ?? null,\n capabilities,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify(body),\n }),\n // The requirement can change server-side, so always re-check.\n staleTime: 0,\n gcTime: 0,\n });\n const { required } = this.#validateResponse(\n data,\n KycRequiredResponseStruct,\n 'kyc-required',\n );\n return { kycRequired: required };\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 */\n async createVendorCustomer(\n params: CreateVendorCustomerParams,\n ): Promise<VendorCustomerResponse> {\n const url = new URL(`/vendors/${params.vendor}/customers`, this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:createVendorCustomer`,\n params.vendor,\n params.email,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({ email: params.email }),\n }),\n // Customer creation/resume must never serve a stale/cached result.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n VendorCustomerResponseStruct,\n 'vendor customers',\n );\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 */\n async submitVendorDisclaimers(\n params: SubmitVendorDisclaimersParams,\n ): Promise<KycVendorSigning[]> {\n const url = new URL(\n `/vendors/${encodeURIComponent(params.vendor)}/disclaimers`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:submitVendorDisclaimers`,\n params.vendor,\n params.disclaimerIds,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({ disclaimerIds: params.disclaimerIds }),\n }),\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n VendorSigningsResponseStruct,\n 'vendor disclaimers',\n );\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 */\n async fetchSessionDisclaimers(\n params: FetchSessionDisclaimersParams,\n ): Promise<KycSessionDisclaimers> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchSessionDisclaimers`, params.sessionId],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n // Consent state can change after a POST, so always re-fetch.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionDisclaimersResponseStruct,\n 'session disclaimers',\n );\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 */\n async submitSessionDisclaimers(\n params: SubmitSessionDisclaimersParams,\n ): Promise<KycSessionDisclaimers> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:submitSessionDisclaimers`,\n params.sessionId,\n params.idOS,\n params.kycProvider,\n params.credentialReusabilityConsentGiven,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n idOS: params.idOS,\n kycProvider: params.kycProvider,\n credentialReusabilityConsentGiven:\n params.credentialReusabilityConsentGiven,\n }),\n }),\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionDisclaimersResponseStruct,\n 'session disclaimers',\n );\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 */\n async fetchKycStatus(): Promise<KycUserStatusResponse> {\n const url = new URL('/kyc/status', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchKycStatus`],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n // Status is polled for toast flips, so it must always be fresh.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n KycUserStatusResponseStruct,\n 'kyc status',\n );\n }\n\n /**\n * Fetches the Fractal encryption service JWKS used to verify the `jwtChain`s\n * returned inside encryption schemas from {@link KycService.createUkycSession}.\n *\n * This is an unauthenticated request to a well-known path on the Fractal\n * host, distinct from the UKYC base URL.\n *\n * @returns The JWKS keys.\n */\n async fetchJwks(): Promise<JwksResponse> {\n if (!this.#fractalEncryptionBaseUrl) {\n throw new Error(\n 'KycService: fractalEncryptionBaseUrl is not configured; cannot fetch JWKS to verify encryption schemas.',\n );\n }\n const url = new URL(UKYC_JWKS_PATH, this.#fractalEncryptionBaseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchJwks`, this.#fractalEncryptionBaseUrl],\n queryFn: async () =>\n this.#requestJson(url, { method: 'GET' }, { authenticated: false }),\n staleTime: inMilliseconds(1, Duration.Hour),\n });\n return this.#validateResponse(data, JwksResponseStruct, 'JWKS');\n }\n\n /**\n * Creates a UKYC session for the SumSub document-verification sub-flow.\n *\n * The response 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 */\n async createUkycSession(\n params: CreateUkycSessionParams,\n ): Promise<UkycSessionResponse> {\n const url = new URL('/sessions', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:createUkycSession`, params.jwtToken],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n vendorId: params.vendor ?? 'moonpay',\n vendorUserId: 'mockedId',\n jwtToken: params.jwtToken,\n vendorMetadata: params.vendorMetadata ?? {},\n }),\n }),\n // A session-creating mutation must never serve a stale/cached result.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n UkycSessionResponseStruct,\n 'UKYC sessions',\n );\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 */\n async setAuthorizations(\n params: SetAuthorizationsParams,\n ): Promise<KycSessionStatus> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/authorizations`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:setAuthorizations`, params.sessionId],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n wrappedEncryptionDataKey: params.wrappedEncryptionDataKey,\n wrappedUkycCapabilityToken: params.wrappedUkycCapabilityToken,\n }),\n }),\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionStatusResponseStruct,\n 'authorizations',\n );\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 */\n async createJourney(\n sessionId: string,\n ): Promise<ApplicantAccessTokenResponse> {\n const url = new URL(\n `/sessions/${encodeURIComponent(sessionId)}/journey`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:createJourney`, sessionId],\n queryFn: async () => this.#requestJson(url, { method: 'POST' }),\n // Journeys are (re)created on demand; do not reuse a cached token.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n ApplicantAccessTokenResponseStruct,\n 'journey',\n );\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 */\n async getSessionStatus(\n params: GetSessionStatusParams,\n ): Promise<KycSessionStatus> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/status`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:getSessionStatus`, params.sessionId],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n // Status is polled for a terminal decision, so it must always be fresh.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionStatusResponseStruct,\n 'session status',\n );\n }\n\n /**\n * Validates a parsed API response against a superstruct schema, throwing a\n * descriptive error when the response does not match.\n *\n * Unlike a bare `Struct.is` check, this surfaces exactly which field was\n * missing or had the wrong type, which is essential for diagnosing shape\n * mismatches between the client and the live API.\n *\n * @param data - The parsed response body.\n * @param struct - The superstruct schema the body is expected to satisfy.\n * @param apiName - A human-readable name of the API, used in the error message.\n * @returns The validated, typed response.\n * @throws If `data` does not match `struct`.\n */\n #validateResponse<Type, Schema>(\n data: unknown,\n struct: Struct<Type, Schema>,\n apiName: string,\n ): Type {\n try {\n assert(data, struct);\n return data;\n } catch (error) {\n const detail =\n error instanceof StructError\n ? `${error.message} (received: ${JSON.stringify(data)})`\n : // `assert` only ever throws `StructError` for the plain structs used\n // here, so this is a defensive fallback that is not exercised.\n /* istanbul ignore next */\n String(error);\n throw new Error(\n `Malformed response received from ${apiName} API: ${detail}`,\n );\n }\n }\n\n /**\n * Performs a single JSON request.\n *\n * This is meant to be used as the `queryFn` for {@link fetchQuery}, which\n * wraps it in the shared service policy (retries, circuit breaker). Requests\n * are authenticated with the wallet bearer token by default; pass\n * `{ authenticated: false }` for calls to services that do not expect it\n * (e.g. the Fractal JWKS endpoint).\n *\n * @param url - The request URL.\n * @param init - The request init (method, body).\n * @param options - Request options.\n * @param options.authenticated - Whether to attach the bearer token. Defaults\n * to `true`.\n * @returns The parsed JSON response.\n */\n async #requestJson(\n url: URL,\n init: RequestInit,\n options: { authenticated?: boolean } = {},\n ): Promise<Json> {\n const { authenticated = true } = options;\n\n const headers: Record<string, string> = {};\n\n // Only advertise a JSON body when one is actually sent; bodyless requests\n // (e.g. `createJourney`) must not carry a `Content-Type`.\n if (init.body !== undefined && init.body !== null) {\n headers['Content-Type'] = 'application/json';\n }\n\n if (authenticated) {\n const bearerToken = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n if (!bearerToken) {\n throw new Error(\n 'Unable to obtain an authentication bearer token — is the wallet signed in?',\n );\n }\n assert(bearerToken, string());\n headers.Authorization = `Bearer ${bearerToken}`;\n }\n\n const response = await this.#fetch(url.toString(), {\n ...init,\n headers,\n });\n if (!response.ok) {\n let detail = '';\n try {\n const errorBody: unknown = await response.json();\n if (errorBody && typeof errorBody === 'object') {\n const record = errorBody as Record<string, unknown>;\n if (typeof record.message === 'string') {\n detail = record.message;\n } else if (typeof record.error === 'string') {\n detail = record.error;\n }\n }\n } catch {\n // Ignore body parse failures; status alone is still useful.\n }\n throw new HttpError(\n response.status,\n `Fetching '${url.toString()}' failed with status '${response.status}'${\n detail ? `: ${detail}` : ''\n }`,\n );\n }\n\n // DELETE (and similar) endpoints return 204 No Content.\n if (response.status === 204) {\n return null;\n }\n\n return (await response.json()) as Json;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KycService.mjs","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,oCAAoC;AAO9D,OAAO,EAAE,SAAS,EAAE,mCAAmC;AAKvD,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,WAAW,EACX,IAAI,EACL,8BAA8B;AAE/B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,wBAAwB;AAG3D,OAAO,EAAE,cAAc,EAAE,2BAA0B;AAWnD,OAAO,EAAE,cAAc,EAAE,6BAA4B;AAErD,kBAAkB;AAElB;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAExC,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG;IAChC,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,sBAAsB;IACtB,yBAAyB;IACzB,yBAAyB;IACzB,0BAA0B;IAC1B,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,mBAAmB;IACnB,eAAe;IACf,kBAAkB;CACV,CAAC;AAsFX,+BAA+B;AAE/B,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC5B,EAAE,EAAE,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AE,CAAC;QACjB,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,MAAM,SAAS,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACjD,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAC/C,MAAM,MAAM,GAAG,SAAoC,CAAC;gBACpD,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;oBACvC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;gBAC1B,CAAC;qBAAM,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;oBAC5C,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,4DAA4D;QAC9D,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,QAAQ,CAAC,MAAM,EACf,aAAa,GAAG,CAAC,QAAQ,EAAE,yBAAyB,QAAQ,CAAC,MAAM,IACjE,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAC3B,EAAE,CACH,CAAC;IACJ,CAAC;IAED,wDAAwD;IACxD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAS,CAAC;AACzC,CAAC","sourcesContent":["import { BaseDataService } from '@metamask/base-data-service';\nimport type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport type { CreateServicePolicyOptions } from '@metamask/controller-utils';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { GeolocationControllerGetGeolocationAction } from '@metamask/geolocation-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport {\n array,\n assert,\n boolean,\n enums,\n optional,\n string,\n StructError,\n type,\n} from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { Duration, inMilliseconds } from '@metamask/utils';\nimport type { QueryClientConfig } from '@tanstack/query-core';\n\nimport { alpha2ToAlpha3 } from './countryCodes.js';\nimport type { KycServiceMethodActions } from './KycService-method-action-types.js';\nimport type {\n KycConsentRecord,\n KycDisclaimer,\n KycSessionDisclaimers,\n KycSessionStatus,\n KycUserStatusResponse,\n KycVendor,\n KycVendorSigning,\n} from './types.js';\nimport { UKYC_JWKS_PATH } from './ukyc/constants.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link KycService}, used to namespace the service's actions.\n */\nexport const serviceName = 'KycService';\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getGeoCountry',\n 'fetchDisclaimers',\n 'createSession',\n 'checkKycRequired',\n 'createVendorCustomer',\n 'submitVendorDisclaimers',\n 'fetchSessionDisclaimers',\n 'submitSessionDisclaimers',\n 'fetchKycStatus',\n 'fetchJwks',\n 'createUkycSession',\n 'setAuthorizations',\n 'createJourney',\n 'getSessionStatus',\n] as const;\n\n/**\n * Invalidates cached queries serviced by {@link KycService}.\n */\nexport type KycServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link KycService} exposes to other consumers.\n */\nexport type KycServiceActions =\n | KycServiceMethodActions\n | KycServiceInvalidateQueriesAction;\n\n/**\n * Actions from other messengers that {@link KycService} calls.\n */\ntype AllowedActions =\n | AuthenticationControllerGetBearerTokenAction\n | GeolocationControllerGetGeolocationAction;\n\n/**\n * Published when {@link KycService}'s cache is updated.\n */\nexport type KycServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a single key within {@link KycService}'s cache is updated.\n */\nexport type KycServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link KycService} exposes to other consumers.\n */\nexport type KycServiceEvents =\n | KycServiceCacheUpdatedEvent\n | KycServiceGranularCacheUpdatedEvent;\n\n/**\n * Events from other messengers that {@link KycService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger restricted to actions and events accessed by\n * {@link KycService}.\n */\nexport type KycServiceMessenger = Messenger<\n typeof serviceName,\n KycServiceActions | AllowedActions,\n KycServiceEvents | AllowedEvents\n>;\n\n/**\n * Options for constructing a {@link KycService}.\n */\nexport type KycServiceOptions = {\n messenger: KycServiceMessenger;\n /**\n * A function used to make HTTP requests. Defaults to the runtime's native\n * `fetch`, so consumers do not need to inject one on platforms where `fetch`\n * is available globally (browser, React Native, Node 18+).\n */\n fetch?: typeof fetch;\n /**\n * Mandatory value that sets the base url to KYC api\n */\n baseUrl: string;\n /**\n * Base URL of the Fractal encryption service, from which the JWKS used to\n * verify encryption-schema `jwtChain`s is fetched.\n */\n fractalEncryptionBaseUrl?: string;\n /**\n * Shared configuration applied to all queries exposed by the service (e.g. a\n * default `staleTime`/`gcTime`). Each data service gets its own\n * `QueryClient`.\n */\n queryClientConfig?: QueryClientConfig;\n policyOptions?: CreateServicePolicyOptions;\n};\n\n// === API RESPONSE SCHEMAS ===\n\nconst DisclaimerStruct = type({\n id: string(),\n display_name: string(),\n url: string(),\n});\nconst DisclaimersResponseStruct = array(DisclaimerStruct);\n\nconst VendorSigningStruct = type({\n id: string(),\n customer_id: string(),\n content_id: optional(string()),\n});\nconst VendorSigningsResponseStruct = array(VendorSigningStruct);\n\nconst CreateSessionResponseStruct = type({ sessionToken: string() });\n\n// The live KYC API returns the flag under `required`; the service normalizes\n// this to `kycRequired` for consumers (see `checkKycRequired`).\nconst KycRequiredResponseStruct = type({ required: boolean() });\n\n// The session server's public key, in JWK-like form, returned inside an\n// encryption schema from `POST /sessions`. `x` is the base64url public key\n// used to wrap a secret for that schema.\nconst ServerPublicKeyStruct = type({\n kty: string(),\n crv: string(),\n x: string(),\n kid: optional(string()),\n alg: optional(string()),\n use: optional(string()),\n});\n\nconst EncryptionSchemaStruct = type({\n serverPublicKey: ServerPublicKeyStruct,\n jwtChain: string(),\n});\nexport type EncryptionSchema = Infer<typeof EncryptionSchemaStruct>;\n\n// A single Ed25519 (OKP) JWK. `type` (not `object`) keeps optional/extra JWK\n// fields (`use`, `alg`) from failing validation.\nconst JwkStruct = type({\n kty: string(),\n crv: string(),\n x: string(),\n kid: string(),\n});\nconst JwksResponseStruct = type({ keys: array(JwkStruct) });\nexport type JwksResponse = Infer<typeof JwksResponseStruct>;\n\nconst UkycSessionResponseStruct = type({\n sessionId: string(),\n // Per-secret wrapping material so the client can seal the\n // `data_encryption_key` and the `ukyc_capability_token` independently.\n encryptionDataKey: EncryptionSchemaStruct,\n ukycCapabilityToken: EncryptionSchemaStruct,\n});\nexport type UkycSessionResponse = Infer<typeof UkycSessionResponseStruct>;\n\nconst ApplicantAccessTokenResponseStruct = type({\n status: string(),\n applicantAccessToken: string(),\n});\nexport type ApplicantAccessTokenResponse = Infer<\n typeof ApplicantAccessTokenResponseStruct\n>;\n\nconst SessionStatusResponseStruct = type({\n finalStatus: string(),\n statusMessage: optional(string()),\n externalUserId: string(),\n kycStatus: string(),\n vendor: string(),\n vendorStatus: string(),\n});\n\n// Vendor customer subset — `type` (not `object`) keeps extra vendor fields from\n// failing validation while still requiring the fields the controller needs.\nconst VendorCustomerResponseStruct = type({\n id: string(),\n email: string(),\n status: string(),\n});\nexport type VendorCustomerResponse = Infer<typeof VendorCustomerResponseStruct>;\n\nconst KYC_USER_STATUSES = [\n 'not-started',\n 'pending',\n 'need-more-information',\n 'terminal-failure',\n 'completed',\n] as const;\n\nconst KycUserStatusResponseStruct = type({\n status: enums([...KYC_USER_STATUSES]),\n sumsubSessionId: optional(string()),\n errorCode: optional(string()),\n});\n\nconst ConsentDocumentStruct = type({\n key: string(),\n version: string(),\n title: string(),\n url: string(),\n consented: boolean(),\n});\n\nconst SessionDisclaimersResponseStruct = type({\n idOS: array(ConsentDocumentStruct),\n kycProvider: array(ConsentDocumentStruct),\n credentialReusabilityConsentGiven: boolean(),\n});\n\n// === PARAM TYPES ===\n\nexport type CreateSessionParams = {\n email: string;\n termsAcceptedAt: string;\n disclaimerIds: string[];\n};\n\nexport type CheckKycRequiredParams = {\n /**\n * Identity vendor to check. Defaults to `moonpay` for the existing\n * Check/Auth path.\n */\n vendor?: KycVendor;\n /**\n * MoonPay access token. Required when `vendor` is `moonpay` (or omitted).\n */\n accessToken?: string;\n /**\n * ISO 3166-1 alpha-3 country code. Required when `vendor` is `moonpay`.\n */\n country?: string;\n capabilities?: { product: string }[];\n};\n\nexport type CreateVendorCustomerParams = {\n vendor: KycVendor;\n email: string;\n};\n\nexport type SubmitVendorDisclaimersParams = {\n /** Identity vendor whose T&Cs were accepted (currently `iron`). */\n vendor: KycVendor;\n /** Disclaimer ids from {@link KycService.fetchDisclaimers}. */\n disclaimerIds: string[];\n};\n\nexport type FetchSessionDisclaimersParams = {\n /** UKYC session id from {@link KycService.createUkycSession}. */\n sessionId: string;\n};\n\nexport type SubmitSessionDisclaimersParams = {\n /** UKYC session id from {@link KycService.createUkycSession}. */\n sessionId: string;\n /** Consents to the idOS legal documents (`key`/`version` from the catalog). */\n idOS: KycConsentRecord[];\n /**\n * Consents to the KYC provider (SumSub) legal documents (`key`/`version`\n * from the catalog).\n */\n kycProvider: KycConsentRecord[];\n /** Consent to reuse the user's existing idOS credentials. */\n credentialReusabilityConsentGiven: boolean;\n};\n\nexport type CreateUkycSessionParams = {\n jwtToken: string;\n /**\n * Identity vendor for the UKYC session. Defaults to `moonpay` for the\n * existing Check/Auth flow. Pass a non-MoonPay vendor (e.g. `iron`) for\n * the consents path (no MoonPay metadata required).\n */\n vendor?: KycVendor;\n /**\n * Vendor-specific metadata. Required for MoonPay (`moonPayAccessToken` /\n * `moonPayUserId`); optional / omitted for other vendors.\n */\n vendorMetadata?: Record<string, unknown>;\n};\n\n/**\n * Encrypted capability authorization payload (base64url nonce + ciphertext)\n * accepted by `POST /sessions/:sessionId/authorizations`. Produced by\n * `wrapEncryptionKey` for both the `data_encryption_key` and the\n * `ukyc_capability_token`.\n */\nexport type CapabilityAuthorization = {\n nonce: string;\n data: string;\n};\n\nexport type SetAuthorizationsParams = {\n sessionId: string;\n wrappedEncryptionDataKey: CapabilityAuthorization;\n wrappedUkycCapabilityToken: CapabilityAuthorization;\n};\n\nexport type GetSessionStatusParams = {\n sessionId: string;\n};\n\n// === SERVICE DEFINITION ===\n\n/**\n * `KycService` communicates with the Universal KYC (UKYC) backend to drive the\n * identity + document-verification flow. It is stateless and platform-agnostic:\n * HTTP is performed through the runtime's native `fetch` (or an injected\n * `fetch` when provided), and the auth bearer token and geolocation come from\n * other controllers via the messenger.\n *\n * It extends {@link BaseDataService}, so every request is routed through\n * `fetchQuery`: it is wrapped in the shared service policy (retries, circuit\n * breaker) and its result is exposed via the service's `QueryClient`. Read-only\n * endpoints (`fetchDisclaimers`, `fetchJwks`) are cached with a `staleTime`;\n * vendor-disclaimer, session-scoped disclaimer, session-creating, and\n * status-polling endpoints opt out of caching (`staleTime`/`gcTime` of `0`)\n * so they never serve a stale result.\n */\nexport class KycService extends BaseDataService<\n typeof serviceName,\n KycServiceMessenger\n> {\n readonly #fetch: typeof fetch;\n\n readonly #baseUrl: string;\n\n readonly #fractalEncryptionBaseUrl: string;\n\n /**\n * Constructs a new KycService.\n *\n * @param options - The constructor options.\n * @param options.messenger - The messenger suited for this service.\n * @param options.fetch - A function used to make HTTP requests. Defaults to\n * the runtime's native `fetch`.\n * @param options.baseUrl - Base URL of the KYC API\n * @param options.fractalEncryptionBaseUrl - Base URL of the Fractal\n * encryption service, from which the JWKS used to verify encryption-schema\n * `jwtChain`s is fetched.\n * @param options.queryClientConfig - Shared configuration for all queries\n * exposed by the service.\n * @param options.policyOptions - Options for the request service policy.\n */\n constructor({\n messenger,\n fetch: fetchFunction,\n baseUrl,\n fractalEncryptionBaseUrl,\n queryClientConfig = {},\n policyOptions = {},\n }: KycServiceOptions) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions,\n });\n // Fall back to the runtime's native `fetch`, bound to `globalThis` so it\n // can be invoked as a method of this instance without an illegal-invocation\n // error on platforms that check the receiver.\n if (fetchFunction) {\n this.#fetch = fetchFunction;\n } else if (typeof globalThis.fetch === 'function') {\n this.#fetch = globalThis.fetch.bind(globalThis);\n } else {\n throw new Error(\n 'KycService: fetch is not available globally and was not provided in options. Please inject a fetch implementation.',\n );\n }\n if (!baseUrl) {\n throw new Error('KycService: baseUrl is required');\n }\n this.#baseUrl = baseUrl;\n this.#fractalEncryptionBaseUrl = fractalEncryptionBaseUrl ?? '';\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\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 */\n async getGeoCountry(): Promise<string> {\n const location = await this.messenger.call(\n 'GeolocationController:getGeolocation',\n );\n // Guard nullish/empty geolocation with the documented domain error rather\n // than letting `assert(location, string())` surface a superstruct\n // assertion error (which would change how the failure reads in\n // `disclaimersError`).\n const alpha2 =\n typeof location === 'string' ? location.split('-')[0].toUpperCase() : '';\n if (!alpha2 || alpha2 === 'UNKNOWN') {\n throw new Error(\n `Unable to determine country from geolocation (got \"${String(\n location,\n )}\").`,\n );\n }\n const alpha3 = alpha2ToAlpha3(alpha2);\n if (!alpha3) {\n throw new Error(\n `Unable to map country code \"${alpha2}\" to an ISO 3166-1 alpha-3 code.`,\n );\n }\n return alpha3;\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 */\n async fetchDisclaimers({\n vendor = 'moonpay',\n country,\n }: {\n vendor?: KycVendor;\n country: string;\n }): Promise<KycDisclaimer[]> {\n const url = new URL(`/vendors/${vendor}/disclaimers`, this.#baseUrl);\n url.searchParams.set('country', country);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchDisclaimers`, vendor, country],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n staleTime: inMilliseconds(5, Duration.Minute),\n });\n return this.#validateResponse(\n data,\n DisclaimersResponseStruct,\n 'disclaimers',\n ) as KycDisclaimer[];\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 */\n async createSession(\n params: CreateSessionParams,\n ): Promise<Infer<typeof CreateSessionResponseStruct>> {\n const url = new URL('/vendors/moonpay/sessions', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:createSession`,\n params.email,\n params.termsAcceptedAt,\n params.disclaimerIds,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify(params),\n }),\n // A session-creating mutation must never serve a stale/cached result.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n CreateSessionResponseStruct,\n 'sessions',\n );\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 */\n async checkKycRequired(\n params: CheckKycRequiredParams,\n ): Promise<{ kycRequired: boolean }> {\n const vendor = params.vendor ?? 'moonpay';\n const url = new URL(`/vendors/${vendor}/kyc-required`, this.#baseUrl);\n const capabilities = params.capabilities ?? [{ product: 'ramps' }];\n const body =\n vendor === 'moonpay'\n ? {\n accessToken: params.accessToken,\n country: params.country,\n capabilities,\n }\n : {};\n\n // MoonPay requires accessToken and country; validate before making the request.\n if (vendor === 'moonpay') {\n if (!params.accessToken) {\n throw new Error(\n 'checkKycRequired: accessToken is required for vendor \"moonpay\".',\n );\n }\n if (!params.country) {\n throw new Error(\n 'checkKycRequired: country is required for vendor \"moonpay\".',\n );\n }\n }\n\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:checkKycRequired`,\n vendor,\n params.accessToken ?? null,\n params.country ?? null,\n capabilities,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify(body),\n }),\n // The requirement can change server-side, so always re-check.\n staleTime: 0,\n gcTime: 0,\n });\n const { required } = this.#validateResponse(\n data,\n KycRequiredResponseStruct,\n 'kyc-required',\n );\n return { kycRequired: required };\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 */\n async createVendorCustomer(\n params: CreateVendorCustomerParams,\n ): Promise<VendorCustomerResponse> {\n const url = new URL(`/vendors/${params.vendor}/customers`, this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:createVendorCustomer`,\n params.vendor,\n params.email,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({ email: params.email }),\n }),\n // Customer creation/resume must never serve a stale/cached result.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n VendorCustomerResponseStruct,\n 'vendor customers',\n );\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 */\n async submitVendorDisclaimers(\n params: SubmitVendorDisclaimersParams,\n ): Promise<KycVendorSigning[]> {\n const url = new URL(\n `/vendors/${encodeURIComponent(params.vendor)}/disclaimers`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:submitVendorDisclaimers`,\n params.vendor,\n params.disclaimerIds,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({ disclaimerIds: params.disclaimerIds }),\n }),\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n VendorSigningsResponseStruct,\n 'vendor disclaimers',\n );\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 */\n async fetchSessionDisclaimers(\n params: FetchSessionDisclaimersParams,\n ): Promise<KycSessionDisclaimers> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchSessionDisclaimers`, params.sessionId],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n // Consent state can change after a POST, so always re-fetch.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionDisclaimersResponseStruct,\n 'session disclaimers',\n );\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 */\n async submitSessionDisclaimers(\n params: SubmitSessionDisclaimersParams,\n ): Promise<KycSessionDisclaimers> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/disclaimers`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:submitSessionDisclaimers`,\n params.sessionId,\n params.idOS,\n params.kycProvider,\n params.credentialReusabilityConsentGiven,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n idOS: params.idOS,\n kycProvider: params.kycProvider,\n credentialReusabilityConsentGiven:\n params.credentialReusabilityConsentGiven,\n }),\n }),\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionDisclaimersResponseStruct,\n 'session disclaimers',\n );\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 */\n async fetchKycStatus(): Promise<KycUserStatusResponse> {\n const url = new URL('/kyc/status', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchKycStatus`],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n // Status is polled for toast flips, so it must always be fresh.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n KycUserStatusResponseStruct,\n 'kyc status',\n );\n }\n\n /**\n * Fetches the Fractal encryption service JWKS used to verify the `jwtChain`s\n * returned inside encryption schemas from {@link KycService.createUkycSession}.\n *\n * This is an unauthenticated request to a well-known path on the Fractal\n * host, distinct from the UKYC base URL.\n *\n * @returns The JWKS keys.\n */\n async fetchJwks(): Promise<JwksResponse> {\n if (!this.#fractalEncryptionBaseUrl) {\n throw new Error(\n 'KycService: fractalEncryptionBaseUrl is not configured; cannot fetch JWKS to verify encryption schemas.',\n );\n }\n const url = new URL(UKYC_JWKS_PATH, this.#fractalEncryptionBaseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchJwks`, this.#fractalEncryptionBaseUrl],\n queryFn: async () =>\n this.#requestJson(url, { method: 'GET' }, { authenticated: false }),\n staleTime: inMilliseconds(1, Duration.Hour),\n });\n return this.#validateResponse(data, JwksResponseStruct, 'JWKS');\n }\n\n /**\n * Creates a UKYC session for the SumSub document-verification sub-flow.\n *\n * The response 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 */\n async createUkycSession(\n params: CreateUkycSessionParams,\n ): Promise<UkycSessionResponse> {\n const url = new URL('/sessions', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:createUkycSession`, params.jwtToken],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n vendorId: params.vendor ?? 'moonpay',\n vendorUserId: 'mockedId',\n jwtToken: params.jwtToken,\n vendorMetadata: params.vendorMetadata ?? {},\n }),\n }),\n // A session-creating mutation must never serve a stale/cached result.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n UkycSessionResponseStruct,\n 'UKYC sessions',\n );\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 */\n async setAuthorizations(\n params: SetAuthorizationsParams,\n ): Promise<KycSessionStatus> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/authorizations`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:setAuthorizations`, params.sessionId],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n wrappedEncryptionDataKey: params.wrappedEncryptionDataKey,\n wrappedUkycCapabilityToken: params.wrappedUkycCapabilityToken,\n }),\n }),\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionStatusResponseStruct,\n 'authorizations',\n );\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 */\n async createJourney(\n sessionId: string,\n ): Promise<ApplicantAccessTokenResponse> {\n const url = new URL(\n `/sessions/${encodeURIComponent(sessionId)}/journey`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:createJourney`, sessionId],\n queryFn: async () => this.#requestJson(url, { method: 'POST' }),\n // Journeys are (re)created on demand; do not reuse a cached token.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n ApplicantAccessTokenResponseStruct,\n 'journey',\n );\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 */\n async getSessionStatus(\n params: GetSessionStatusParams,\n ): Promise<KycSessionStatus> {\n const url = new URL(\n `/sessions/${encodeURIComponent(params.sessionId)}/status`,\n this.#baseUrl,\n );\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:getSessionStatus`, params.sessionId],\n queryFn: async () => this.#requestJson(url, { method: 'GET' }),\n // Status is polled for a terminal decision, so it must always be fresh.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n SessionStatusResponseStruct,\n 'session status',\n );\n }\n\n /**\n * Validates a parsed API response against a superstruct schema, throwing a\n * descriptive error when the response does not match.\n *\n * Unlike a bare `Struct.is` check, this surfaces exactly which field was\n * missing or had the wrong type, which is essential for diagnosing shape\n * mismatches between the client and the live API.\n *\n * @param data - The parsed response body.\n * @param struct - The superstruct schema the body is expected to satisfy.\n * @param apiName - A human-readable name of the API, used in the error message.\n * @returns The validated, typed response.\n * @throws If `data` does not match `struct`.\n */\n #validateResponse<Type, Schema>(\n data: unknown,\n struct: Struct<Type, Schema>,\n apiName: string,\n ): Type {\n try {\n assert(data, struct);\n return data;\n } catch (error) {\n const detail =\n error instanceof StructError\n ? `${error.message} (received: ${JSON.stringify(data)})`\n : // `assert` only ever throws `StructError` for the plain structs used\n // here, so this is a defensive fallback that is not exercised.\n /* istanbul ignore next */\n String(error);\n throw new Error(\n `Malformed response received from ${apiName} API: ${detail}`,\n );\n }\n }\n\n /**\n * Performs a single JSON request.\n *\n * This is meant to be used as the `queryFn` for {@link fetchQuery}, which\n * wraps it in the shared service policy (retries, circuit breaker). Requests\n * are authenticated with the wallet bearer token by default; pass\n * `{ authenticated: false }` for calls to services that do not expect it\n * (e.g. the Fractal JWKS endpoint).\n *\n * @param url - The request URL.\n * @param init - The request init (method, body).\n * @param options - Request options.\n * @param options.authenticated - Whether to attach the bearer token. Defaults\n * to `true`.\n * @returns The parsed JSON response.\n */\n async #requestJson(\n url: URL,\n init: RequestInit,\n options: { authenticated?: boolean } = {},\n ): Promise<Json> {\n const { authenticated = true } = options;\n\n const headers: Record<string, string> = {};\n\n // Only advertise a JSON body when one is actually sent; bodyless requests\n // (e.g. `createJourney`) must not carry a `Content-Type`.\n if (init.body !== undefined && init.body !== null) {\n headers['Content-Type'] = 'application/json';\n }\n\n if (authenticated) {\n const bearerToken = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n if (!bearerToken) {\n throw new Error(\n 'Unable to obtain an authentication bearer token — is the wallet signed in?',\n );\n }\n assert(bearerToken, string());\n headers.Authorization = `Bearer ${bearerToken}`;\n }\n\n const response = await this.#fetch(url.toString(), {\n ...init,\n headers,\n });\n if (!response.ok) {\n let detail = '';\n try {\n const errorBody: unknown = await response.json();\n if (errorBody && typeof errorBody === 'object') {\n const record = errorBody as Record<string, unknown>;\n if (typeof record.message === 'string') {\n detail = record.message;\n } else if (typeof record.error === 'string') {\n detail = record.error;\n }\n }\n } catch {\n // Ignore body parse failures; status alone is still useful.\n }\n throw new HttpError(\n response.status,\n `Fetching '${url.toString()}' failed with status '${response.status}'${\n detail ? `: ${detail}` : ''\n }`,\n );\n }\n\n // DELETE (and similar) endpoints return 204 No Content.\n if (response.status === 204) {\n return null;\n }\n\n return (await response.json()) as Json;\n }\n}\n"]}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alpha2ToAlpha3 = exports.ALPHA2_TO_ALPHA3 = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ISO 3166-1 alpha-2 to alpha-3 country code mapping.
|
|
6
|
+
*
|
|
7
|
+
* The geolocation source returns ISO 3166-2 codes whose leading segment is an
|
|
8
|
+
* alpha-2 country code (e.g. "US", "US-NY"). The identity vendor APIs
|
|
9
|
+
* (disclaimers, kyc-required) expect alpha-3 codes (e.g. "USA"). This map
|
|
10
|
+
* bridges the two.
|
|
11
|
+
*/
|
|
12
|
+
exports.ALPHA2_TO_ALPHA3 = {
|
|
13
|
+
AD: 'AND',
|
|
14
|
+
AE: 'ARE',
|
|
15
|
+
AF: 'AFG',
|
|
16
|
+
AG: 'ATG',
|
|
17
|
+
AI: 'AIA',
|
|
18
|
+
AL: 'ALB',
|
|
19
|
+
AM: 'ARM',
|
|
20
|
+
AO: 'AGO',
|
|
21
|
+
AQ: 'ATA',
|
|
22
|
+
AR: 'ARG',
|
|
23
|
+
AS: 'ASM',
|
|
24
|
+
AT: 'AUT',
|
|
25
|
+
AU: 'AUS',
|
|
26
|
+
AW: 'ABW',
|
|
27
|
+
AX: 'ALA',
|
|
28
|
+
AZ: 'AZE',
|
|
29
|
+
BA: 'BIH',
|
|
30
|
+
BB: 'BRB',
|
|
31
|
+
BD: 'BGD',
|
|
32
|
+
BE: 'BEL',
|
|
33
|
+
BF: 'BFA',
|
|
34
|
+
BG: 'BGR',
|
|
35
|
+
BH: 'BHR',
|
|
36
|
+
BI: 'BDI',
|
|
37
|
+
BJ: 'BEN',
|
|
38
|
+
BL: 'BLM',
|
|
39
|
+
BM: 'BMU',
|
|
40
|
+
BN: 'BRN',
|
|
41
|
+
BO: 'BOL',
|
|
42
|
+
BQ: 'BES',
|
|
43
|
+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: 'GHA',
|
|
95
|
+
GI: 'GIB',
|
|
96
|
+
GL: 'GRL',
|
|
97
|
+
GM: 'GMB',
|
|
98
|
+
GN: 'GIN',
|
|
99
|
+
GP: 'GLP',
|
|
100
|
+
GQ: 'GNQ',
|
|
101
|
+
GR: 'GRC',
|
|
102
|
+
GS: 'SGS',
|
|
103
|
+
GT: 'GTM',
|
|
104
|
+
GU: 'GUM',
|
|
105
|
+
GW: 'GNB',
|
|
106
|
+
GY: 'GUY',
|
|
107
|
+
HK: 'HKG',
|
|
108
|
+
HM: 'HMD',
|
|
109
|
+
HN: 'HND',
|
|
110
|
+
HR: 'HRV',
|
|
111
|
+
HT: 'HTI',
|
|
112
|
+
HU: 'HUN',
|
|
113
|
+
ID: 'IDN',
|
|
114
|
+
IE: 'IRL',
|
|
115
|
+
IL: 'ISR',
|
|
116
|
+
IM: 'IMN',
|
|
117
|
+
IN: 'IND',
|
|
118
|
+
IO: 'IOT',
|
|
119
|
+
IQ: 'IRQ',
|
|
120
|
+
IR: 'IRN',
|
|
121
|
+
IS: 'ISL',
|
|
122
|
+
IT: 'ITA',
|
|
123
|
+
JE: 'JEY',
|
|
124
|
+
JM: 'JAM',
|
|
125
|
+
JO: 'JOR',
|
|
126
|
+
JP: 'JPN',
|
|
127
|
+
KE: 'KEN',
|
|
128
|
+
KG: 'KGZ',
|
|
129
|
+
KH: 'KHM',
|
|
130
|
+
KI: 'KIR',
|
|
131
|
+
KM: 'COM',
|
|
132
|
+
KN: 'KNA',
|
|
133
|
+
KP: 'PRK',
|
|
134
|
+
KR: 'KOR',
|
|
135
|
+
KW: 'KWT',
|
|
136
|
+
KY: 'CYM',
|
|
137
|
+
KZ: 'KAZ',
|
|
138
|
+
LA: 'LAO',
|
|
139
|
+
LB: 'LBN',
|
|
140
|
+
LC: 'LCA',
|
|
141
|
+
LI: 'LIE',
|
|
142
|
+
LK: 'LKA',
|
|
143
|
+
LR: 'LBR',
|
|
144
|
+
LS: 'LSO',
|
|
145
|
+
LT: 'LTU',
|
|
146
|
+
LU: 'LUX',
|
|
147
|
+
LV: 'LVA',
|
|
148
|
+
LY: 'LBY',
|
|
149
|
+
MA: 'MAR',
|
|
150
|
+
MC: 'MCO',
|
|
151
|
+
MD: 'MDA',
|
|
152
|
+
ME: 'MNE',
|
|
153
|
+
MF: 'MAF',
|
|
154
|
+
MG: 'MDG',
|
|
155
|
+
MH: 'MHL',
|
|
156
|
+
MK: 'MKD',
|
|
157
|
+
ML: 'MLI',
|
|
158
|
+
MM: 'MMR',
|
|
159
|
+
MN: 'MNG',
|
|
160
|
+
MO: 'MAC',
|
|
161
|
+
MP: 'MNP',
|
|
162
|
+
MQ: 'MTQ',
|
|
163
|
+
MR: 'MRT',
|
|
164
|
+
MS: 'MSR',
|
|
165
|
+
MT: 'MLT',
|
|
166
|
+
MU: 'MUS',
|
|
167
|
+
MV: 'MDV',
|
|
168
|
+
MW: 'MWI',
|
|
169
|
+
MX: 'MEX',
|
|
170
|
+
MY: 'MYS',
|
|
171
|
+
MZ: 'MOZ',
|
|
172
|
+
NA: 'NAM',
|
|
173
|
+
NC: 'NCL',
|
|
174
|
+
NE: 'NER',
|
|
175
|
+
NF: 'NFK',
|
|
176
|
+
NG: 'NGA',
|
|
177
|
+
NI: 'NIC',
|
|
178
|
+
NL: 'NLD',
|
|
179
|
+
NO: 'NOR',
|
|
180
|
+
NP: 'NPL',
|
|
181
|
+
NR: 'NRU',
|
|
182
|
+
NU: 'NIU',
|
|
183
|
+
NZ: 'NZL',
|
|
184
|
+
OM: 'OMN',
|
|
185
|
+
PA: 'PAN',
|
|
186
|
+
PE: 'PER',
|
|
187
|
+
PF: 'PYF',
|
|
188
|
+
PG: 'PNG',
|
|
189
|
+
PH: 'PHL',
|
|
190
|
+
PK: 'PAK',
|
|
191
|
+
PL: 'POL',
|
|
192
|
+
PM: 'SPM',
|
|
193
|
+
PN: 'PCN',
|
|
194
|
+
PR: 'PRI',
|
|
195
|
+
PS: 'PSE',
|
|
196
|
+
PT: 'PRT',
|
|
197
|
+
PW: 'PLW',
|
|
198
|
+
PY: 'PRY',
|
|
199
|
+
QA: 'QAT',
|
|
200
|
+
RE: 'REU',
|
|
201
|
+
RO: 'ROU',
|
|
202
|
+
RS: 'SRB',
|
|
203
|
+
RU: 'RUS',
|
|
204
|
+
RW: 'RWA',
|
|
205
|
+
SA: 'SAU',
|
|
206
|
+
SB: 'SLB',
|
|
207
|
+
SC: 'SYC',
|
|
208
|
+
SD: 'SDN',
|
|
209
|
+
SE: 'SWE',
|
|
210
|
+
SG: 'SGP',
|
|
211
|
+
SH: 'SHN',
|
|
212
|
+
SI: 'SVN',
|
|
213
|
+
SJ: 'SJM',
|
|
214
|
+
SK: 'SVK',
|
|
215
|
+
SL: 'SLE',
|
|
216
|
+
SM: 'SMR',
|
|
217
|
+
SN: 'SEN',
|
|
218
|
+
SO: 'SOM',
|
|
219
|
+
SR: 'SUR',
|
|
220
|
+
SS: 'SSD',
|
|
221
|
+
ST: 'STP',
|
|
222
|
+
SV: 'SLV',
|
|
223
|
+
SX: 'SXM',
|
|
224
|
+
SY: 'SYR',
|
|
225
|
+
SZ: 'SWZ',
|
|
226
|
+
TC: 'TCA',
|
|
227
|
+
TD: 'TCD',
|
|
228
|
+
TF: 'ATF',
|
|
229
|
+
TG: 'TGO',
|
|
230
|
+
TH: 'THA',
|
|
231
|
+
TJ: 'TJK',
|
|
232
|
+
TK: 'TKL',
|
|
233
|
+
TL: 'TLS',
|
|
234
|
+
TM: 'TKM',
|
|
235
|
+
TN: 'TUN',
|
|
236
|
+
TO: 'TON',
|
|
237
|
+
TR: 'TUR',
|
|
238
|
+
TT: 'TTO',
|
|
239
|
+
TV: 'TUV',
|
|
240
|
+
TW: 'TWN',
|
|
241
|
+
TZ: 'TZA',
|
|
242
|
+
UA: 'UKR',
|
|
243
|
+
UG: 'UGA',
|
|
244
|
+
UM: 'UMI',
|
|
245
|
+
US: 'USA',
|
|
246
|
+
UY: 'URY',
|
|
247
|
+
UZ: 'UZB',
|
|
248
|
+
VA: 'VAT',
|
|
249
|
+
VC: 'VCT',
|
|
250
|
+
VE: 'VEN',
|
|
251
|
+
VG: 'VGB',
|
|
252
|
+
VI: 'VIR',
|
|
253
|
+
VN: 'VNM',
|
|
254
|
+
VU: 'VUT',
|
|
255
|
+
WF: 'WLF',
|
|
256
|
+
WS: 'WSM',
|
|
257
|
+
YE: 'YEM',
|
|
258
|
+
YT: 'MYT',
|
|
259
|
+
ZA: 'ZAF',
|
|
260
|
+
ZM: 'ZMB',
|
|
261
|
+
ZW: 'ZWE',
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Converts an ISO 3166-1 alpha-2 country code (e.g. "US") to its alpha-3
|
|
265
|
+
* equivalent (e.g. "USA"). Returns `undefined` for unknown codes.
|
|
266
|
+
*
|
|
267
|
+
* @param alpha2 - The ISO 3166-1 alpha-2 country code.
|
|
268
|
+
* @returns The alpha-3 code, or `undefined` if the input is not recognized.
|
|
269
|
+
*/
|
|
270
|
+
function alpha2ToAlpha3(alpha2) {
|
|
271
|
+
return exports.ALPHA2_TO_ALPHA3[alpha2.toUpperCase()];
|
|
272
|
+
}
|
|
273
|
+
exports.alpha2ToAlpha3 = alpha2ToAlpha3;
|
|
274
|
+
//# sourceMappingURL=countryCodes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryCodes.cjs","sourceRoot":"","sources":["../src/countryCodes.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACU,QAAA,gBAAgB,GAA2B;IACtD,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,E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AK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;CACV,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,MAAc;IAC3C,OAAO,wBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAChD,CAAC;AAFD,wCAEC","sourcesContent":["/**\n * ISO 3166-1 alpha-2 to alpha-3 country code mapping.\n *\n * The geolocation source returns ISO 3166-2 codes whose leading segment is an\n * alpha-2 country code (e.g. \"US\", \"US-NY\"). The identity vendor APIs\n * (disclaimers, kyc-required) expect alpha-3 codes (e.g. \"USA\"). This map\n * bridges the two.\n */\nexport const ALPHA2_TO_ALPHA3: Record<string, string> = {\n AD: 'AND',\n AE: 'ARE',\n AF: 'AFG',\n AG: 'ATG',\n AI: 'AIA',\n AL: 'ALB',\n AM: 'ARM',\n AO: 'AGO',\n AQ: 'ATA',\n AR: 'ARG',\n AS: 'ASM',\n AT: 'AUT',\n AU: 'AUS',\n AW: 'ABW',\n AX: 'ALA',\n AZ: 'AZE',\n BA: 'BIH',\n BB: 'BRB',\n BD: 'BGD',\n BE: 'BEL',\n BF: 'BFA',\n BG: 'BGR',\n BH: 'BHR',\n BI: 'BDI',\n BJ: 'BEN',\n BL: 'BLM',\n BM: 'BMU',\n BN: 'BRN',\n BO: 'BOL',\n BQ: 'BES',\n BR: 'BRA',\n BS: 'BHS',\n BT: 'BTN',\n BV: 'BVT',\n BW: 'BWA',\n BY: 'BLR',\n BZ: 'BLZ',\n CA: 'CAN',\n CC: 'CCK',\n CD: 'COD',\n CF: 'CAF',\n CG: 'COG',\n CH: 'CHE',\n CI: 'CIV',\n CK: 'COK',\n CL: 'CHL',\n CM: 'CMR',\n CN: 'CHN',\n CO: 'COL',\n CR: 'CRI',\n CU: 'CUB',\n CV: 'CPV',\n CW: 'CUW',\n CX: 'CXR',\n CY: 'CYP',\n CZ: 'CZE',\n DE: 'DEU',\n DJ: 'DJI',\n DK: 'DNK',\n DM: 'DMA',\n DO: 'DOM',\n DZ: 'DZA',\n EC: 'ECU',\n EE: 'EST',\n EG: 'EGY',\n EH: 'ESH',\n ER: 'ERI',\n ES: 'ESP',\n ET: 'ETH',\n FI: 'FIN',\n FJ: 'FJI',\n FK: 'FLK',\n FM: 'FSM',\n FO: 'FRO',\n FR: 'FRA',\n GA: 'GAB',\n GB: 'GBR',\n GD: 'GRD',\n GE: 'GEO',\n GF: 'GUF',\n GG: 'GGY',\n GH: 'GHA',\n GI: 'GIB',\n GL: 'GRL',\n GM: 'GMB',\n GN: 'GIN',\n GP: 'GLP',\n GQ: 'GNQ',\n GR: 'GRC',\n GS: 'SGS',\n GT: 'GTM',\n GU: 'GUM',\n GW: 'GNB',\n GY: 'GUY',\n HK: 'HKG',\n HM: 'HMD',\n HN: 'HND',\n HR: 'HRV',\n HT: 'HTI',\n HU: 'HUN',\n ID: 'IDN',\n IE: 'IRL',\n IL: 'ISR',\n IM: 'IMN',\n IN: 'IND',\n IO: 'IOT',\n IQ: 'IRQ',\n IR: 'IRN',\n IS: 'ISL',\n IT: 'ITA',\n JE: 'JEY',\n JM: 'JAM',\n JO: 'JOR',\n JP: 'JPN',\n KE: 'KEN',\n KG: 'KGZ',\n KH: 'KHM',\n KI: 'KIR',\n KM: 'COM',\n KN: 'KNA',\n KP: 'PRK',\n KR: 'KOR',\n KW: 'KWT',\n KY: 'CYM',\n KZ: 'KAZ',\n LA: 'LAO',\n LB: 'LBN',\n LC: 'LCA',\n LI: 'LIE',\n LK: 'LKA',\n LR: 'LBR',\n LS: 'LSO',\n LT: 'LTU',\n LU: 'LUX',\n LV: 'LVA',\n LY: 'LBY',\n MA: 'MAR',\n MC: 'MCO',\n MD: 'MDA',\n ME: 'MNE',\n MF: 'MAF',\n MG: 'MDG',\n MH: 'MHL',\n MK: 'MKD',\n ML: 'MLI',\n MM: 'MMR',\n MN: 'MNG',\n MO: 'MAC',\n MP: 'MNP',\n MQ: 'MTQ',\n MR: 'MRT',\n MS: 'MSR',\n MT: 'MLT',\n MU: 'MUS',\n MV: 'MDV',\n MW: 'MWI',\n MX: 'MEX',\n MY: 'MYS',\n MZ: 'MOZ',\n NA: 'NAM',\n NC: 'NCL',\n NE: 'NER',\n NF: 'NFK',\n NG: 'NGA',\n NI: 'NIC',\n NL: 'NLD',\n NO: 'NOR',\n NP: 'NPL',\n NR: 'NRU',\n NU: 'NIU',\n NZ: 'NZL',\n OM: 'OMN',\n PA: 'PAN',\n PE: 'PER',\n PF: 'PYF',\n PG: 'PNG',\n PH: 'PHL',\n PK: 'PAK',\n PL: 'POL',\n PM: 'SPM',\n PN: 'PCN',\n PR: 'PRI',\n PS: 'PSE',\n PT: 'PRT',\n PW: 'PLW',\n PY: 'PRY',\n QA: 'QAT',\n RE: 'REU',\n RO: 'ROU',\n RS: 'SRB',\n RU: 'RUS',\n RW: 'RWA',\n SA: 'SAU',\n SB: 'SLB',\n SC: 'SYC',\n SD: 'SDN',\n SE: 'SWE',\n SG: 'SGP',\n SH: 'SHN',\n SI: 'SVN',\n SJ: 'SJM',\n SK: 'SVK',\n SL: 'SLE',\n SM: 'SMR',\n SN: 'SEN',\n SO: 'SOM',\n SR: 'SUR',\n SS: 'SSD',\n ST: 'STP',\n SV: 'SLV',\n SX: 'SXM',\n SY: 'SYR',\n SZ: 'SWZ',\n TC: 'TCA',\n TD: 'TCD',\n TF: 'ATF',\n TG: 'TGO',\n TH: 'THA',\n TJ: 'TJK',\n TK: 'TKL',\n TL: 'TLS',\n TM: 'TKM',\n TN: 'TUN',\n TO: 'TON',\n TR: 'TUR',\n TT: 'TTO',\n TV: 'TUV',\n TW: 'TWN',\n TZ: 'TZA',\n UA: 'UKR',\n UG: 'UGA',\n UM: 'UMI',\n US: 'USA',\n UY: 'URY',\n UZ: 'UZB',\n VA: 'VAT',\n VC: 'VCT',\n VE: 'VEN',\n VG: 'VGB',\n VI: 'VIR',\n VN: 'VNM',\n VU: 'VUT',\n WF: 'WLF',\n WS: 'WSM',\n YE: 'YEM',\n YT: 'MYT',\n ZA: 'ZAF',\n ZM: 'ZMB',\n ZW: 'ZWE',\n};\n\n/**\n * Converts an ISO 3166-1 alpha-2 country code (e.g. \"US\") to its alpha-3\n * equivalent (e.g. \"USA\"). Returns `undefined` for unknown codes.\n *\n * @param alpha2 - The ISO 3166-1 alpha-2 country code.\n * @returns The alpha-3 code, or `undefined` if the input is not recognized.\n */\nexport function alpha2ToAlpha3(alpha2: string): string | undefined {\n return ALPHA2_TO_ALPHA3[alpha2.toUpperCase()];\n}\n"]}
|
|
@@ -15,4 +15,4 @@ export declare const ALPHA2_TO_ALPHA3: Record<string, string>;
|
|
|
15
15
|
* @returns The alpha-3 code, or `undefined` if the input is not recognized.
|
|
16
16
|
*/
|
|
17
17
|
export declare function alpha2ToAlpha3(alpha2: string): string | undefined;
|
|
18
|
-
//# sourceMappingURL=countryCodes.d.
|
|
18
|
+
//# sourceMappingURL=countryCodes.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryCodes.d.cts","sourceRoot":"","sources":["../src/countryCodes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0PnD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ISO 3166-1 alpha-2 to alpha-3 country code mapping.
|
|
3
|
+
*
|
|
4
|
+
* The geolocation source returns ISO 3166-2 codes whose leading segment is an
|
|
5
|
+
* alpha-2 country code (e.g. "US", "US-NY"). The identity vendor APIs
|
|
6
|
+
* (disclaimers, kyc-required) expect alpha-3 codes (e.g. "USA"). This map
|
|
7
|
+
* bridges the two.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ALPHA2_TO_ALPHA3: Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Converts an ISO 3166-1 alpha-2 country code (e.g. "US") to its alpha-3
|
|
12
|
+
* equivalent (e.g. "USA"). Returns `undefined` for unknown codes.
|
|
13
|
+
*
|
|
14
|
+
* @param alpha2 - The ISO 3166-1 alpha-2 country code.
|
|
15
|
+
* @returns The alpha-3 code, or `undefined` if the input is not recognized.
|
|
16
|
+
*/
|
|
17
|
+
export declare function alpha2ToAlpha3(alpha2: string): string | undefined;
|
|
18
|
+
//# sourceMappingURL=countryCodes.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryCodes.d.mts","sourceRoot":"","sources":["../src/countryCodes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0PnD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE"}
|