Skip to content

StorageAdapter

//fluxbase-kotlin/io.github.nimbleflux.fluxbase.auth/StorageAdapter

interface StorageAdapter

SPI for persisting the auth session. Port of StorageAdapter from sdk/src/types.ts:25.

The TS SDK uses localStorage in browsers and MemoryStorage in Node/SSR. In Kotlin:

  • The default MemoryStorage keeps the session in memory (JVM/server use).
  • On Android, inject an EncryptedSharedPreferences-backed implementation.

The storage key is always "fluxbase.auth.session" (matching the TS constant AUTH_STORAGE_KEY in auth.ts:61).

MemoryStorage
Name Summary
getItem [jvm]
abstract fun getItem(key: String): String?
removeItem [jvm]
abstract fun removeItem(key: String)
setItem [jvm]
abstract fun setItem(key: String, value: String)