type AddImagesResponse = { /** * Feedback for the submitted image */ feedback: AddImagesResponse.feedback; /** * Indicates whether all the images required for the verification check were received */ complete: boolean; /** * The additional image types that need to be added */ missing_images: Array<'document_front' | 'document_back' | 'selfie'>; /** * Custom feedback corresponding to the restricted criteria (as configured in the Admin Portal) */ custom_feedback?: string; /** * Indicates whether the document is expected to have a barcode */ has_barcode?: boolean; supported_barcode_symbologies?: string[]; }; declare namespace AddImagesResponse { /** * Feedback for the submitted image */ enum feedback { OK = "ok", OTHER = "other", DOCUMENT_NOT_FOUND = "document_not_found", FACE_NOT_FOUND = "face_not_found", DOCUMENT_FACE_NOT_FOUND = "document_face_not_found", OBSTRUCTED = "obstructed", BLUR = "blur", GLARE = "glare", DOCUMENT_NOT_SUPPORTED = "document_not_supported", DOCUMENT_NOT_MATCHING = "document_not_matching", WRONG_DOCUMENT_SIDE = "wrong_document_side", MULTI_FACE = "multi_face", FACE_ROTATED = "face_rotated", FACE_TOO_SMALL = "face_too_small", FACE_TOO_CLOSE = "face_too_close", CLOSED_EYES = "closed_eyes", FACE_ANGLE_TOO_LARGE = "face_angle_too_large", FACE_CLOSE_TO_BORDER = "face_close_to_border", FACE_OCCLUDED = "face_occluded", FACE_CROPPED = "face_cropped", BARCODE_NOT_FOUND = "barcode_not_found", GLARE_SELFIE = "glare_selfie", BLUR_SELFIE = "blur_selfie", RESTRICTED_CRITERIA = "restricted_criteria", UNCLASSIFIABLE = "unclassifiable" } } type Step = 'loading_screen' | 'init' | 'document_front' | 'document_back' | 'selfie' | 'processing' | 'error' | 'complete' | 'recapture'; type Errors = 'other' | 'camera-error' | 'camera-permission-dismissed' | 'camera-permission-denied' | 'trying-to-initialize-active-session' | 'unable-to-parse-data-uri' | 'failed-to-submit-image' | 'request-error' | 'session-expired'; interface CaptureItem { sessionId: string; type: 'document_front' | 'document_back' | 'selfie'; feedback: AddImagesResponse.feedback; } interface CaptureResult { captures: CaptureItem[]; } declare class CaptureError extends Error { errorCode: Errors; step: Step; constructor(errorCode: Errors, step: Step, message?: string); } /** * The `idv` module allows you to integrate identity verification services into your application. This allows you to * securely verify the identity of your customers using documents like their driver's license or passport. * * After the SDK is initialized, your app can start a verification flow by creating a session in the backend to establish * a secure context and then start the verification session by calling {@link module:tsPlatform.idv.start|start}. The SDK executes * the verification process with the user using the Transmit identity verification experience. Once all the required images are submitted, * Transmit starts processing the verification while the SDK polls for its status. Once processing is completed, the SDK notifies the app * so it can obtain the verification result (via the backend) and proceed accordingly. * @module tsPlatform.idv */ /** * Options for {@link captureDocument}. * @memberof module:tsPlatform.idv */ interface CaptureDocumentOptions { /** * Acquisition id obtained by calling the backend's * `POST /verify/api/v1/verification/{sessionId}/document-acquisition` endpoint. * The same id is used for both document_front and document_back uploads, including any retakes. */ acquisitionId: string; /** Optional callback invoked for each successful image capture. */ onCapture?: (result: CaptureItem) => void; } /** * Options for {@link captureSelfie}. * @memberof module:tsPlatform.idv */ interface CaptureSelfieOptions { /** * Acquisition id obtained by calling the backend's * `POST /verify/api/v1/verification/{sessionId}/selfie-acquisition` endpoint. */ acquisitionId: string; /** Optional callback invoked when the selfie is successfully captured. */ onCapture?: (result: CaptureItem) => void; } /** * Starts a verification session that was created in the backend (via the [Verification API](/openapi/verify/verifications/#operation/createSession)). * This will start the verification process for the user and guides them through the entire identity verification flow * using the Transmit identity verification experience, which includes capturing the required images and submitting them for processing. * @function start * @param {string} startToken - The start_token returned by the backend when the session was created, used to * bind the session to the device * @returns {Promise} Indicates if the session was started successfully * @memberof module:core * @example * const showLoader = true; * const startToken = '123456'; // start_token returned by the backend upon session creation * tsPlatform.idv.start(startToken).then((started) => { * showLoader = false; * if (started) { * console.log('Session started'); * } else { * console.log('Session not started'); * } * }); */ declare function start(startToken?: string): Promise; /** * Recaptures the required images in case the `recapture` status is returned. For example, this may occur in case some data * couldn't be extracted due to poor image quality. * @function recapture * @returns {Promise} Indicates if the session was started successfully * @memberof module:core * @example * const showLoader = true; * tsPlatform.idv.recapture().then((success) => { * showLoader = false; * if (success) { * console.log('Recapture started'); * } else { * console.log('Recapture not started'); * } * }); */ declare function recapture(): Promise; /** * Captures document images (front and back if needed). This method is only available when flowType is 'modular'. * Returns a Promise that resolves when the document capture sequence completes successfully. * * Requires an `acquisitionId` minted via the backend's * `POST /verify/api/v1/verification/{sessionId}/document-acquisition` endpoint. The same id is sent * with every image upload performed during the capture (front, back, retakes). * @function captureDocument * @param {CaptureDocumentOptions} options - Capture options including the required `acquisitionId` * and an optional `onCapture` callback called for each image submission attempt. * @returns {Promise} Promise that resolves with complete capture information * @throws {Error} If `acquisitionId` is missing, flowType is not 'modular', session is not active, * or the document step is not available * @memberof module:tsPlatform.idv * @example * // Mint an acquisition id from your backend, then pass it in: * const { acquisition_id } = await myBackend.createDocumentAcquisition(sessionId); * const result = await tsPlatform.idv.captureDocument({ acquisitionId: acquisition_id }); * console.log('Captured:', result.captures); * * // With callback for intermediate results (synchronous) * const result = await tsPlatform.idv.captureDocument({ * acquisitionId: acquisition_id, * onCapture: (capture) => { * console.log(`Captured ${capture.type} with feedback: ${capture.feedback}`); * }, * }); */ declare function captureDocument(options: CaptureDocumentOptions): Promise; /** * Captures a selfie image. This method is only available when flowType is 'modular'. * Returns a Promise that resolves when the selfie capture completes successfully. * * Requires an `acquisitionId` minted via the backend's * `POST /verify/api/v1/verification/{sessionId}/selfie-acquisition` endpoint. * @function captureSelfie * @param {CaptureSelfieOptions} options - Capture options including the required `acquisitionId` * and an optional `onCapture` callback. * @returns {Promise} Promise that resolves with complete capture information * @throws {Error} If `acquisitionId` is missing, flowType is not 'modular', session is not active, * or the selfie step is not available * @memberof module:tsPlatform.idv * @example * const { acquisition_id } = await myBackend.createSelfieAcquisition(sessionId); * const result = await tsPlatform.idv.captureSelfie({ acquisitionId: acquisition_id }); * console.log('Captured:', result.captures); */ declare function captureSelfie(options: CaptureSelfieOptions): Promise; declare const version: () => string; declare const PACKAGE_VERSION: string; declare function initialize(config: any): void; export { CaptureDocumentOptions, CaptureError, CaptureItem, CaptureResult, CaptureSelfieOptions, PACKAGE_VERSION, captureDocument, captureSelfie, initialize, recapture, start, version };