:tada: KSafe 1.8.0 is out — Kotlin Multiplatform k...
# feed
i
🎉 KSafe 1.8.0 is out — Kotlin Multiplatform key-value persistence for Android / iOS / JVM / WASM. If you haven't seen it: Think DataStore, but with a hot in-memory cache in front. That gives you a fully synchronous API (
getDirect
/
putDirect
) when you don't want coroutines, plus suspend
get
/
put
when you do. AES-256-GCM with hardware-backed keys by default (Keystore / Keychain / StrongBox / Secure Enclave), or opt out with a single parameter and use KSafe as a fast general-purpose persistence library for plain data.
Copy code
var token   by ksafe("")                                                           // plain delegate                                                                        
var counter by ksafe.mutableStateOf(0)                                             // Compose state                                                                         
val user:  StateFlowUser           by ksafe.asStateFlow(User(), scope)           // read-only flow                                                                        
val state: MutableStateFlowUiState by ksafe.asMutableStateFlow(UiState(), scope) // read/write flow
What's new in 1.8.0: •
asMutableStateFlow
— drop-in for the classic _state / state pattern, persisted + encrypted transparently:
Copy code
private val _state by ksafe.asMutableStateFlow(UiState(), viewModelScope)
val state = _state.asStateFlow()
.update { }, .value = …, compareAndSet all behave exactly as you'd expect — persistence is invisible, and it survives process death. •
getOrCreateSecret("main.db")
— one line to get a 256-bit passphrase for Room / SQLCipher / SQLDelight (or an API signing key). Generated once, stored hardware-isolated (StrongBox on Android, Secure Enclave on iOS). No more "check if exists, else create and save" boilerplate. •
secureRandomBytes(16)
— cryptographically secure random bytes with one API across every target. • Cross-screen Compose sync via
ksafe.mutableStateOf(scope = viewModelScope)
— a write in one ViewModel auto-reflects in another. GitHub: https://github.com/ioannisa/KSafe Changelog: https://github.com/ioannisa/KSafe/blob/main/CHANGELOG.md
👍 3
K 2