Skip to content

RajatDGupta/Biometric_Authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Biometric Authentication Demo

A modern, secure Android application demonstrating the implementation of biometric authentication (Fingerprint, Face, Iris) using Jetpack Biometric and Jetpack Compose.

🚀 Key Features

  • Standardized Auth: Uses BiometricPrompt for a consistent system-level experience.
  • Compose Integration: Seamlessly bridges the FragmentActivity-based biometric API with a modern Compose UI.
  • Robust State Handling: Manages authentication lifecycle states:
    • Idle: Initial state.
    • Success: Authentication confirmed.
    • Failed: Incorrect credential (allows retry).
    • Error: Hardware issues or user cancellation.
  • Hardware Validation: Pre-flight checks using BiometricManager to verify hardware availability and enrollment.

🛠 Tech Stack & Requirements

  • Kotlin 2.0+: Primary language with the modern Compose Compiler.
  • Jetpack Compose: Declarative UI implementation.
  • AndroidX Biometric (1.2.0-alpha05): Standard library for secure authentication.
  • Min SDK: 24
  • Target SDK: 36
  • Architecture: MVVM with ViewModel and StateFlow.

📂 Architecture Overview

  • MainActivity: Inherits from FragmentActivity (required for BiometricPrompt) and handles the authentication callback.
  • MainViewModel: Encapsulates the AuthStatus logic, ensuring UI consistency during configuration changes.
  • BiometricAuthScreen: A reactive UI that observes the ViewModel and triggers the system prompt.

🚀 Getting Started

  1. Clone & Open: Open the project in the latest Android Studio.
  2. Device Setup:
    • Use a physical device with a fingerprint or face scanner.
    • For Emulators, go to Settings > Security > Fingerprint and register a dummy print (usually by clicking the "..." menu in the emulator and selecting the Fingerprint tab).
  3. Run: Deploy the :app module.

🔒 Security Note

The app uses BIOMETRIC_STRONG by default, ensuring that only Class 3 (formerly "Strong") biometrics are used, providing a high level of security suitable for sensitive data.

About

Biometric Authentication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages