StreamingAeadCipher

class StreamingAeadCipher(streamingAead: StreamingAead, dispatcher: CoroutineDispatcher = Dispatchers.Default) : Cipher

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

Compatible with the KryptoStore envelope when used from EncryptedProtoSerializer / EncryptedPreferencesSerializer: the envelope still wraps the StreamingAead ciphertext.

Prefer the default platform Cipher from createPlatformCryptoStack for settings blobs, which manages key persistence and rotation automatically. If you construct a StreamingAeadCipher for persistent stores, supply a StreamingAead primitive backed by a persisted KeysetHandle.

Constructors

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

Functions

Link copied to clipboard
open suspend override fun decrypt(message: ByteArray, associatedData: ByteArray? = null): ByteArray

Decrypts and authenticates ciphertext message with optional AEAD associatedData.

Link copied to clipboard
open suspend override fun encrypt(message: ByteArray, associatedData: ByteArray? = null): ByteArray

Encrypts plaintext message with optional AEAD associatedData.