CredentialKeychain
Synchronous secure credential storage, backed by the current platform's native secure storage (Android Keystore, Apple Keychain, macOS Keychain, Linux Secret Service, or Windows DPAPI). Call from a worker thread: native stores may block or prompt the user. Implementations never persist plaintext as a fallback — an unavailable or failing backend throws KeychainUnavailableException instead.
Obtain an instance with forCurrentPlatform. On Android, use the Context-taking overload declared in the com.maniramezan.credentialkeychain Android package instead.
val keychain = CredentialKeychain.forCurrentPlatform(serviceName = "my-app", accountName = "user-123")
keychain.write("api-key", "secret-token")
val token: String? = keychain.read("api-key")
keychain.delete("api-key")Content copied to clipboard