Repository navigation
3.2.0
Same call, no by: ksafe(default, key) now hands you a KSafeReference you can keep, pass around, and read or write through .value. Around fifty durability fixes underneath. Drop-in upgrade: existing data is untouched, nothing migrates.
implementation("eu.anifantakis:ksafe:3.2.0")
implementation("eu.anifantakis:ksafe-compose:3.2.0") // optional
implementation("eu.anifantakis:ksafe-biometrics:3.2.0") // optionalNew
KSafeReference— direct access without property delegation. The call that backsbynow returns a handle. Own section below. 👇- Two
KSafeinstances on one file now behave like one store (Android, iOS/macOS, JVM Desktop): a write, aclearAll()or arotateKeys()through one instance is seen by every other live instance on that file. - A link-failed OS key vault on JVM Desktop no longer bricks the store. It degrades to the software vault and keeps working; keys minted meanwhile are provisional and yield to the OS key when it returns. 📖 docs/JVM_PROTECTION.md
- Android API 28–34 without a lock screen: a
requireUnlockedDevicewrite now succeeds with the unlock binding relaxed instead of failing, disclosed asandroid_lock_screen_absentinprotectionInfo.notes. 📖 docs/PROTECTION_INFO.md
KSafeReference: ksafe(default, key) without by
So far there was only property delegation:
var counter by ksafe(0)
counter++The same call, given an explicit key, now returns a handle you can hold in a val, hand to a class, and read or write through .value:
val counter = ksafe(0, key = "counter") // KSafeReference<Int>
counter.value++It works on the mode-typed views too — ksafe.plain(0, key = "theme"), vault("", key = "pin") — with their frozen write mode. value reads through the same hot cache as the delegate and writes fire-and-forget with the KSafeWriteMode captured when the handle was created. Delegate behaviour is unchanged; both forms share one store and one cache, so you can mix them freely.
Three honest boundaries:
- The key is required for
.value. A plain=carries no property name, so a key-less handle stays delegate-only and.valueon it throwsIllegalStateException. - The deprecated
encrypted: Booleanoverload still returns the delegate type — move it tomodefirst. - Don't read
.valuein composition. No snapshot state sits behind the handle, so a composable would not recompose; use:ksafe-composeorasStateFlow().collectAsState().
Changed
kotlinx-coroutines-coreandcompose-runtimeare nowapidependencies. They were in the public surface all along; you now get them transitively.rememberKSafeStateisinline: its failed-write rollback fix reaches a call site only once that module is recompiled against 3.2.0.protectionInfoon Android now performs one blocking store read per process on a device with a secure lock screen (API 35+ included) — read it off the main thread.- The Android public API now has an ABI baseline that
apiCheckenforces.
Fixes
Around fifty; the ones you would notice:
- Android: a transient Keystore fault no longer destroys every encrypted value — only a fault the Keystore proves permanent re-mints a key (Android 13+). iOS/macOS: a Secure Enclave unwrap failure no longer downgrades an alias to a plain Keychain key.
- All platforms: a write at the edge of the coalesce window can no longer be lost; a failed
clearAll()leaves the store exactly as it was; a cold read racing the startup sweep can no longer resurrect a swept entry;close()waits for a write already in flight. - Biometrics: a stopped Android Activity no longer hangs the prompt, a cancelled prompt stays cancelled, an empty
reasonno longer terminates the process, and a desktop bridge that fails to load no longer opens a strict gate. - Compose:
rememberKSafeStateno longer rewinds to the startup value after a failed write, and the cold-start self-heal no longer overwrites text the user is typing. - JVM
appNamespace:clearAll()is no longer undone by the next launch; Windows symlinks and transient file locks are handled. - Web: losing IndexedDB no longer strands ciphertext forever;
lazyLoad = trueno longer makes every non-suspend read return its default.
Known, fixed in 3.2.1
- JVM: a namespaced store whose one-time carry-forward copy fails runs on the shared un-namespaced store for that session (a warning is printed), so its
clearAll()clears that store. - JVM: a key minted while the OS vault could not link can take an alias whose real OS key still sits under an older vault namespace.
- Android: the
android_lock_screen_absentnote can outlive the relaxed key after an Auto Backup restore —rotateKeys()clears it. - JVM Desktop: a permissive biometric call that passes through because Windows Hello is unavailable still seeds the authorization cache.
Details: CHANGELOG.md
Full Changelog: 3.1.0...3.2.0