forCurrentPlatform
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.
context is retained only as Context.getApplicationContext.
val certificates = CertificateStore.forCurrentPlatform(
context = applicationContext,
serviceName = "my-app",
accountName = "user-123",
)Parameters
any Android Context; only its application context is retained.
identifies the calling application or integration; must be nonblank and free of NUL/CR/LF.
identifies the certificate owner; defaults to serviceName. Same validity rules as serviceName.
Throws
if serviceName or accountName is blank or contains NUL, CR, or LF.
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.
context is retained only as Context.getApplicationContext, never the passed-in instance, so it is safe to call this with an Activity context without leaking it.
val keychain = CredentialKeychain.forCurrentPlatform(
context = applicationContext,
serviceName = "my-app",
accountName = "user-123",
)Parameters
any Android Context; only its application context is retained.
identifies the calling application or integration; must be nonblank and free of NUL/CR/LF.
identifies the credential owner; defaults to serviceName. Same validity rules as serviceName.
Throws
if serviceName or accountName is blank or contains NUL, CR, or LF.
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.
context is retained only as Context.getApplicationContext.
val passwords = PasswordStore.forCurrentPlatform(
context = applicationContext,
serviceName = "my-app",
accountName = "user-123",
)Parameters
any Android Context; only its application context is retained.
identifies the calling application or integration; must be nonblank and free of NUL/CR/LF.
identifies the credential owner; defaults to serviceName. Same validity rules as serviceName.
Throws
if serviceName or accountName is blank or contains NUL, CR, or LF.