nitro-local-auth
nitro-local-auth adds biometric and device passcode authentication to NitroUI apps: Face ID, Touch ID and Optic ID on iOS, fingerprint, face and iris on Android. The API follows expo-local-authentication, and is built on Nitro 1.0 (nitro-core) calling the platform frameworks directly:
- iOS:
LocalAuthentication(LAContext). - Android: the framework
android.hardware.biometricsBiometricManagerandBiometricPrompt, with no AndroidX biometric dependency.
import { LocalAuthentication } from 'nitro-local-auth'
const result = await LocalAuthentication.authenticate({ promptMessage: 'Unlock your account' })
if (result.success) {
// Unlocked.
}
What it covers
| Capability | API |
|---|---|
| Hardware and enrollment | hasHardware, isEnrolled |
| Supported biometric types | getSupportedAuthenticationTypes |
| Strongest enrolled method | getEnrolledLevel |
| Lockout after failed tries | isLockedOut |
| System prompt | authenticate, with passcode fallback, labels and the Android biometric class |
| Closing the prompt from code | cancelAuthenticate |
| Failures without exceptions | AuthenticationResult with one of 15 error codes; the promise never rejects |
Requirements
| Requirement | Version |
|---|---|
nitro-ui-renderer | 0.3.0 or later (peer dependency) |
nitro-core | 1.0.0-alpha.nightly.138.g43e09c161101 exactly; see version overrides |
| iOS | 16 or later (the Swift package's deployment target) |
| Android | 8 or later; biometric prompts need 10 or later, see Android versions |
Next steps
- Install the package and run
nitro-ui prepare. - Add the iOS and Android declarations.
- Follow the quick start for the smallest working prompt.