React Native & Expo (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Biometric Authentication & Secure Storage: Keychain and KeyStore.
senior LevelMost AskedCode ExampleSecurity & Auth
In Simple Words:
Never store JWT refresh tokens or passwords in unencrypted AsyncStorage or MMKV:
- iOS Keychain & Android KeyStore: Hardware-encrypted security enclaves.
- Biometric Binding: Use
react-native-keychainwith biometric flags:typescriptawait Keychain.setGenericPassword('auth_token', token, { accessControl: Keychain.ACCESS_CONTROL.BIOMETRY_ANY, accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY, }); - Hardware automatically prompts for FaceID / TouchID / Fingerprint before returning the secret token to JavaScript.