Package-level declarations

The shared credential storage interface, platform factories, options, and failure type.

The shared credential storage interface, platform factories, options, and failure type.

The shared credential storage interface, platform factories, options, and failure type.

The shared credential storage interface, platform factories, options, and failure type.

Types

Link copied to clipboard

When a native Apple Keychain entry can be read. Every option is device-only: entries are never synchronized to iCloud Keychain or restored onto another device.

Link copied to clipboard
class CertificateInfo(val alias: String, certificateChainDer: List<ByteArray>, val hasPrivateKey: Boolean)

A certificate chain stored in a CertificateStore, leaf certificate first.

Link copied to clipboard

X.509 certificates and identities (a certificate chain plus its private key), stored with the platform's native protection. PKCS#12 identities keep their private key in native key storage; certificate chains and the alias index are kept in the platform's secure secret storage.

Link copied to clipboard

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.

Link copied to clipboard
class HardwareKeyInfo(val alias: String, publicKeyDer: ByteArray, val securityLevel: SecurityLevel)

Public information about a key in a HardwareKeyStore.

Link copied to clipboard
class HardwareKeySpec(val allowSoftwareKeys: Boolean = false)
Link copied to clipboard

Non-exportable ECDSA P-256 signing keys generated inside the platform's secure hardware: StrongBox or the trusted execution environment on Android, and the Secure Enclave on Apple platforms. Private keys never leave the hardware; callers receive the public key and signatures only.

Link copied to clipboard
class KeychainOptions(val appleAccessibility: AppleAccessibility = AppleAccessibility.WhenUnlocked, val desktopCommandTimeout: Duration = DEFAULT_DESKTOP_COMMAND_TIMEOUT)

Platform-specific store configuration. Each option only affects the platforms named in its documentation and is ignored elsewhere.

Link copied to clipboard

Secure persistence failed or is unavailable for the current platform, session, or environment (for example: a headless Linux session with no Secret Service, or an Android call made without a Context). Error messages never include credentials.

Link copied to clipboard
class PasswordCredential(val server: String, val username: String, val password: String)

A username and password for a server. toString never includes the password.

Link copied to clipboard
interface PasswordStore

Username/password credentials for servers, backed by the current platform's native password storage: Keystore-encrypted files on Android, internet-password items in the Apple Keychain and the macOS login keychain, Secret Service on Linux, or Credential Manager on Windows.

Link copied to clipboard

Where a HardwareKeyStore private key lives.

Functions

Link copied to clipboard
fun CertificateStore.Companion.forCurrentPlatform(context: Context, serviceName: String, accountName: String = serviceName): CertificateStore

Creates a certificate store isolated by serviceName and accountName. Private keys of imported identities are moved into Android Keystore, where they cannot be exported; certificate chains and the alias index are kept in the same encrypted, non-backed-up files as CredentialKeychain, under a separate namespace.

fun CredentialKeychain.Companion.forCurrentPlatform(context: Context, serviceName: String, accountName: String = serviceName): CredentialKeychain

Creates app-private storage isolated by serviceName and accountName, encrypted with a non-exportable Android Keystore AES-256-GCM key. Ciphertext is written to a file under Context.getNoBackupFilesDir, so entries are excluded from Auto Backup — Keystore keys are hardware/OS-bound and cannot be restored onto another device or after a factory reset.

fun PasswordStore.Companion.forCurrentPlatform(context: Context, serviceName: String, accountName: String = serviceName): PasswordStore

Creates an app-private password store isolated by serviceName and accountName, encrypted with its own non-exportable Android Keystore AES-256-GCM key. Like the CredentialKeychain overload, ciphertext lives under Context.getNoBackupFilesDir and is excluded from backup.

Link copied to clipboard

Returns the Android Keystore entry of the identity stored under alias, for use with Signature, KeyManagerFactory, or an SSLContext. The private key stays inside Android Keystore.

Returns the private key and certificate chain of the identity stored under alias, for use with Signature, KeyManagerFactory, or an SSLContext.

Link copied to clipboard
fun CertificateStore.secIdentity(alias: String): SecIdentityRef?

Returns the keychain identity stored under alias, for use with URLSession client authentication or SecIdentityCopyPrivateKey. The reference is retained: release it with CFRelease when done.