Skip to content

Secure Storage

The secure storage of sensitive data in Compose Multiplatform applications and on the backend by leveraging each platform’s native security APIs is provided by Kassaforte

Architecture

  • On Android the data are stored in the SharedPreferences, encrypting the data before storing it
  • On iOS and native macOS the data are stored in the Keychain
  • On JVM to store the data are leveraged the native APIs provided by the different OSs:
    • On Windows the data are stored in the Windows Credentials
    • On Linux the data are stored using the implementation of the DBus Secret Service based on the desktop environment between GNOME or KDE
    • OnMacOs the data are stored in the Keychain

This target uses the java-keyring library under the hood

  • On Web the data are stored in the LocalStorage, encrypting the data before storing it

Usage

Create an instance

val kassaforte = Kassaforte(
    name = "YourApplicationName" // suggested name
)

Sync methods

safeguard

This method securely store sensitive data

kassaforte.safeguard(
    key = "keyToRepresentData",
    data = // sensitive data to safeguard
)

refresh

This method refresh sensitive data previously safeguarded

kassaforte.refresh(
    key = "keyToRepresentData",
    data = // sensitive refreshed data to safeguard
)

remove

This method remove from the secure storage sensitive data previously safeguarded

kassaforte.remove(
    key = "keyToRepresentData"
)

Async methods

The following methods required to be executed inside a Coroutine

withdraw

This method withdraw from the secure storage sensitive data previously safeguarded decrypting it

val scope = MainScope()
scope.launch {
    val safeguardedData: String = kassaforte.withdraw(
        key = "keyToRepresentData"
    )

    println(safeguardedData)
}