Package-level declarations

Types

Link copied to clipboard
class KCounter(initialValue: Int = 0, val min: Int = Int.MIN_VALUE, val max: Int = Int.MAX_VALUE, val step: Int = 1)

A reactive mutable counter with optional min/max bounds and a configurable step.

Link copied to clipboard
class KDebouncer<T>(scope: CoroutineScope, val delay: Duration = 300.milliseconds, val leading: Boolean = false)

A coroutine-based debouncer that delays forwarding values until no new values have arrived for the specified delay duration.

Link copied to clipboard
class KEncryptException(message: String, cause: Throwable? = null) : Exception

Thrown when encryption or decryption fails.

Link copied to clipboard
data class KEncryptKeyPair(val publicKeyBase64: String, val privateKeyBase64: String)

A Kyber-1024 key pair, both keys Base64-encoded for serialisation.

Link copied to clipboard
sealed class KEncryptKeyType

Selects between a classical passphrase-derived key and a post-quantum asymmetric key pair (CRYSTALS-Kyber via Bouncy Castle).

Link copied to clipboard

Registers the Bouncy Castle providers required for classical and post-quantum cryptography.

Link copied to clipboard

Hash algorithm used to derive the AES key from a passphrase. Only relevant for KEncryptKeyType.Classical.

Link copied to clipboard

Ensures that only one coroutine at a time can execute a critical section.

Link copied to clipboard
class KRetryRunner<T>(scope: CoroutineScope, val retries: Int = 3, val delay: Duration = 250.milliseconds, val backoffFactor: Double = 2.0, val maxDelay: Duration = 10.seconds, val onSuccess: (T) -> Unit? = null, val onError: (Throwable) -> Unit? = null)

A utility that retries a suspending operation with configurable exponential back-off and jitter.

Link copied to clipboard

Deduplicates concurrent calls to the same async operation.

Link copied to clipboard
class KThrottler<T>(scope: CoroutineScope, val period: Duration = 500.milliseconds)

A coroutine-based throttler that ensures at most one value is forwarded per period.

Link copied to clipboard
class KToggle(defaultValue: Boolean = false)

A boolean toggle with optional forced-set support.

Functions

Link copied to clipboard
fun <T> Flow<T>.debounceLeading(duration: Duration): Flow<T>

Leading-edge debounce for Flow values.

Link copied to clipboard

Low-level ByteArray decryption. Returns raw plaintext bytes.

fun String.decrypt(key: KEncryptKeyType, salt: String? = null): String

Decrypts a Base64-encoded ciphertext produced by encrypt.

Link copied to clipboard

Low-level ByteArray encryption. Returns raw ciphertext bytes.

fun String.encrypt(key: KEncryptKeyType, salt: String? = null): String

Encrypts a String and returns a Base64-encoded ciphertext.

Link copied to clipboard
fun <T> Kdebounce(scope: CoroutineScope, delay: Duration = 300.milliseconds, leading: Boolean = false, block: suspend (T) -> Unit): KDebouncer<T>

Creates and starts a KDebouncer with an immediate callback.

Link copied to clipboard
fun <T> Kthrottle(scope: CoroutineScope, period: Duration = 500.milliseconds, block: suspend (T) -> Unit): KThrottler<T>

Creates and starts a KThrottler with an immediate callback.

Link copied to clipboard
fun <T> Flow<T>.throttleFirst(period: Duration): Flow<T>

Throttles a Flow to emit at most one item per period.