youverify-liveness-web
Version:
> Software Development Kit for [Youverify](https://youverify.co)'s Liveness Check
79 lines (63 loc) • 1.86 kB
TypeScript
declare interface Branding {
logo?: string;
color?: string;
}
declare type CompleteTheCircleTask = TaskBase<"complete-the-circle">;
declare interface LivenessData {
faceImage: string;
passed: boolean;
metadata?: Metadata;
}
declare interface LivenessWebSdkProps {
publicKey: string;
presentation?: Presentation;
tasks?: Array<Task>;
user?: User;
branding?: Branding;
allowAudio?: boolean;
onClose?: () => void;
onSuccess?: (data: LivenessData) => void;
onFailure?: (data: LivenessData) => void;
metadata?: Metadata;
sandboxEnvironment?: boolean;
}
declare type Metadata = Record<string, any>;
declare interface MotionsTask extends TaskBase<"motions"> {
maxNods?: number;
maxBlinks?: number;
}
declare type Presentation = "modal" | "page";
declare type Task = CompleteTheCircleTask | MotionsTask | YesOrNoTask;
declare interface TaskBase<T extends TaskId> {
id: T;
difficulty?: TaskDifficulty;
timeout?: number;
}
declare type TaskDifficulty = "easy" | "medium" | "hard";
declare type TaskId = "complete-the-circle" | "yes-or-no" | "facial-expressions" | "motions";
declare interface User {
firstName: string;
lastName?: string;
email?: string;
}
declare class WebSDK {
private tasks;
private container;
private namespace;
private props;
private presentation;
constructor(props: LivenessWebSdkProps);
private validateOptions;
start(tasks?: Array<Task>): Promise<void>;
close(): void;
}
export default WebSDK;
declare interface YesOrNoQuestion {
question: string;
answer: boolean;
errorMessage?: string;
}
declare interface YesOrNoTask extends TaskBase<"yes-or-no"> {
questions?: Array<YesOrNoQuestion>;
}
export { }