Skip to content

feat: implement biometric app lock with settings and session state ma… - #38

Open
Aswin2702 wants to merge 2 commits into
lossless-protocols-org:mainfrom
Aswin2702:feat/biometric-app-lock
Open

feat: implement biometric app lock with settings and session state ma…#38
Aswin2702 wants to merge 2 commits into
lossless-protocols-org:mainfrom
Aswin2702:feat/biometric-app-lock

Conversation

@Aswin2702

@Aswin2702 Aswin2702 commented Jul 12, 2026

Copy link
Copy Markdown

🔒 Feat: Biometric App Lock (FaceID / Fingerprint)
📝 Description
This PR introduces an opt-in Biometric App Lock to enhance the privacy of the user's financial data. It allows users to lock the app behind FaceID (iOS) or Fingerprint/Biometrics (Android). The implementation is non-breaking, privacy-first, and relies on secure OS-level biometric prompts.

🚀 Key Features & Changes
New AppLockContext (src/context/AppLockContext.tsx):
Listens to AppState to instantly lock the app when returning from the background.
Automatically triggers the native biometric prompt.
Secures the user preference locally via MMKV (StorageService).
Includes a Graceful Fallback: If the user removes their fingerprint at the OS level while the lock is enabled, the app detects the sensor is no longer available and safely disables the lock to prevent permanent lockouts.
Lock Overlay (src/components/atoms/LockScreen.tsx):
A clean, full-screen lock overlay that perfectly matches the app's dark/light theme.
Smooth fade-in animation to obscure the dashboard immediately.
Settings Integration (src/screens/SettingsScreen/index.tsx):
Added a new toggle under the "PERSONALIZATION" section.
Automatically hides the option if the device does not have biometrics enrolled (to prevent a confusing user experience).
iOS Compliance: Added the mandatory NSFaceIDUsageDescription to ios/zero/Info.plist.
🛠 Testing Instructions
Prerequisites: Since a new native dependency (react-native-biometrics) was added, please ensure you do a clean build:
Run npm install
For iOS: cd ios && pod install, then rebuild from Xcode.
For Android: Clean and rebuild from Android Studio.
Enable the Lock:
Navigate to Settings -> Personalization.
Tap App Lock. Authenticate via the native prompt to enable the feature.
Test the Lock:
Minimize the app (send it to the background).
Reopen the app. You should immediately see the zero lock screen and be prompted to authenticate.
Test Graceful Fallback (Optional):
With the app lock enabled, go to your phone's OS Settings and remove your fingerprint/FaceID.
Reopen the app. It should skip the lock screen and automatically disable the setting in the app.

⚠️ Notes for Reviewers
The react-native-biometrics package was chosen for its stability and lightweight footprint compared to heavy keychain libraries.
The LockScreen component utilizes a React Native Modal placed directly above the NavigationContainer in App.tsx so it doesn't disrupt any active navigation stacks or Redux state.

@Aswin2702 Aswin2702 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify this feature and approve it.

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.

1 participant