Plugin EcosystemHardware & Sensors
Biometrics
Authenticate users via FaceID, TouchID, and Android Biometric Prompt.
Biometrics Plugin
Secure your app by leveraging native biometric authentication (fingerprint, face recognition, etc.) to verify user identity before performing sensitive operations.
Installation
npm install @easycord/plugin-biometricsAPI Reference
authenticate(options: AuthOptions)
Prompts the user for biometric authentication.
Parameters
reason(string): The text shown to the user explaining why authentication is needed.allowDeviceCredential(boolean): Fall back to device PIN/password if biometrics fail.
Example Usage
import { useState } from 'react';
import { Biometrics } from '@easycord/plugin-biometrics';
export default function LoginScreen() {
const [authenticated, setAuthenticated] = useState(false);
const login = async () => {
try {
const { success } = await Biometrics.authenticate({
reason: 'Please authenticate to view your account balance',
allowDeviceCredential: true
});
setAuthenticated(success);
} catch (err) {
console.error('Biometric auth failed', err);
}
};
return (
<div className="p-4">
{!authenticated ? (
<button onClick={login} className="bg-indigo-600 text-white px-4 py-2 rounded">
Login with Biometrics
</button>
) : (
<p className="text-green-600 font-bold">Successfully Authenticated!</p>
)}
</div>
);
}