react-native-biometrics-face
v0.1.2
Published
Detect, Recognition face in offline
Downloads
351
Readme
react-native-biometrics-face
A powerful, offline face recognition and verification library for React Native.
It uses Google ML Kit for high-speed face detection and TensorFlow Lite (mobile_face_net) for accurate face recognition. It compares two face images and determines if they belong to the same person.
🚀 Features
- 100% Offline: No internet connection required. Your data stays on the device.
- Fast & Accurate: Uses mobile-optimized AI models.
- Privacy First: No images are sent to any cloud server.
- Cross Platform: Works on iOS (Swift) and Android (Kotlin).
- New Architecture Support: Fully compatible with React Native's New Architecture (Fabric) and the Old Architecture.
📦 Installation
yarn add react-native-biometrics-face
# or
npm install react-native-biometrics-faceiOS Setup
cd ios
pod installAndroid Setup
No additional setup is required. The library automatically links the necessary ML models.
📸 Permissions
This library processes Base64 images. It does not access the camera directly.
iOS (Info.plist)
<key>NSCameraUsageDescription</key>
<string>We need access to the camera to verify your identity.</string>Android (AndroidManifest.xml)
<uses-permission android:name="android.permission.CAMERA" />💻 Usage
import { verifyFaces } from 'react-native-biometrics-face';
const compareFaces = async (sourceImageBase64: string, targetImageBase64: string) => {
const response = await verifyFaces(sourceImageBase64, targetImageBase64);
if (response.result?.isMatch) {
console.log("Faces Match!", response.result.accuracy);
} else {
console.log("Faces Do Not Match");
}
};📄 Response Format
{
statusCode: number;
message: string;
result: {
isMatch: boolean;
distance: number;
accuracy: number;
} | null;
}🔧 Troubleshooting
- Model file not found (Android): Ensure assets are not stripped.
- iOS linker issues: Run
pod installagain. - Multiple faces detected: Ensure only one face is visible.
📜 License
MIT
Developed with ❤️ by Vasanth
