liveness-plugin
v0.0.5-alpha04
Published
Guardian Liveness Detection SDK React Native plugin.
Readme
liveness-plugin
Guardian Liveness Detection SDK React Native plugin.
Installation
npm install liveness-pluginUsage
import {
getSDKVersion,
initSDKOfLicense,
setLicenseAndCheck,
startLivenessDetection,
} from 'liveness-plugin';
// ...
// Get the SDK version
const version = await getSDKVersion();
// Initialize the SDK with market selection
initSDKOfLicense(SELECTED_MARKET);
// Set the license key and check if it's valid
const checkResult = await setLicenseAndCheck(YOUR_LICENSE_KEY);
if (checkResult === 'SUCCESS') {
startLivenessDetection();
}
// Start the liveness detection process
const livenessParams: LivenessParams = {
cameraType: 'FRONT',
detectOcclusion: false, // Whether to detect occlusion
auditImageConfig: {
enableCollectSwitch: true, // Whether to enable the collection switch
imageWidth: 400, // Image width
imageQuality: 30, // Image quality
relativeSecondsCaptureAfterCameraLaunched: 3.0, // Capture at a relative number of seconds after the camera is launched
},
livenessType: 'test_more', // Liveness detection type
signatureId: '', // Signature ID, if available
distantNearTimeout: 50000, // Timeout for distant-near detection in milliseconds
silentTimeout: 50000, // Timeout for silent detection in milliseconds
actionTimeout: 10000, // Timeout for actions in milliseconds
prepareMillSeconds: 0, // Preparation time in milliseconds
resultPictureSize: 600, // Result picture size
maxRecordVideoSeconds: 600, // Maximum video recording time in seconds
userId: '', // User ID, in JSON string format
maskColor: '#000000', // Mask color
ovalColor: '#000000', // Oval color
ovalNormalColor: '#000000', // Normal oval color
};
startLivenessDetection(livenessParams, (result) => {
console.log('Liveness detection result received:', result);
});
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library
