Reputation: 1961
This is not a question on what storing system use, but is a question on what are the possible strategies to store data locally on a mobile platform (iOS and Android).
I wouldn't use AsyncStorage because data is not encrypted, I see that Realm could be a good candidate, however I am open to other alternatives.
My cross-platform React Native application handles some sensible data that should be persistent on the device. The meaning of persistent that I intend is:
Some sensible data that must be not removed/deleted/cleared by iOS or Android without the permission of the user. Data that must be available at each application upgrade, e.g. at each new release, these data must be remain unchanged and available like nothing happened after App update. Data must not be removed/deleted/cleared if the App is put in background (task manager), turned off or restarted. Data must be available even if the device is rebooted.
I tried each of these cases by using Realm and it seemed to be very good, but since I have not so much experience in mobile development, I preferred to ask the community if my considerations about Realm are correct or not. If no, I would ask what are the possible alternatives and why I am wrong.
Unfortunately, I have no permission to use cloud storages (e.g. CloudKit, iCloud, Firebase and so on...). My App must handle this data only locally on the device.
Same identical previous restrictions of above (sensible data that must be not removed/deleted/cleared [...]), but considering the possibility to use cloud storage systems, what are the best good practices in this scenario, or better: where can I find out "a state of the art documentation" about these things for both platforms?
Upvotes: 0
Views: 2884
Reputation: 478
You have tried realm which is a very good option for storing encrypted data. But if you want storage like async-storage with encryption you can use:- https://www.npmjs.com/package/react-native-sensitive-info (this is what I used for my project) It is supportable for both the platforms and if you are using expo then by default expo provide SecureStore (https://docs.expo.io/versions/latest/sdk/securestore/).
You can also check Encrypting sensivite data in React Native and Expo
data persistence: see react-native-sensitive-info will store data in Android Shared Preferences, iOS Keychain and Windows Credentials and it will be available even if you close/restart the app. It will get removed when you clear the storage of your app.
Security: For sure it will store data securely as they have mentioned on npm website and we used this package for that purpose only instead of async-storage to get clearance from the security team of my company.
Upvotes: 2