Skip to main content

Store public data in Local Storage

Store public data in Local Storage

Allows you to save key/value pairs of sensitive data and protects it via device's internal security.

  • Uses NSUserDefaults for iOS, and
  • SharedPreferences (ClearText) for Android

To get started using it, you must use KmpPublicStorage.

Persist data in storage


_1
KmpPublicStorage.persistData("my_key", dataToStore) // dataToStore can be a String, Int, Boolean, or Float

Fetch data from Storage

Below are the functions available:


_4
KmpPublicStorage.getStringFromKey(key: String): String
_4
KmpPublicStorage.getIntFromKey(key: String): Int
_4
KmpPublicStorage.getFloatFromKey(key: String): Float
_4
KmpPublicStorage.getBooleanFromKey(key: String): Boolean

Clear data from Storage

To delete a key/value pair from storage:


_1
KmpPublicStorage .deleteDataForKey(key: String)

And to clear all data from the store


_1
KmpPublicStorage .clearEntireStore(key: String)

Any Required Setup?

None