Skip to content

fix(#75): add biometric authentication#521

Merged
Smartdevs17 merged 3 commits into
Smartdevs17:mainfrom
rindicomfort:fix/75-biometric-auth
Jun 1, 2026
Merged

fix(#75): add biometric authentication#521
Smartdevs17 merged 3 commits into
Smartdevs17:mainfrom
rindicomfort:fix/75-biometric-auth

Conversation

@rindicomfort
Copy link
Copy Markdown
Contributor

Summary

Closes #75

Adds Face ID / Touch ID / fingerprint authentication with PIN fallback, an optional setting, and a lock screen that prompts on launch and on foreground.

Files

src/services/auth/biometricService.ts (new)

  • Lazy-loads expo-local-authentication — app never crashes if module not linked
  • isAvailable() — checks hardware + enrollment
  • getSupportedTypes() — fingerprint / facial / iris
  • authenticate(reason, fallbackToPIN) — wraps authenticateAsync with PIN fallback
  • authenticateIfEnabled() — skips prompt when user has disabled biometrics
  • getSettings() / saveSettings() — persists { enabled, fallbackToPIN } to AsyncStorage

src/hooks/useBiometricAuth.ts (new)

  • Loads availability, supported types, and settings on mount
  • authenticate() tracks loading / error / cancelled state
  • saveSettings() persists preference changes

src/components/BiometricGate.tsx (new)

  • Lock screen shown on launch when biometrics are enabled
  • Auto-prompts on mount and on foreground (AppState listener — re-locks on background)
  • Shows contextual icon: 👆 fingerprint / 🪪 Face ID / 👁️ iris / 🔒 fallback
  • Error card with retry button; passes through immediately when disabled

App.tsx

  • Wraps AppNavigator with BiometricGate inside ErrorBoundary

Setup

npx expo install expo-local-authentication

Acceptance Criteria

  • Prompt on app launch (and on foreground after backgrounding)
  • Face ID / Touch ID / fingerprint support
  • Fallback to device PIN/passcode
  • Optional in settings (biometricService.saveSettings({ enabled }))
  • Graceful degradation when hardware unavailable

- src/services/auth/biometricService.ts:
  - Lazy-loads expo-local-authentication so app never crashes if the
    native module is not yet linked
  - isAvailable(): checks hardware + enrollment
  - getSupportedTypes(): fingerprint / facial / iris
  - authenticate(): wraps authenticateAsync with PIN fallback option
  - authenticateIfEnabled(): reads settings and skips prompt when
    biometrics are disabled
  - getSettings() / saveSettings(): persists { enabled, fallbackToPIN }
    to AsyncStorage
- src/hooks/useBiometricAuth.ts:
  - Loads availability, supported types, and settings on mount
  - authenticate() triggers prompt and tracks loading/error/cancelled
  - saveSettings() persists user preference changes
- src/components/BiometricGate.tsx:
  - Lock screen shown on launch when biometrics are enabled
  - Auto-prompts on mount and on foreground (AppState listener)
  - Shows biometric icon (Face ID / fingerprint / iris / lock)
  - Error card with retry button on failure
  - Passes through immediately when biometrics disabled or unavailable

Requires: npx expo install expo-local-authentication
- Wrap AppNavigator with BiometricGate inside ErrorBoundary
- Import BiometricGate from src/components/BiometricGate
- Gate renders lock screen on launch when biometrics are enabled;
  passes through immediately when disabled or unavailable
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@rindicomfort Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Smartdevs17 Smartdevs17 merged commit 6e3b8bf into Smartdevs17:main Jun 1, 2026
3 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔧 Add biometric authentication

2 participants