@biopassid/face-sdk-react-native
Version:
BioPass ID Face React Native module.
52 lines (51 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.closeRecognition = closeRecognition;
exports.extract = extract;
exports.startRecognition = startRecognition;
exports.verify = verify;
var _reactNative = require("react-native");
const LINKING_ERROR = `The package '@biopassid/face-sdk-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.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 = _reactNative.NativeModules.FaceSdkReactNative ? _reactNative.NativeModules.FaceSdkReactNative : new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
}
});
function startRecognition(licenseKey) {
try {
FaceSdkReactNative.startRecognition(licenseKey);
} catch (error) {
console.error(`Unknown error: ${error}`);
}
}
function closeRecognition() {
try {
FaceSdkReactNative.closeRecognition();
} catch (error) {
console.error(`Unknown error: ${error}`);
}
}
async function extract(artifact) {
try {
const extract = await FaceSdkReactNative.extract(artifact);
return extract;
} catch (error) {
console.error(`Unknown error: ${error}`);
return null;
}
}
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