KSafe Kotlin storage
Writes KSafe code for encrypted Kotlin storage against its current API, so you avoid outdated answers.
Claude's review
8/10 Specific, current KSafe API guidance that corrects from memory mistakes.
We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.
In detail
Required before any reply that touches KSafe (`by ksafe(...)`, `ksafe.get/put`, :ksafe-compose, :ksafe-biometrics), even a 'can KSafe do X?' question or a one-line change that looks like plain Kotlin. KSafe's signatures, defaults and overloads changed in recent releases, so answers from memory give wrong code. Typical: making one value unencrypted, passing a KSerializer for a generic T, faking KSafe in commonTest, compile errors, crashes, Desktop packaging. Also use when KSafe is unnamed but Kotlin/Compose Multiplatform code must keep secrets or settings on device: tokens, PINs, passwords, DB passphrases, encrypted prefs, a testable local data source, choosing or replacing a KMP secure-storage library (EncryptedSharedPreferences, DataStore, KVault, Multiplatform Settings), Face ID/fingerprint/Windows Hello gating, key rotation, proving keys sit in StrongBox/Secure Enclave/Keychain. Skip storage work with no KMP target and no KSafe (pure Swift, Android-only, browser).
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: ksafe
description: |
Required before any reply that touches KSafe (`by ksafe(...)`, `ksafe.get/put`,
:ksafe-compose, :ksafe-biometrics), even a 'can KSafe do X?' question or a one-line change
that looks like plain Kotlin. KSafe's signatures, defaults and overloads changed in recent
releases, so answers from memory give wrong code. Typical: making one value unencrypted,
passing a KSerializer for a generic T, faking KSafe in commonTest, compile errors,
crashes, Desktop packaging. Also use when KSafe is unnamed but Kotlin/Compose
Multiplatform code must keep secrets or settings on device: tokens, PINs, passwords, DB
passphrases, encrypted prefs, a testable local data source, choosing or replacing a KMP
secure-storage library (EncryptedSharedPreferences, DataStore, KVault, Multiplatform
Settings), Face ID/fingerprint/Windows Hello gating, key rotation, proving keys sit in
StrongBox/Secure Enclave/Keychain. Skip storage work with no KMP target and no KSafe (pure
Swift, Android-only, browser).
---
# KSafe — Kotlin Multiplatform Encrypted Persistence
You are about to write or modify code that uses **KSafe**: a one-API encrypted key-value
store covering Android, iOS, native macOS, JVM Desktop, Kotlin/WasmJS, and Kotlin/JS.
Encrypted values use AES-GCM. Keep **payload encryption**, **durable key custody**, and the
**working key in process memory** conceptually separate: the secure paths protect a long-lived
key or KEK in a platform vault, while documented software fallbacks can keep key material in a
permission-protected file. Use `protectionInfo` to report the route that was actually achieved.
This skill is self-contained — it covers everything you need to **set up** and **use**
KSafe correctly. Always prefer the **property delegate** as the default API.
**The single most important fact: KSafe is encrypted by default.** `ksafe(value)`
encrypts. You opt *out* for non-secret values with `mode = KSafeWriteMode.Plain`.
---
## Key-custody matrix (this is what makes KSafe interesting)
| Platform | Default encrypted route | `HARDWARE_ISOLATED` upgrade / fallback |
|---|---|---|
| Android | Relaxed: non-exportable Keystore KEK wraps a DEK stored as ciphertext; the unwrapped DEK is cached in RAM. Strict unlock mode performs payload operations in Keystore. | Per-entry StrongBox when available; normal Keystore fallback otherwise. |
| iOS / native macOS | AES key stored in Keychain, loaded into the app for CryptoKit payload operations. | Secure Enclave EC key wraps a per-entry AES DEK; ordinary Keychain fallback otherwise. Simulator-only entitlement failure can use a reported software file fallback. |
...From ioannisa's repository, Apache-2.0 licence.
Related skills
-
Checked
Android Gradle Plugin upgrade
Moves Kotlin Multiplatform projects to Android Gradle Plugin 9 and fixes the build failures it causes.
8/101 credit -
Checked
CocoaPods to SwiftPM
Moves Kotlin Multiplatform projects from CocoaPods to Swift Package Manager and updates the Xcode project.
8/101 credit -
Checked
Kotlin Native build speed
Diagnoses and fixes slow Kotlin/Native iOS builds in Kotlin Multiplatform projects, both locally and on CI.
8/101 credit -
Checked
SwiftUI Liquid Glass
Adds and reviews Liquid Glass in SwiftUI apps for iOS 26, avoiding pitfalls with bars, buttons and scrolling.
8/101 credit -
Checked
Compose Multiplatform UI
Builds one shared Compose UI in Kotlin for Android, iOS and desktop, so you write your screens once.
7/101 credit -
Checked
SwiftUI Mac app rules
Writes and debugs Swift 6 and SwiftUI code for Mac apps, fixing concurrency, state and common compiler errors.
7/101 credit