@biopassid/face-sdk-react-native
Version:
BioPass ID Face React Native module.
45 lines (44 loc) • 1.37 kB
JavaScript
;
import { NativeModules, Platform } from 'react-native';
const LINKING_ERROR = `The package '@biopassid/face-sdk-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
ios: "- You have run 'pod install'\n",
default: ''
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
const FaceSdkReactNative = NativeModules.FaceSdkReactNative ? NativeModules.FaceSdkReactNative : new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
}
});
export function startRecognition(licenseKey) {
try {
FaceSdkReactNative.startRecognition(licenseKey);
} catch (error) {
console.error(`Unknown error: ${error}`);
}
}
export function closeRecognition() {
try {
FaceSdkReactNative.closeRecognition();
} catch (error) {
console.error(`Unknown error: ${error}`);
}
}
export async function extract(artifact) {
try {
const extract = await FaceSdkReactNative.extract(artifact);
return extract;
} catch (error) {
console.error(`Unknown error: ${error}`);
return null;
}
}
export async function verify(templateA, templateB) {
try {
const verify = await FaceSdkReactNative.verify(templateA, templateB);
return verify;
} catch (error) {
console.error(`Unknown error: ${error}`);
return null;
}
}
//# sourceMappingURL=FaceRecognition.js.map