ioannisa
05/25/2025, 3:18 PMvar apiSecret by ksafe("")
π Encrypted+Persisted COMPOSE STATE?
var counter by ksafe.mutableStateOf(0)
π Serializable data classes?
// declare a serializable data class
@Serializable
data class AuthInfo(
val accessToken: String = "",
val refreshToken: String = "",
val expiresIn: Long = 0L
)
// and a ksafe variable
var authInfo by kvault(AuthInfo())
π Then just feel free to read the variable to retrieve the encrypted stored info and modify your variables as with any other variable...
That's it. Your mobile app's data is now persisting your Encrypted content in DataStore, protected by Android Keystore or iOS Keychain. Zero configuration. Zero headaches. Just a single line! π―
π‘ More ways to declare your ksafe content without delegation and within coroutines exist Check library's GitHub README.
Useful for:
OAuth tokens, API keys, User credentials, Any sensitive data
Available in Maven Central, just add:
implementation("eu.anifantakis:ksafe:1.0.0")
implementation("eu.anifantakis:ksafe-compose:1.0.0")
Benefits:
β
One line of code = bank-level security
β
Works identically on Android & iOS
β
Automatic key management
β
Compose state support included!
π Check it out: github.com/ioannisa/KSafe
β Star it if you find it useful!
Want to see KSafe in action? Visit the DEMO APP:
π github.com/ioannisa/KSafeDemorusshwolf
05/25/2025, 5:29 PMioannisa
05/25/2025, 6:04 PMS.
05/25/2025, 6:57 PMioannisa
05/25/2025, 10:44 PMioannisa
05/26/2025, 12:48 AM