@metamask-previews/kyc-controller 0.0.0-preview-6b4bcdab3 → 0.0.0-preview-0b5bfc2
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 +3 -42
- package/dist/KycController-method-action-types.cjs.map +1 -1
- package/dist/KycController-method-action-types.d.cts +2 -48
- package/dist/KycController-method-action-types.d.cts.map +1 -1
- package/dist/KycController-method-action-types.d.mts +2 -48
- 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 +13 -472
- package/dist/KycController.cjs.map +1 -1
- package/dist/KycController.d.cts +5 -109
- package/dist/KycController.d.cts.map +1 -1
- package/dist/KycController.d.mts +5 -109
- package/dist/KycController.d.mts.map +1 -1
- package/dist/KycController.mjs +13 -472
- 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 +2 -38
- package/dist/KycService-method-action-types.d.cts.map +1 -1
- package/dist/KycService-method-action-types.d.mts +2 -38
- 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 +29 -184
- package/dist/KycService.cjs.map +1 -1
- package/dist/KycService.d.cts +14 -99
- package/dist/KycService.d.cts.map +1 -1
- package/dist/KycService.d.mts +14 -99
- package/dist/KycService.d.mts.map +1 -1
- package/dist/KycService.mjs +30 -185
- package/dist/KycService.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +10 -49
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +10 -49
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +2 -2
package/dist/KycService.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService.cjs","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA8D;AAO9D,iEAAuD;AAKvD,uDAS+B;AAE/B,2CAA2D;AAG3D,wDAAmD;AAQnD,uDAAqD;AACrD,yEAAiF;AAGjF,kBAAkB;AAElB;;GAEG;AACU,QAAA,WAAW,GAAG,YAAY,CAAC;AAExC,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG;IAChC,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,eAAe;IACf,kBAAkB;CACV,CAAC;AAwFX,+BAA+B;AAE/B,MAAM,gBAAgB,GAAG,IAAA,kBAAI,EAAC;IAC5B,EAAE,EAAE,IAAA,oBAAM,GAAE;IACZ,YAAY,EAAE,IAAA,oBAAM,GAAE;IACtB,GAAG,EAAE,IAAA,oBAAM,GAAE;CACd,CAAC,CAAC;AACH,MAAM,yBAAyB,GAAG,IAAA,mBAAK,EAAC,gBAAgB,CAAC,CAAC;AAE1D,MAAM,2BAA2B,GAAG,IAAA,kBAAI,EAAC,EAAE,YAAY,EAAE,IAAA,oBAAM,GAAE,EAAE,CAAC,CAAC;AAErE,6EAA6E;AAC7E,gEAAgE;AAChE,MAAM,yBAAyB,GAAG,IAAA,kBAAI,EAAC,EAAE,QAAQ,EAAE,IAAA,qBAAO,GAAE,EAAE,CAAC,CAAC;AAEhE,wEAAwE;AACxE,8EAA8E;AAC9E,MAAM,4BAA4B,GAAG,IAAA,kBAAI,EAAC;IACxC,GAAG,EAAE,IAAA,oBAAM,GAAE;IACb,GAAG,EAAE,IAAA,oBAAM,GAAE;IACb,CAAC,EAAE,IAAA,oBAAM,GAAE;CACZ,CAAC,CAAC;AAEH,M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Q,GAAG,CAAC,QAAQ,EAAE,EAAE;QACjD,GAAG,IAAI;QACP,OAAO;KACR,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,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,4BAAS,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,yDAAyD;IACzD,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 KycDisclaimer,\n KycSessionStatus,\n KycUserStatusResponse,\n KycVendor,\n} from './types.js';\nimport { UKYC_JWKS_PATH } from './ukyc/constants.js';\nimport { encodeStorageAccessTokenForHeader } from './ukyc/storageAccessToken.js';\nimport type { UkycStorageAccessToken } from './ukyc/storageAccessToken.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 'submitConsents',\n 'fetchKycStatus',\n 'getWrappingKey',\n 'fetchJwks',\n 'createUkycSession',\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 the `jwtChain` returned by {@link KycService.getWrappingKey} is\n * fetched. Required to run the wrapping-key exchange in\n * {@link KycService.fetchJwks}.\n */\n fractalEncryptionBaseUrl?: string;\n /**\n * Shared configuration applied to all queries exposed by the service (e.g. a\n * default `staleTime`/`cacheTime`). 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 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 X25519 public key, in JWK-like form, returned by\n// `/wrapping-key`. `x` is the base64url public key used to wrap the user key.\nconst SessionServerPublicKeyStruct = type({\n kty: string(),\n crv: string(),\n x: string(),\n});\n\nconst WrappingKeyResponseStruct = type({\n id: string(),\n jwtChain: string(),\n sessionServerPublicKey: SessionServerPublicKeyStruct,\n});\nexport type WrappingKeyResponse = Infer<typeof WrappingKeyResponseStruct>;\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 // The relay-side KYC decision (e.g. `approved`) and the vendor-side final\n // status (e.g. `pending`) at session-creation time. Present when the applicant\n // already has a session in flight; absent for a brand-new session.\n kycStatus: optional(string()),\n finalStatus: optional(string()),\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\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 SubmitConsentsParams = {\n /**\n * Vendor disclaimer ids the customer accepted (T&C1). Mapped to the UKYC\n * wire field `ironDisclaimerIds` for the Money/VBA consents contract.\n */\n disclaimerIds: string[];\n sumsubTncSigned: boolean;\n idosTncSigned: boolean;\n kycLevel?: 'standard';\n};\n\nexport type GetWrappingKeyParams = {\n sessionClientPublicKey: string;\n};\n\n/**\n * The wrapped `data_encryption_key` sent to the UKYC backend when creating a\n * session. `encryptedKey` and `nonce` are produced by `wrapEncryptionKey`;\n * `sessionId` is the wrapping key id returned by `getWrappingKey`.\n */\nexport type WrappedEncryptionKey = {\n sessionId: string;\n encryptedKey: string;\n nonce: string;\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 wrappedEncryptionKey: WrappedEncryptionKey;\n /**\n * The client-signed `ukyc_capability_token` (envelope: payload + Ed25519\n * signature) authorizing later storage access for this session. It is minted\n * by the client with `read`-only scope — see the UKYC storage-and-auth spec\n * for how it is formed. Only the client holds the signing key, so only the\n * client can mint it. The envelope is base64url-encoded into a compact string\n * before it is sent to the backend.\n */\n ukycCapabilityToken: UkycStorageAccessToken;\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 * the session-creating and status-polling endpoints opt out of caching\n * (`staleTime`/`cacheTime` of `0`) 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 the wrapping-key\n * `jwtChain` 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 cacheTime: 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 cacheTime: 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 cacheTime: 0,\n });\n return this.#validateResponse(\n data,\n VendorCustomerResponseStruct,\n 'vendor customers',\n );\n }\n\n /**\n * Posts T&C1 (vendor signings) and T&C2 (Sumsub + idOS) consents for the\n * authenticated user. The API responds with 204 No Content on success.\n *\n * @param params - The consent parameters.\n */\n async submitConsents(params: SubmitConsentsParams): Promise<void> {\n const url = new URL('/consents', this.#baseUrl);\n await this.fetchQuery({\n queryKey: [\n `${this.name}:submitConsents`,\n params.disclaimerIds,\n params.sumsubTncSigned,\n params.idosTncSigned,\n params.kycLevel ?? 'standard',\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n // UKYC Money/VBA consents contract still uses `ironDisclaimerIds`.\n body: JSON.stringify({\n ironDisclaimerIds: params.disclaimerIds,\n sumsubTncSigned: params.sumsubTncSigned,\n idosTncSigned: params.idosTncSigned,\n kycLevel: params.kycLevel ?? 'standard',\n }),\n }),\n staleTime: 0,\n cacheTime: 0,\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 cacheTime: 0,\n });\n return this.#validateResponse(\n data,\n KycUserStatusResponseStruct,\n 'kyc status',\n );\n }\n\n /**\n * Requests a per-session wrapping key from the UKYC backend.\n *\n * The client sends its ephemeral X25519 public key; the backend responds with\n * its session public key (`sessionServerPublicKey`) and a `jwtChain` that\n * attests it. The caller must verify `jwtChain` against the Fractal JWKS\n * (see {@link KycService.fetchJwks}) before trusting the key to wrap the\n * `data_encryption_key`.\n *\n * @param params - The parameters.\n * @param params.sessionClientPublicKey - Our ephemeral X25519 public key\n * (base64url).\n * @returns The wrapping key id, `jwtChain`, and session server public key.\n */\n async getWrappingKey(\n params: GetWrappingKeyParams,\n ): Promise<WrappingKeyResponse> {\n const url = new URL('/wrapping-key', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:getWrappingKey`, params.sessionClientPublicKey],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n sessionClientPublicKey: params.sessionClientPublicKey,\n }),\n }),\n // A per-session key exchange must always run fresh.\n staleTime: 0,\n cacheTime: 0,\n });\n return this.#validateResponse(\n data,\n WrappingKeyResponseStruct,\n 'wrapping-key',\n );\n }\n\n /**\n * Fetches the Fractal encryption service JWKS used to verify the `jwtChain`\n * returned by {@link KycService.getWrappingKey}.\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 the wrapping key.',\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 * handing over the wrapped `data_encryption_key` and the client-signed,\n * read-only `ukyc_capability_token` that authorizes later storage access for\n * the session.\n *\n * @param params - The session parameters.\n * @returns The UKYC session identifiers.\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: [\n `${this.name}:createUkycSession`,\n params.wrappedEncryptionKey.sessionId,\n ],\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 wrappedEncryptionKey: params.wrappedEncryptionKey,\n ukycCapabilityToken: encodeStorageAccessTokenForHeader(\n params.ukycCapabilityToken,\n ),\n }),\n }),\n // A session-creating mutation must never serve a stale/cached result.\n staleTime: 0,\n cacheTime: 0,\n });\n return this.#validateResponse(\n data,\n UkycSessionResponseStruct,\n 'UKYC sessions',\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 cacheTime: 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 cacheTime: 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 // Consent (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.cjs","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA8D;AAO9D,iEAAuD;AAKvD,uDAQ+B;AAE/B,2CAA2D;AAG3D,wDAAmD;AAGnD,uDAAqD;AACrD,yEAAiF;AAG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AAK,CACb,oCAAoC,OAAO,SAAS,MAAM,EAAE,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,KAAK,kCACH,GAAQ,EACR,IAAiB,EACjB,UAAuC,EAAE;IAEzC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEzC,MAAM,OAAO,GAA2B,EAAE,CAAC;IAE3C,0EAA0E;IAC1E,0DAA0D;IAC1D,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAC3C,yCAAyC,CAC1C,CAAC;QACF,IAAA,oBAAM,EAAC,WAAW,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC;QAC9B,OAAO,CAAC,aAAa,GAAG,UAAU,WAAW,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;QAC3C,GAAG,IAAI;QACP,OAAO;KACR,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,4BAAS,CACjB,QAAQ,CAAC,MAAM,EACf,aAAa,GAAG,CAAC,QAAQ,EAAE,yBAAyB,QAAQ,CAAC,MAAM,GAAG,CACvE,CAAC;IACJ,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 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 { KycDisclaimer, KycSessionStatus } from './types.js';\nimport { UKYC_JWKS_PATH } from './ukyc/constants.js';\nimport { encodeStorageAccessTokenForHeader } from './ukyc/storageAccessToken.js';\nimport type { UkycStorageAccessToken } from './ukyc/storageAccessToken.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 'getWrappingKey',\n 'fetchJwks',\n 'createUkycSession',\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 * Base url of the KYC api\n */\n baseUrl: string;\n /**\n * Base URL of the Fractal encryption api\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 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 X25519 public key, in JWK-like form, returned by\n// `/wrapping-key`. `x` is the base64url public key used to wrap the user key.\nconst SessionServerPublicKeyStruct = type({\n kty: string(),\n crv: string(),\n x: string(),\n});\n\nconst WrappingKeyResponseStruct = type({\n id: string(),\n jwtChain: string(),\n sessionServerPublicKey: SessionServerPublicKeyStruct,\n});\nexport type WrappingKeyResponse = Infer<typeof WrappingKeyResponseStruct>;\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 // The relay-side KYC decision (e.g. `approved`) and the vendor-side final\n // status (e.g. `pending`) at session-creation time. Present when the applicant\n // already has a session in flight; absent for a brand-new session.\n kycStatus: optional(string()),\n finalStatus: optional(string()),\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// === PARAM TYPES ===\n\nexport type CreateSessionParams = {\n email: string;\n termsAcceptedAt: string;\n disclaimerIds: string[];\n};\n\nexport type CheckKycRequiredParams = {\n accessToken: string;\n country: string;\n capabilities?: { product: string }[];\n};\n\nexport type GetWrappingKeyParams = {\n sessionClientPublicKey: string;\n};\n\n/**\n * The wrapped `data_encryption_key` sent to the UKYC backend when creating a\n * session. `encryptedKey` and `nonce` are produced by `wrapEncryptionKey`;\n * `sessionId` is the wrapping key id returned by `getWrappingKey`.\n */\nexport type WrappedEncryptionKey = {\n sessionId: string;\n encryptedKey: string;\n nonce: string;\n};\n\nexport type CreateUkycSessionParams = {\n jwtToken: string;\n vendorMetadata: Record<string, unknown>;\n wrappedEncryptionKey: WrappedEncryptionKey;\n /**\n * The client-signed `ukyc_capability_token` (envelope: payload + Ed25519\n * signature) authorizing later storage access for this session. It is minted\n * by the client with `read`-only scope — see the UKYC storage-and-auth spec\n * for how it is formed. Only the client holds the signing key, so only the\n * client can mint it. The envelope is base64url-encoded into a compact string\n * before it is sent to the backend.\n */\n ukycCapabilityToken: UkycStorageAccessToken;\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 global `fetch`, and the auth bearer token and\n * geolocation come from 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 * the session-creating and status-polling endpoints opt out of caching\n * (`staleTime`/`gcTime` of `0`) so they never serve a stale result.\n */\nexport class KycService extends BaseDataService<\n typeof serviceName,\n KycServiceMessenger\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.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 the wrapping-key\n * `jwtChain` 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 baseUrl,\n fractalEncryptionBaseUrl,\n queryClientConfig = {},\n policyOptions = {},\n }: KycServiceOptions) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions,\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.country - ISO 3166-1 alpha-3 country code.\n * @returns The disclaimers.\n */\n async fetchDisclaimers({\n country,\n }: {\n country: string;\n }): Promise<KycDisclaimer[]> {\n const url = new URL('/vendors/moonpay/disclaimers', this.#baseUrl);\n url.searchParams.set('country', country);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:fetchDisclaimers`, 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 access token, 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 url = new URL('/vendors/moonpay/kyc-required', this.#baseUrl);\n const capabilities = params.capabilities ?? [{ product: 'ramps' }];\n const data = await this.fetchQuery({\n queryKey: [\n `${this.name}:checkKycRequired`,\n params.accessToken,\n params.country,\n capabilities,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n accessToken: params.accessToken,\n country: params.country,\n capabilities,\n }),\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 * Requests a per-session wrapping key from the UKYC backend.\n *\n * The client sends its ephemeral X25519 public key; the backend responds with\n * its session public key (`sessionServerPublicKey`) and a `jwtChain` that\n * attests it. The caller must verify `jwtChain` against the Fractal JWKS\n * (see {@link KycService.fetchJwks}) before trusting the key to wrap the\n * `data_encryption_key`.\n *\n * @param params - The parameters.\n * @param params.sessionClientPublicKey - Our ephemeral X25519 public key\n * (base64url).\n * @returns The wrapping key id, `jwtChain`, and session server public key.\n */\n async getWrappingKey(\n params: GetWrappingKeyParams,\n ): Promise<WrappingKeyResponse> {\n const url = new URL('/wrapping-key', this.#baseUrl);\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:getWrappingKey`, params.sessionClientPublicKey],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n sessionClientPublicKey: params.sessionClientPublicKey,\n }),\n }),\n // A per-session key exchange must always run fresh.\n staleTime: 0,\n gcTime: 0,\n });\n return this.#validateResponse(\n data,\n WrappingKeyResponseStruct,\n 'wrapping-key',\n );\n }\n\n /**\n * Fetches the Fractal encryption service JWKS used to verify the `jwtChain`\n * returned by {@link KycService.getWrappingKey}.\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 the wrapping key.',\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 * handing over the wrapped `data_encryption_key` and the client-signed,\n * read-only `ukyc_capability_token` that authorizes later storage access for\n * the session.\n *\n * @param params - The session parameters.\n * @returns The UKYC session identifiers.\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: [\n `${this.name}:createUkycSession`,\n params.wrappedEncryptionKey.sessionId,\n ],\n queryFn: async () =>\n this.#requestJson(url, {\n method: 'POST',\n body: JSON.stringify({\n vendorId: 'moonpay',\n vendorUserId: 'mockedId',\n jwtToken: params.jwtToken,\n vendorMetadata: params.vendorMetadata,\n wrappedEncryptionKey: params.wrappedEncryptionKey,\n ukycCapabilityToken: encodeStorageAccessTokenForHeader(\n params.ukycCapabilityToken,\n ),\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 * 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 assert(bearerToken, string());\n headers.Authorization = `Bearer ${bearerToken}`;\n }\n\n const response = await fetch(url.toString(), {\n ...init,\n headers,\n });\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Fetching '${url.toString()}' failed with status '${response.status}'`,\n );\n }\n\n return (await response.json()) as Json;\n }\n}\n"]}
|
package/dist/KycService.d.cts
CHANGED
|
@@ -7,7 +7,7 @@ import type { AuthenticationControllerGetBearerTokenAction } from "@metamask/pro
|
|
|
7
7
|
import type { Infer, Struct } from "@metamask/superstruct";
|
|
8
8
|
import type { QueryClientConfig } from "@tanstack/query-core";
|
|
9
9
|
import type { KycServiceMethodActions } from "./KycService-method-action-types.cjs";
|
|
10
|
-
import type { KycDisclaimer, KycSessionStatus
|
|
10
|
+
import type { KycDisclaimer, KycSessionStatus } from "./types.cjs";
|
|
11
11
|
import type { UkycStorageAccessToken } from "./ukyc/storageAccessToken.cjs";
|
|
12
12
|
/**
|
|
13
13
|
* The name of the {@link KycService}, used to namespace the service's actions.
|
|
@@ -52,25 +52,16 @@ export type KycServiceMessenger = Messenger<typeof serviceName, KycServiceAction
|
|
|
52
52
|
export type KycServiceOptions = {
|
|
53
53
|
messenger: KycServiceMessenger;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* `fetch`, so consumers do not need to inject one on platforms where `fetch`
|
|
57
|
-
* is available globally (browser, React Native, Node 18+).
|
|
58
|
-
*/
|
|
59
|
-
fetch?: typeof fetch;
|
|
60
|
-
/**
|
|
61
|
-
* Mandatory value that sets the base url to KYC api
|
|
55
|
+
* Base url of the KYC api
|
|
62
56
|
*/
|
|
63
57
|
baseUrl: string;
|
|
64
58
|
/**
|
|
65
|
-
* Base URL of the Fractal encryption
|
|
66
|
-
* verify the `jwtChain` returned by {@link KycService.getWrappingKey} is
|
|
67
|
-
* fetched. Required to run the wrapping-key exchange in
|
|
68
|
-
* {@link KycService.fetchJwks}.
|
|
59
|
+
* Base URL of the Fractal encryption api
|
|
69
60
|
*/
|
|
70
|
-
fractalEncryptionBaseUrl
|
|
61
|
+
fractalEncryptionBaseUrl: string;
|
|
71
62
|
/**
|
|
72
63
|
* Shared configuration applied to all queries exposed by the service (e.g. a
|
|
73
|
-
* default `staleTime`/`
|
|
64
|
+
* default `staleTime`/`gcTime`). Each data service gets its own
|
|
74
65
|
* `QueryClient`.
|
|
75
66
|
*/
|
|
76
67
|
queryClientConfig?: QueryClientConfig;
|
|
@@ -147,53 +138,18 @@ declare const ApplicantAccessTokenResponseStruct: Struct<{
|
|
|
147
138
|
applicantAccessToken: Struct<string, null>;
|
|
148
139
|
}>;
|
|
149
140
|
export type ApplicantAccessTokenResponse = Infer<typeof ApplicantAccessTokenResponseStruct>;
|
|
150
|
-
declare const VendorCustomerResponseStruct: Struct<{
|
|
151
|
-
id: string;
|
|
152
|
-
status: string;
|
|
153
|
-
email: string;
|
|
154
|
-
}, {
|
|
155
|
-
id: Struct<string, null>;
|
|
156
|
-
email: Struct<string, null>;
|
|
157
|
-
status: Struct<string, null>;
|
|
158
|
-
}>;
|
|
159
|
-
export type VendorCustomerResponse = Infer<typeof VendorCustomerResponseStruct>;
|
|
160
141
|
export type CreateSessionParams = {
|
|
161
142
|
email: string;
|
|
162
143
|
termsAcceptedAt: string;
|
|
163
144
|
disclaimerIds: string[];
|
|
164
145
|
};
|
|
165
146
|
export type CheckKycRequiredParams = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* Check/Auth path.
|
|
169
|
-
*/
|
|
170
|
-
vendor?: KycVendor;
|
|
171
|
-
/**
|
|
172
|
-
* MoonPay access token. Required when `vendor` is `moonpay` (or omitted).
|
|
173
|
-
*/
|
|
174
|
-
accessToken?: string;
|
|
175
|
-
/**
|
|
176
|
-
* ISO 3166-1 alpha-3 country code. Required when `vendor` is `moonpay`.
|
|
177
|
-
*/
|
|
178
|
-
country?: string;
|
|
147
|
+
accessToken: string;
|
|
148
|
+
country: string;
|
|
179
149
|
capabilities?: {
|
|
180
150
|
product: string;
|
|
181
151
|
}[];
|
|
182
152
|
};
|
|
183
|
-
export type CreateVendorCustomerParams = {
|
|
184
|
-
vendor: KycVendor;
|
|
185
|
-
email: string;
|
|
186
|
-
};
|
|
187
|
-
export type SubmitConsentsParams = {
|
|
188
|
-
/**
|
|
189
|
-
* Vendor disclaimer ids the customer accepted (T&C1). Mapped to the UKYC
|
|
190
|
-
* wire field `ironDisclaimerIds` for the Money/VBA consents contract.
|
|
191
|
-
*/
|
|
192
|
-
disclaimerIds: string[];
|
|
193
|
-
sumsubTncSigned: boolean;
|
|
194
|
-
idosTncSigned: boolean;
|
|
195
|
-
kycLevel?: 'standard';
|
|
196
|
-
};
|
|
197
153
|
export type GetWrappingKeyParams = {
|
|
198
154
|
sessionClientPublicKey: string;
|
|
199
155
|
};
|
|
@@ -209,17 +165,7 @@ export type WrappedEncryptionKey = {
|
|
|
209
165
|
};
|
|
210
166
|
export type CreateUkycSessionParams = {
|
|
211
167
|
jwtToken: string;
|
|
212
|
-
|
|
213
|
-
* Identity vendor for the UKYC session. Defaults to `moonpay` for the
|
|
214
|
-
* existing Check/Auth flow. Pass a non-MoonPay vendor (e.g. `iron`) for
|
|
215
|
-
* the consents path (no MoonPay metadata required).
|
|
216
|
-
*/
|
|
217
|
-
vendor?: KycVendor;
|
|
218
|
-
/**
|
|
219
|
-
* Vendor-specific metadata. Required for MoonPay (`moonPayAccessToken` /
|
|
220
|
-
* `moonPayUserId`); optional / omitted for other vendors.
|
|
221
|
-
*/
|
|
222
|
-
vendorMetadata?: Record<string, unknown>;
|
|
168
|
+
vendorMetadata: Record<string, unknown>;
|
|
223
169
|
wrappedEncryptionKey: WrappedEncryptionKey;
|
|
224
170
|
/**
|
|
225
171
|
* The client-signed `ukyc_capability_token` (envelope: payload + Ed25519
|
|
@@ -237,16 +183,15 @@ export type GetSessionStatusParams = {
|
|
|
237
183
|
/**
|
|
238
184
|
* `KycService` communicates with the Universal KYC (UKYC) backend to drive the
|
|
239
185
|
* identity + document-verification flow. It is stateless and platform-agnostic:
|
|
240
|
-
* HTTP is performed through the
|
|
241
|
-
*
|
|
242
|
-
* other controllers via the messenger.
|
|
186
|
+
* HTTP is performed through the global `fetch`, and the auth bearer token and
|
|
187
|
+
* geolocation come from other controllers via the messenger.
|
|
243
188
|
*
|
|
244
189
|
* It extends {@link BaseDataService}, so every request is routed through
|
|
245
190
|
* `fetchQuery`: it is wrapped in the shared service policy (retries, circuit
|
|
246
191
|
* breaker) and its result is exposed via the service's `QueryClient`. Read-only
|
|
247
192
|
* endpoints (`fetchDisclaimers`, `fetchJwks`) are cached with a `staleTime`;
|
|
248
193
|
* the session-creating and status-polling endpoints opt out of caching
|
|
249
|
-
* (`staleTime`/`
|
|
194
|
+
* (`staleTime`/`gcTime` of `0`) so they never serve a stale result.
|
|
250
195
|
*/
|
|
251
196
|
export declare class KycService extends BaseDataService<typeof serviceName, KycServiceMessenger> {
|
|
252
197
|
#private;
|
|
@@ -255,8 +200,6 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
255
200
|
*
|
|
256
201
|
* @param options - The constructor options.
|
|
257
202
|
* @param options.messenger - The messenger suited for this service.
|
|
258
|
-
* @param options.fetch - A function used to make HTTP requests. Defaults to
|
|
259
|
-
* the runtime's native `fetch`.
|
|
260
203
|
* @param options.baseUrl - Base URL of the KYC API
|
|
261
204
|
* @param options.fractalEncryptionBaseUrl - Base URL of the Fractal
|
|
262
205
|
* encryption service, from which the JWKS used to verify the wrapping-key
|
|
@@ -265,7 +208,7 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
265
208
|
* exposed by the service.
|
|
266
209
|
* @param options.policyOptions - Options for the request service policy.
|
|
267
210
|
*/
|
|
268
|
-
constructor({ messenger,
|
|
211
|
+
constructor({ messenger, baseUrl, fractalEncryptionBaseUrl, queryClientConfig, policyOptions, }: KycServiceOptions);
|
|
269
212
|
/**
|
|
270
213
|
* Resolves the customer's country from the geolocation source and converts it
|
|
271
214
|
* to an ISO 3166-1 alpha-3 code.
|
|
@@ -279,12 +222,10 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
279
222
|
* created.
|
|
280
223
|
*
|
|
281
224
|
* @param params - The parameters.
|
|
282
|
-
* @param params.vendor - Identity vendor. Defaults to `moonpay`.
|
|
283
225
|
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
284
226
|
* @returns The disclaimers.
|
|
285
227
|
*/
|
|
286
|
-
fetchDisclaimers({
|
|
287
|
-
vendor?: KycVendor;
|
|
228
|
+
fetchDisclaimers({ country, }: {
|
|
288
229
|
country: string;
|
|
289
230
|
}): Promise<KycDisclaimer[]>;
|
|
290
231
|
/**
|
|
@@ -295,7 +236,7 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
295
236
|
*/
|
|
296
237
|
createSession(params: CreateSessionParams): Promise<Infer<typeof CreateSessionResponseStruct>>;
|
|
297
238
|
/**
|
|
298
|
-
* Checks whether KYC is required for the given
|
|
239
|
+
* Checks whether KYC is required for the given access token, country, and
|
|
299
240
|
* capabilities.
|
|
300
241
|
*
|
|
301
242
|
* @param params - The check parameters.
|
|
@@ -304,32 +245,6 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
304
245
|
checkKycRequired(params: CheckKycRequiredParams): Promise<{
|
|
305
246
|
kycRequired: boolean;
|
|
306
247
|
}>;
|
|
307
|
-
/**
|
|
308
|
-
* Creates (or resumes) an empty-shell customer for the authenticated
|
|
309
|
-
* canonical user on the given identity vendor. Must run before showing
|
|
310
|
-
* vendor T&C so the customer exists and resume logic can key off vendor
|
|
311
|
-
* status.
|
|
312
|
-
*
|
|
313
|
-
* @param params - The parameters.
|
|
314
|
-
* @param params.vendor - Identity vendor (e.g. `iron` for Money/VBA).
|
|
315
|
-
* @param params.email - Email associated with the customer.
|
|
316
|
-
* @returns The vendor customer record (subset validated for controller use).
|
|
317
|
-
*/
|
|
318
|
-
createVendorCustomer(params: CreateVendorCustomerParams): Promise<VendorCustomerResponse>;
|
|
319
|
-
/**
|
|
320
|
-
* Posts T&C1 (vendor signings) and T&C2 (Sumsub + idOS) consents for the
|
|
321
|
-
* authenticated user. The API responds with 204 No Content on success.
|
|
322
|
-
*
|
|
323
|
-
* @param params - The consent parameters.
|
|
324
|
-
*/
|
|
325
|
-
submitConsents(params: SubmitConsentsParams): Promise<void>;
|
|
326
|
-
/**
|
|
327
|
-
* Fetches the user-keyed simplified KYC status used by Money toast / banner
|
|
328
|
-
* surfaces (`GET /kyc/status`).
|
|
329
|
-
*
|
|
330
|
-
* @returns The simplified status payload.
|
|
331
|
-
*/
|
|
332
|
-
fetchKycStatus(): Promise<KycUserStatusResponse>;
|
|
333
248
|
/**
|
|
334
249
|
* Requests a per-session wrapping key from the UKYC backend.
|
|
335
250
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService.d.cts","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oCAAoC;AAC9D,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,oCAAoC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC;AAE7E,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;
|
|
1
|
+
{"version":3,"file":"KycService.d.cts","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oCAAoC;AAC9D,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,oCAAoC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC;AAE7E,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;AAY3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,6BAA6B;AAG9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,6CAA4C;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAmB;AAGlE,OAAO,KAAK,EAAE,sBAAsB,EAAE,sCAAqC;AAI3E;;GAEG;AACH,eAAO,MAAM,WAAW,eAAe,CAAC;AAgBxC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAC3C,kCAAkC,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzD;;GAEG;AACH,M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OAAO,CAAC,MAAM,CAAC;IA0BtC;;;;;;;OAOG;IACG,gBAAgB,CAAC,EACrB,OAAO,GACR,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAe5B;;;;;OAKG;IACG,aAAa,CACjB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;IAyBrD;;;;;;OAMG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;IA+BpC;;;;;;;;;;;;;OAaG;IACG,cAAc,CAClB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,mBAAmB,CAAC;IAsB/B;;;;;;;;OAQG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAgBxC;;;;;;;;OAQG;IACG,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,CAAC;IAgC/B;;;;;;OAMG;IACG,aAAa,CACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,4BAA4B,CAAC;IAmBxC;;;;;;;OAOG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;CA2G7B"}
|
package/dist/KycService.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import type { AuthenticationControllerGetBearerTokenAction } from "@metamask/pro
|
|
|
7
7
|
import type { Infer, Struct } from "@metamask/superstruct";
|
|
8
8
|
import type { QueryClientConfig } from "@tanstack/query-core";
|
|
9
9
|
import type { KycServiceMethodActions } from "./KycService-method-action-types.mjs";
|
|
10
|
-
import type { KycDisclaimer, KycSessionStatus
|
|
10
|
+
import type { KycDisclaimer, KycSessionStatus } from "./types.mjs";
|
|
11
11
|
import type { UkycStorageAccessToken } from "./ukyc/storageAccessToken.mjs";
|
|
12
12
|
/**
|
|
13
13
|
* The name of the {@link KycService}, used to namespace the service's actions.
|
|
@@ -52,25 +52,16 @@ export type KycServiceMessenger = Messenger<typeof serviceName, KycServiceAction
|
|
|
52
52
|
export type KycServiceOptions = {
|
|
53
53
|
messenger: KycServiceMessenger;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* `fetch`, so consumers do not need to inject one on platforms where `fetch`
|
|
57
|
-
* is available globally (browser, React Native, Node 18+).
|
|
58
|
-
*/
|
|
59
|
-
fetch?: typeof fetch;
|
|
60
|
-
/**
|
|
61
|
-
* Mandatory value that sets the base url to KYC api
|
|
55
|
+
* Base url of the KYC api
|
|
62
56
|
*/
|
|
63
57
|
baseUrl: string;
|
|
64
58
|
/**
|
|
65
|
-
* Base URL of the Fractal encryption
|
|
66
|
-
* verify the `jwtChain` returned by {@link KycService.getWrappingKey} is
|
|
67
|
-
* fetched. Required to run the wrapping-key exchange in
|
|
68
|
-
* {@link KycService.fetchJwks}.
|
|
59
|
+
* Base URL of the Fractal encryption api
|
|
69
60
|
*/
|
|
70
|
-
fractalEncryptionBaseUrl
|
|
61
|
+
fractalEncryptionBaseUrl: string;
|
|
71
62
|
/**
|
|
72
63
|
* Shared configuration applied to all queries exposed by the service (e.g. a
|
|
73
|
-
* default `staleTime`/`
|
|
64
|
+
* default `staleTime`/`gcTime`). Each data service gets its own
|
|
74
65
|
* `QueryClient`.
|
|
75
66
|
*/
|
|
76
67
|
queryClientConfig?: QueryClientConfig;
|
|
@@ -147,53 +138,18 @@ declare const ApplicantAccessTokenResponseStruct: Struct<{
|
|
|
147
138
|
applicantAccessToken: Struct<string, null>;
|
|
148
139
|
}>;
|
|
149
140
|
export type ApplicantAccessTokenResponse = Infer<typeof ApplicantAccessTokenResponseStruct>;
|
|
150
|
-
declare const VendorCustomerResponseStruct: Struct<{
|
|
151
|
-
id: string;
|
|
152
|
-
status: string;
|
|
153
|
-
email: string;
|
|
154
|
-
}, {
|
|
155
|
-
id: Struct<string, null>;
|
|
156
|
-
email: Struct<string, null>;
|
|
157
|
-
status: Struct<string, null>;
|
|
158
|
-
}>;
|
|
159
|
-
export type VendorCustomerResponse = Infer<typeof VendorCustomerResponseStruct>;
|
|
160
141
|
export type CreateSessionParams = {
|
|
161
142
|
email: string;
|
|
162
143
|
termsAcceptedAt: string;
|
|
163
144
|
disclaimerIds: string[];
|
|
164
145
|
};
|
|
165
146
|
export type CheckKycRequiredParams = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* Check/Auth path.
|
|
169
|
-
*/
|
|
170
|
-
vendor?: KycVendor;
|
|
171
|
-
/**
|
|
172
|
-
* MoonPay access token. Required when `vendor` is `moonpay` (or omitted).
|
|
173
|
-
*/
|
|
174
|
-
accessToken?: string;
|
|
175
|
-
/**
|
|
176
|
-
* ISO 3166-1 alpha-3 country code. Required when `vendor` is `moonpay`.
|
|
177
|
-
*/
|
|
178
|
-
country?: string;
|
|
147
|
+
accessToken: string;
|
|
148
|
+
country: string;
|
|
179
149
|
capabilities?: {
|
|
180
150
|
product: string;
|
|
181
151
|
}[];
|
|
182
152
|
};
|
|
183
|
-
export type CreateVendorCustomerParams = {
|
|
184
|
-
vendor: KycVendor;
|
|
185
|
-
email: string;
|
|
186
|
-
};
|
|
187
|
-
export type SubmitConsentsParams = {
|
|
188
|
-
/**
|
|
189
|
-
* Vendor disclaimer ids the customer accepted (T&C1). Mapped to the UKYC
|
|
190
|
-
* wire field `ironDisclaimerIds` for the Money/VBA consents contract.
|
|
191
|
-
*/
|
|
192
|
-
disclaimerIds: string[];
|
|
193
|
-
sumsubTncSigned: boolean;
|
|
194
|
-
idosTncSigned: boolean;
|
|
195
|
-
kycLevel?: 'standard';
|
|
196
|
-
};
|
|
197
153
|
export type GetWrappingKeyParams = {
|
|
198
154
|
sessionClientPublicKey: string;
|
|
199
155
|
};
|
|
@@ -209,17 +165,7 @@ export type WrappedEncryptionKey = {
|
|
|
209
165
|
};
|
|
210
166
|
export type CreateUkycSessionParams = {
|
|
211
167
|
jwtToken: string;
|
|
212
|
-
|
|
213
|
-
* Identity vendor for the UKYC session. Defaults to `moonpay` for the
|
|
214
|
-
* existing Check/Auth flow. Pass a non-MoonPay vendor (e.g. `iron`) for
|
|
215
|
-
* the consents path (no MoonPay metadata required).
|
|
216
|
-
*/
|
|
217
|
-
vendor?: KycVendor;
|
|
218
|
-
/**
|
|
219
|
-
* Vendor-specific metadata. Required for MoonPay (`moonPayAccessToken` /
|
|
220
|
-
* `moonPayUserId`); optional / omitted for other vendors.
|
|
221
|
-
*/
|
|
222
|
-
vendorMetadata?: Record<string, unknown>;
|
|
168
|
+
vendorMetadata: Record<string, unknown>;
|
|
223
169
|
wrappedEncryptionKey: WrappedEncryptionKey;
|
|
224
170
|
/**
|
|
225
171
|
* The client-signed `ukyc_capability_token` (envelope: payload + Ed25519
|
|
@@ -237,16 +183,15 @@ export type GetSessionStatusParams = {
|
|
|
237
183
|
/**
|
|
238
184
|
* `KycService` communicates with the Universal KYC (UKYC) backend to drive the
|
|
239
185
|
* identity + document-verification flow. It is stateless and platform-agnostic:
|
|
240
|
-
* HTTP is performed through the
|
|
241
|
-
*
|
|
242
|
-
* other controllers via the messenger.
|
|
186
|
+
* HTTP is performed through the global `fetch`, and the auth bearer token and
|
|
187
|
+
* geolocation come from other controllers via the messenger.
|
|
243
188
|
*
|
|
244
189
|
* It extends {@link BaseDataService}, so every request is routed through
|
|
245
190
|
* `fetchQuery`: it is wrapped in the shared service policy (retries, circuit
|
|
246
191
|
* breaker) and its result is exposed via the service's `QueryClient`. Read-only
|
|
247
192
|
* endpoints (`fetchDisclaimers`, `fetchJwks`) are cached with a `staleTime`;
|
|
248
193
|
* the session-creating and status-polling endpoints opt out of caching
|
|
249
|
-
* (`staleTime`/`
|
|
194
|
+
* (`staleTime`/`gcTime` of `0`) so they never serve a stale result.
|
|
250
195
|
*/
|
|
251
196
|
export declare class KycService extends BaseDataService<typeof serviceName, KycServiceMessenger> {
|
|
252
197
|
#private;
|
|
@@ -255,8 +200,6 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
255
200
|
*
|
|
256
201
|
* @param options - The constructor options.
|
|
257
202
|
* @param options.messenger - The messenger suited for this service.
|
|
258
|
-
* @param options.fetch - A function used to make HTTP requests. Defaults to
|
|
259
|
-
* the runtime's native `fetch`.
|
|
260
203
|
* @param options.baseUrl - Base URL of the KYC API
|
|
261
204
|
* @param options.fractalEncryptionBaseUrl - Base URL of the Fractal
|
|
262
205
|
* encryption service, from which the JWKS used to verify the wrapping-key
|
|
@@ -265,7 +208,7 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
265
208
|
* exposed by the service.
|
|
266
209
|
* @param options.policyOptions - Options for the request service policy.
|
|
267
210
|
*/
|
|
268
|
-
constructor({ messenger,
|
|
211
|
+
constructor({ messenger, baseUrl, fractalEncryptionBaseUrl, queryClientConfig, policyOptions, }: KycServiceOptions);
|
|
269
212
|
/**
|
|
270
213
|
* Resolves the customer's country from the geolocation source and converts it
|
|
271
214
|
* to an ISO 3166-1 alpha-3 code.
|
|
@@ -279,12 +222,10 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
279
222
|
* created.
|
|
280
223
|
*
|
|
281
224
|
* @param params - The parameters.
|
|
282
|
-
* @param params.vendor - Identity vendor. Defaults to `moonpay`.
|
|
283
225
|
* @param params.country - ISO 3166-1 alpha-3 country code.
|
|
284
226
|
* @returns The disclaimers.
|
|
285
227
|
*/
|
|
286
|
-
fetchDisclaimers({
|
|
287
|
-
vendor?: KycVendor;
|
|
228
|
+
fetchDisclaimers({ country, }: {
|
|
288
229
|
country: string;
|
|
289
230
|
}): Promise<KycDisclaimer[]>;
|
|
290
231
|
/**
|
|
@@ -295,7 +236,7 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
295
236
|
*/
|
|
296
237
|
createSession(params: CreateSessionParams): Promise<Infer<typeof CreateSessionResponseStruct>>;
|
|
297
238
|
/**
|
|
298
|
-
* Checks whether KYC is required for the given
|
|
239
|
+
* Checks whether KYC is required for the given access token, country, and
|
|
299
240
|
* capabilities.
|
|
300
241
|
*
|
|
301
242
|
* @param params - The check parameters.
|
|
@@ -304,32 +245,6 @@ export declare class KycService extends BaseDataService<typeof serviceName, KycS
|
|
|
304
245
|
checkKycRequired(params: CheckKycRequiredParams): Promise<{
|
|
305
246
|
kycRequired: boolean;
|
|
306
247
|
}>;
|
|
307
|
-
/**
|
|
308
|
-
* Creates (or resumes) an empty-shell customer for the authenticated
|
|
309
|
-
* canonical user on the given identity vendor. Must run before showing
|
|
310
|
-
* vendor T&C so the customer exists and resume logic can key off vendor
|
|
311
|
-
* status.
|
|
312
|
-
*
|
|
313
|
-
* @param params - The parameters.
|
|
314
|
-
* @param params.vendor - Identity vendor (e.g. `iron` for Money/VBA).
|
|
315
|
-
* @param params.email - Email associated with the customer.
|
|
316
|
-
* @returns The vendor customer record (subset validated for controller use).
|
|
317
|
-
*/
|
|
318
|
-
createVendorCustomer(params: CreateVendorCustomerParams): Promise<VendorCustomerResponse>;
|
|
319
|
-
/**
|
|
320
|
-
* Posts T&C1 (vendor signings) and T&C2 (Sumsub + idOS) consents for the
|
|
321
|
-
* authenticated user. The API responds with 204 No Content on success.
|
|
322
|
-
*
|
|
323
|
-
* @param params - The consent parameters.
|
|
324
|
-
*/
|
|
325
|
-
submitConsents(params: SubmitConsentsParams): Promise<void>;
|
|
326
|
-
/**
|
|
327
|
-
* Fetches the user-keyed simplified KYC status used by Money toast / banner
|
|
328
|
-
* surfaces (`GET /kyc/status`).
|
|
329
|
-
*
|
|
330
|
-
* @returns The simplified status payload.
|
|
331
|
-
*/
|
|
332
|
-
fetchKycStatus(): Promise<KycUserStatusResponse>;
|
|
333
248
|
/**
|
|
334
249
|
* Requests a per-session wrapping key from the UKYC backend.
|
|
335
250
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KycService.d.mts","sourceRoot":"","sources":["../src/KycService.ts"],"names":[],"mappings":"AAAA,O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