Ionic Storage Limitations

Forgive me if this information is buried somewhere I haven’t yet found (but please be kind and link it if it’s there :slight_smile:):

My organization needs to transition away from an Encrypted Storage plugin (Intel Security) as it seems to have finally hit it’s end-of-life. This plugin did two things for us, encrypted the data as well as stored it onto the device. This was used to save login tokens for our users to avoid having to login each app session (along with other user metadata).

Abstracting out the encryption portion, I have a few questions about Ionic Storage:

  1. With default configuration, is there a size limit on how much can be stored?
    a. If so, how is memory removed from the device? FIFO, LIFO, etc.
  2. Is SQLite required to prioritize data?
    a. I cannot easily find information on how to prioritize data as mentioned in the Ionic Storage README which redirects to LocalForage.

If anyone also has any Cordova encryption best-practices, I’d love to hear them as well. I’m struggling on whether we should go native-encryption vs client-side, and/or what JS library to use.

Thanks for any and all help,

If the idea is to obviate the need for the user to enter any login information, I’m not sure encryption makes much sense. For on-device encryption to mean anything, the decryption operation has to require some secret which is held outside the app (i.e. the user entering a password).

The idea was to obfuscate the data on the disk. Since the old plugin stored encrypted data in flat files it made sense. Even if we’re just obfuscating your own SSO token and user properties, we do not want that to be available as plain text.

We also do the same for API keys, which makes more sense to encrypt so it’s a bigger effort to crack. I’m not sure how the Intel security plugin did it, but we never had to apply a decryption key to retrieve data.

The source code seems to 404 for me, so I can’t look at what it was doing, but in any event, to answer your other question, storage size limitations (if you use the SQLite backend for Ionic Storage) are going to be device-dependent. SQLite itself is capable of storing terabytes in a single database. I do not know of any automatic cache eviction done by either Android or iOS implementations of it, so you would most likely have to roll your own, perhaps by just having a “mission critical” database and a “nice to have” one.

Thanks for the response! Would you happen to know if Ionic Storage can have different configurations per module? Maybe use Sqlite for mission critical data and the default provider for app cache?

Not directly yet, but there are some hints about how to go about rolling your own solution in this issue discussion.

Thanks for the reply @rapropos!