yarn add turbo-secure-storage
A turbo-module to securely store data, uses Keychain on iOS and KeyStore/EncryptedSharedPreferences on Android. It also supports Biometric authentication
- This being a TurboModule is only compatible with RN 0.68+
- Android's min SDK API is 23, to take advantange of the official keystore implementation
import TurboSecureStorage, { ACCESSIBILITY } from 'turbo-secure-storage';
const { error } = TurboSecureStorage.setItem('foo', 'bar', {
accessibility: ACCESSIBILITY.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY, // the most secure option
withBiometrics: true,
});
const { error, value } = TurboSecureStorage.getItem('foo', {
withBiometrics: true,
});
const { error } = TurboSecureStorage.deleteItem('foo', {
withBiometrics: true,
});
Unfortunately due how codegen works, you need always need to pass the options object, even if it is empty
On iOS you can specify an accesibility value which allows to customize when the data is readable.
- [x] Implement official Android keystore implementation
- [x] Add passcode / password fallback for Android if possible
- [ ] Add
getAllKeys
,getAllItems
anddeleteAllItems
methods if possible - [ ] Support Secure Enclave on Apple devices
- [ ] Revisit Android code to make sure it handles all edge cases (RTL text)
- [ ] Create testing device list
- [ ] Security audit by expert
I'm available for React Native consulting and also create other products, get in touch. You can also see how this library was built from scratch on my YouTube channel.
MIT License