onfido-sdk-ui
Version:
JavaScript SDK view layer for Onfido identity verification
122 lines (121 loc) • 3.72 kB
TypeScript
export declare type EnterpriseCallbackResponse<T> = {
continueWithOnfidoSubmission?: boolean;
onfidoSuccessResponse?: T;
};
export type Common = {
sdk_metadata: string;
sdk_source: string;
sdk_version: string;
};
export type SubmitDocument = {
file: Blob;
side: DocumentSides;
type: string;
sdk_validations: string;
} & Common;
export type SubmitSelfie = {
file: Blob;
snapshot: {
blob: Blob;
filename: string;
};
};
export type SubmitVideo = {
file: Blob;
challenge: string;
challenge_id: string;
challenge_switch_at: number | undefined;
languages: string;
};
export declare type ImageQualityValidationTypes = 'detect_barcode' | 'detect_document' | 'detect_cutoff' | 'detect_glare' | 'detect_blur';
export declare type ImageQualityWarnings = Partial<Record<ImageQualityValidationTypes, {
valid: boolean;
}>>;
export declare type UploadFileResponse = {
id: string;
created_at: string;
file_name: string;
file_type: string;
file_size: number;
href: string;
download_href: string;
};
type Score = {
min: number;
max: number;
threshold: number;
};
export declare type DocumentSides = 'front' | 'back';
export declare type DocumentType = 'driving_licence' | 'national_identity_card' | 'residence_permit' | 'passport';
export declare type DocumentImageResponse = {
applicant_id: string;
type: DocumentType;
side: DocumentSides;
issuing_country: string;
sdk_warnings: ImageQualityWarnings & {
image_quality: {
quality: string;
breakdown: {
document: {
has_document: boolean;
detection_score: number;
} & Score;
has_document: boolean;
cutoff: {
has_cutoff: boolean;
score: number;
} & Score;
blur: {
has_blur: boolean;
score: number;
blur_model: string;
} & Score;
glare: {
score: number;
bbox: [number, number, number, number];
has_glare: boolean;
threshold: number;
glare_model: string;
};
barcode: {
result: string;
properties: Record<string, string>;
};
};
image_quality_uuid: string;
};
};
classification: {
issuing_country: null;
document_version: null;
side?: DocumentSides;
document_type?: DocumentType;
};
document_features: {
has_nfc: boolean;
};
} & UploadFileResponse;
export declare type VideoChallengeLanguage = {
source: string;
language_code: string;
};
export declare type ChallengePayload = {
type: 'recite';
query: number[];
} | {
type: 'movement';
query: string;
};
export declare type FaceVideoResponse = {
challenge: ChallengePayload[];
languages: VideoChallengeLanguage[];
} & UploadFileResponse;
export type CustomCallbackFormatterType = 'raw' | 'formData';
export type EnterpriseFeatureCallback = {
useCustomizedApiRequests?: boolean;
formatter?: CustomCallbackFormatterType;
onSubmitDocument?: (data: FormData | SubmitDocument) => Promise<EnterpriseCallbackResponse<DocumentImageResponse>>;
onSubmitSelfie?: (data: FormData | SubmitSelfie) => Promise<EnterpriseCallbackResponse<UploadFileResponse>>;
onSubmitVideo?: (data: FormData | SubmitVideo) => Promise<EnterpriseCallbackResponse<FaceVideoResponse>>;
};
export {};