Skip to main content

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.biometrics BiometricManager and BiometricPrompt, 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​

CapabilityAPI
Hardware and enrollmenthasHardware, isEnrolled
Supported biometric typesgetSupportedAuthenticationTypes
Strongest enrolled methodgetEnrolledLevel
Lockout after failed triesisLockedOut
System promptauthenticate, with passcode fallback, labels and the Android biometric class
Closing the prompt from codecancelAuthenticate
Failures without exceptionsAuthenticationResult with one of 15 error codes; the promise never rejects

Requirements​

RequirementVersion
nitro-ui-renderer0.3.0 or later (peer dependency)
nitro-core1.0.0-alpha.nightly.138.g43e09c161101 exactly; see version overrides
iOS16 or later (the Swift package's deployment target)
Android8 or later; biometric prompts need 10 or later, see Android versions

Next steps​

  1. Install the package and run nitro-ui prepare.
  2. Add the iOS and Android declarations.
  3. Follow the quick start for the smallest working prompt.