Add biometric login + credential storage to native bridge#249
Add biometric login + credential storage to native bridge#249sauravvarma wants to merge 1 commit into
Conversation
iOS (full implementation): - New BiometricAuthHandler using LocalAuthentication + Keychain with kSecAttrAccessControl(.biometryCurrentSet) so stored credentials auto- invalidate on biometry enrollment changes - 5 commands: authenticateBiometric, isBiometricAvailable, setBiometricCredential, getBiometricCredential, deleteBiometricCredential - Schemas + allowlist updates, NSFaceIDUsageDescription added to Info.plist Android (stubs): - 5 @JavascriptInterface methods returning BIOMETRIC_NOT_IMPLEMENTED - WebEvents + allowlist parity with iOS so JS code is identical across platforms JS bridge: - Constants, nativeBridge.biometric namespace, and Promise-based WebBridge wrappers (authenticate/availability/get/set/delete credential) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
DeputyDev will no longer review pull requests automatically.To request a review, simply comment #review on your pull request—this will trigger an on-demand review whenever you need it. |
🔍 PR Review: Biometric Login + Credential StorageLayer Coverage
Findings
Detailed Findings + Examples🔴 1 —
|
| Convention | Other hooks | This PR |
|---|---|---|
Exported React hook (use*) |
useCamera, useGoogleSignIn, useFilePicker, etc. |
❌ Missing — no useBiometric |
Wraps useBaseHook |
All hooks | ❌ Not applicable (hook missing) |
executeOperation pattern |
useCamera, useGoogleSignIn |
❌ Not applicable (hook missing) |
useEffect listener registration + cleanup |
All hooks | ❌ Not applicable (hook missing) |
handleNativeError for error standardization |
All hooks | ❌ Not applicable (hook missing) |
setDataAndComplete on success |
All hooks | ❌ Not applicable (hook missing) |
isDevelopment() debug logging |
All hooks | ❌ Not applicable (hook missing) |
SSR guard (typeof window === "undefined") |
All hooks | ❌ Not applicable (hook missing) |
Exported from hooks.js or standardizedHooks.js |
All features | ❌ Not present |
What's Done Well ✅
- Wire parity across iOS, Android, and JS is solid — allowlists, event enum values, and callback names match across all three layers
kSecAttrAccessControl(.biometryCurrentSet)is the correct flag — credentials auto-invalidate on enrollment change (new fingerprint added)NSFaceIDUsageDescriptionpresent in bothInfo.plistandInfo-Release.plist(commonly missed, handled correctly here)- Keychain operations that block on biometric prompt dispatched off main queue, results delivered back on main
deleteCredentialRawcalled beforeSecItemAddinsetCredential— avoidserrSecDuplicateItem@unknown defaultinbiometryTypeswitch — forward-compatible with future Apple biometry types- Android stubs emit event-compatible payloads — JS symmetry maintained before Android is built out
INTERFACE_CATEGORIES.BIOMETRICblock correctly groups commands + callbacks for capability detection
Bottom Line
The Android stub approach is fine — stubs emit the right events so JS is platform-symmetric. The native iOS implementation is solid. The main gaps before merge:
Must fix:
- Add
useBiometrichook tohooks.jsfollowing theuseGoogleSignInpattern - Fix
errSecAuthFailed→ split fromerrSecUserCanceledin the Keychain path
Strongly recommended:
3. Add 30s timeout to _oneShot
4. Add in-flight guard for concurrent calls (or document the limitation)
5. Document the trusted-WebView assumption for set/delete credential
iOS (full implementation):
Android (stubs):
JS bridge: