@privateid/cryptonets-web-sdk
Version:
CryptoNets WebAssembly SDK
293 lines (292 loc) • 8.84 kB
TypeScript
import { CameraFaceMode, FaceStatuses } from './types';
declare let faceMode: CameraFaceMode;
interface deleteUser {
uuid: string;
callback: (result: any) => void;
}
export declare const deleteUser: ({ uuid, callback }: deleteUser) => Promise<void>;
interface openCameraProps {
videoElementId: string;
deviceId?: string;
requestFaceMode?: CameraFaceMode;
canvasResolution?: {
width: number;
height: number;
};
isDocumentScan?: boolean;
}
export declare const openCamera: ({ videoElementId, deviceId, requestFaceMode, canvasResolution, isDocumentScan, }: openCameraProps) => Promise<{
stream: MediaStream | null;
devices: MediaDeviceInfo[] | null;
faceMode: CameraFaceMode | null;
settings: MediaTrackSettings | null;
status: boolean;
errorMessage?: string | null;
capabilities: MediaTrackCapabilities | null;
}>;
/**
* This function open camera, and returns the stream, current faceMode and the list of available media devices
* @category Face
* @param domElement id of the video tag
*/
export declare const closeCamera: (element: string | undefined) => Promise<void>;
/**
* This function switch camera from front to back on mobile, and to another device on desktop
* @category Face
* @param selectedCamera Selected camera either front or back
* @param device Selected camera ID
* @param canvasResolution
*/
export declare const switchCamera: (selectedCamera: CameraFaceMode | null, device: string, canvasResolution?: {
width: number;
height: number;
} | null) => Promise<{
capabilities: MediaTrackCapabilities | null;
settings: MediaTrackSettings | null;
} | null>;
export declare const isValid: ({ callback, image, config, }: {
callback: (result: any) => void;
image?: ImageData;
config?: {
[x: string]: any;
};
}) => Promise<ImageData | {
result: number;
} | {
result: string;
message: string;
} | {
result: string;
message?: undefined;
}>;
interface PredictAgeProps {
callback: (result: any) => void;
config?: {
[x: string]: any;
};
element?: string;
image?: ImageData;
}
export declare const predictAge: ({ callback, config, element, image, }: PredictAgeProps) => Promise<void | {
result: number | string;
}>;
export declare const predictImageAge: (image: ImageData, callback: any, config?: {
input_image_format: string;
}) => Promise<void | {
result: number | string;
}>;
interface frontScanInterface {
callback: (returnData: any) => void;
image?: ImageData;
config?: any;
}
export declare const scanFrontDocument: ({ callback, image, config }: frontScanInterface) => Promise<{
result: number;
croppedDocument: Uint8ClampedArray;
croppedMugshot: Uint8ClampedArray;
imageData: ImageData;
} | {
result: string;
} | {
result: number;
croppedDocument: Uint8ClampedArray;
croppedMugshot: Uint8ClampedArray;
} | {
result: number;
}>;
export declare const scanFrontDocumentOcrAge: ({ callback, image, config }: frontScanInterface) => Promise<{
result: number;
croppedDocument: Uint8ClampedArray;
croppedMugshot: Uint8ClampedArray;
imageData: ImageData;
} | {
result: string;
} | {
result: number;
croppedDocument: Uint8ClampedArray;
croppedMugshot: Uint8ClampedArray;
} | {
result: number;
}>;
interface backScanInterface {
callback: (returnData: any) => void;
image?: ImageData;
config?: any;
zoomFactor?: number;
}
export declare const backScanDocument: ({ callback, image, config, zoomFactor }: backScanInterface) => Promise<{
result: number;
croppedDocument: Uint8ClampedArray;
croppedBarcode: Uint8ClampedArray;
imageData: ImageData;
} | {
result: string;
} | {
result: number;
croppedDocument: Uint8ClampedArray;
} | {
result: number;
}>;
export declare const scanHealthcareCard: (callback?: any, config?: {
input_image_format: string;
document_scan_barcode_only?: string;
} | null, image?: ImageData, canvasSize?: {
width: number;
height: number;
} | Record<string, never>) => Promise<{
result: number;
croppedDocument: Uint8ClampedArray;
imageData: ImageData;
} | {
result: string;
} | {
result: number;
croppedDocument: Uint8ClampedArray;
} | {
result: number;
}>;
interface enrollProps {
callback: (result: any) => void;
config?: any;
element?: string;
image?: ImageData;
}
export declare function enroll({ callback, config, element, image }: enrollProps): Promise<{
result: number;
imageData: Uint8ClampedArray;
height: number;
width: number;
} | {
result: string;
}>;
/**
* This function performs faceLogin, the camera should already be open. the functions performs the identification and return the result. This function is more restrictive than predict1Fa.
* @category Face
* @param callback Callbacks triggered on the `predict` operation
* @param config Configuration recommeded default: { input_image_format: "rgba" }
* @param element Element id of video tag. (Optional) By default it uses the element id used when opening the camera using openCamera()
*/
interface FaceLoginProps {
callback: (result: any) => void;
config?: any;
element?: string;
returnPortrait?: boolean;
}
export declare const faceLogin: ({ callback, config, element, returnPortrait }: FaceLoginProps) => Promise<{
result: string;
imageData?: undefined;
response?: undefined;
} | {
imageData: ImageData;
response: {
result: number;
href: ImageData[];
};
result?: undefined;
} | {
response: {
result: number;
href: ImageData[];
};
result?: undefined;
imageData?: undefined;
}>;
/**
* This function performs predict, the camera should already be open. the functions performs the identification return the result then restart again.
* @category Face
* @param callback Callbacks triggered on the `predict` operation
* @param config Configuration recommeded default: { input_image_format: "rgba" }
* @param element Element id of video tag. (Optional) By default it uses the element id used when opening the camera using openCamera()
* @param image ImageData, If there is an image passed, it will be predicting the image instead of the video feed.
*/
interface PredictProps {
callback: (result: any) => void;
image?: ImageData;
config?: any;
element?: string;
returnPortrait?: boolean;
}
export declare const predict: ({ callback, image, config, element, returnPortrait }: PredictProps) => Promise<ImageData | {
result: number;
href: ImageData[];
} | {
result: string;
}>;
export declare const setStopLoopContinuousAuthentication: (loop: boolean) => void;
export declare function continuousAuthentication(callback: (input: {
status: FaceStatuses;
result?: number;
returnValue?: any;
progress?: number;
age?: number;
}) => void, config?: {
input_image_format: string;
}, element?: string): Promise<{
result: string;
}>;
export declare function continuousPredictWithoutRestrictions(callback: (input: any) => void, config?: {
input_image_format: string;
}, element?: string): Promise<{
result: string;
}>;
interface faceIsoProps {
callback: (result: any) => void;
config?: any;
}
export declare function faceISO({ callback, config }: faceIsoProps): Promise<{
result: string;
imageOutput?: undefined;
} | {
result: number;
imageOutput: Uint8ClampedArray;
}>;
export declare const faceCompareLocal: (callback: (input: {
result?: number;
}) => void, imageDataA: ImageData, imageDataB: ImageData, config?: {
input_image_format: string;
}) => Promise<{
result: number;
}>;
export declare const documentMugshotFaceCompare: (callback: (input: {
result?: number;
}) => void, imageDataA: ImageData, imageDataB: ImageData, config?: {
input_image_format: string;
}) => Promise<{
result: number;
}>;
export declare const twoStepFaceLogin: (callback: (input: {
status: FaceStatuses;
result?: number;
returnValue?: any;
}) => void, config?: any) => Promise<{
result: string;
message: string;
} | {
result: string;
message?: undefined;
}>;
export declare const multiframeTwoStepFaceLogin: ({ callback, config, frameCount, }: {
callback: (result: any) => void;
config?: any;
frameCount?: number;
}) => Promise<{
result: string;
message: string;
} | {
result: string;
message?: undefined;
}>;
export declare const multiframeFaceLogin: ({ callback, config, frameCount, }: {
callback: (result: any) => void;
config?: {
[x: string]: any;
};
frameCount?: number;
}) => Promise<{
result: string;
message: string;
} | {
result: string;
message?: undefined;
}>;
export {};