Package-level declarations

Types

Link copied to clipboard
interface AlgorithmProvider<T>

Lazily initialized holder for a platform cryptographic primitive (e.g. Tink Aead).

Link copied to clipboard

Holds the application Context required by Android's createPlatformCryptoStack to access Keystore-backed SharedPreferences.

Link copied to clipboard
interface Cipher

Authenticated encryption with associated data (AEAD) contract for KryptoStore payloads.

Link copied to clipboard
class CryptoRuntime(stack: PlatformCryptoStack, storeRegistry: StoreRegistry = StoreRegistry(), log: KryptoLog = KryptoLog.NoOp)

Initializes platform crypto (key rotation + re-encrypt + post-init hooks) behind a mutex.

Link copied to clipboard
sealed interface CryptoRuntimeState

Lifecycle state of CryptoRuntime.

Link copied to clipboard
fun interface EncryptedStoreHandle

Handle for an encrypted store that can rewrite ciphertext under the current Cipher after key rotation (REQ-ROT-01).

Link copied to clipboard
data class KeyRotationConfig(val rotationPeriod: Duration = 90.days, val initialBackoff: Duration = 500.milliseconds, val maxRetries: Int = 3)

Policy for automatic time-based key rotation in createPlatformCryptoStack.

Link copied to clipboard
interface KeyRotator

Evaluates whether the active encryption key is due for rotation and rotates it when needed.

Link copied to clipboard
fun interface KryptoLog

Optional logging hook for KryptoStore. Default is a no-op so the library has no hard dependency on app logging frameworks.

Link copied to clipboard
data class PlatformCryptoStack(val cipher: Cipher, val keyRotator: KeyRotator, val postRotationInit: suspend () -> Unit = { }, val postMigrationCleanup: suspend () -> Unit = {})

Bundle of platform-specific cryptographic primitives and lifecycle hooks consumed by CryptoRuntime.

Link copied to clipboard

Registry of encrypted stores to re-encrypt when KeyRotator.rotateKeyIfNeeded returns true.

Link copied to clipboard
class StreamingAeadCipher(streamingAead: StreamingAead, dispatcher: CoroutineDispatcher = Dispatchers.Default) : Cipher

Optional Cipher backed by Tink StreamingAead for large payloads (REQ-HRD-03).

Properties

Link copied to clipboard

Magic header prepended to encrypted DataStore payloads (historical wire name; keep for blob compat).

Link copied to clipboard

IndexedDB database name used by the WebCrypto worker — keys must not be stored in localStorage.

Functions

Link copied to clipboard

Creates the default platform PlatformCryptoStack for appId.

expect fun createPlatformCryptoStack(appId: String, rotationConfig: KeyRotationConfig = KeyRotationConfig.DEFAULT): PlatformCryptoStack

Creates the default platform PlatformCryptoStack for appId.

Creates the default platform PlatformCryptoStack for appId.

Creates the default platform PlatformCryptoStack for appId.

Link copied to clipboard
fun createStreamingAeadCipher(dispatcher: CoroutineDispatcher = Dispatchers.Default): StreamingAeadCipher

Creates a standalone, in-memory StreamingAeadCipher with AES256_GCM_HKDF_1MB (REQ-HRD-03).