Skip to main content

Secure sensitive data in Local Storage

Secure sensitive data in Local Storage

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

  • Uses Keychain for iOS, and
  • Encrypted Preferences for Android

To get started using it, you must use KmpSecureStorage.

Persist data in secure storage


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

Fetch data from Storage

Below are the functions available:


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

Clear data from Storage

To delete a key/value pair from storage:


_1
KmpSecureStorage.deleteDataForKey(key: String)

And to clear all data from the store


_1
KmpSecureStorage.clearEntireStore(key: String)

iOS Setup?

Specify the keychain appgroup for your app.


_1
KmpSecureStorage.configureSecurityForiOS(serviceName: String, accessGroup: String)