Repo now archived
Sorry I don't have the time and energy to maintain it, feel free to fork it and publish your own version.
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
Gotcha's
- 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
Examples
import TurboSecureStorage, { ACCESSIBILITY } from 'turbo-secure-storage';
const { error } = TurboSecureStorage.setItem('foo', 'bar', {
accessibility: ACCESSIBILITY.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY,
// OR
withBiometrics: true,
});
const { error, value } = TurboSecureStorage.getItem('foo', {
withBiometrics: true,
});
const { error } = TurboSecureStorage.deleteItem('foo', {
withBiometrics: true,
});
Unfortunately due how codegen works, you always need to pass the options object, even if it is empty
iOS Accessibility
On iOS you can specify an accesibility value which allows to customize when the data is readable. It is mutually exclusive biometrics. So pick one or the other.
TODO
- Implement official Android keystore implementation
- Add passcode / password fallback for Android if possible
- Add
getAllKeys
,getAllItems
anddeleteAllItems
methods (if possible) - Support Secure Enclave on Apple devices
- Create testing device list
- Security audits
About me
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.
License
MIT License