StatelessHmacNonceManager

class StatelessHmacNonceManager(keySpec: SecretKeySpec, algorithm: String, timeoutMillis: Long, nonceGenerator: () -> String) : NonceManager

Stateless nonce manager implementation with HMAC verification and timeout. Every nonce provided by this manager consist of a random part, timestamp and HMAC.

Constructors

Link copied to clipboard
fun StatelessHmacNonceManager(key: ByteArray, algorithm: String = "HmacSHA256", timeoutMillis: Long = 60000, nonceGenerator: () -> String = { generateNonce() })

Helper constructor that makes a secret key from key ByteArray

Link copied to clipboard
fun StatelessHmacNonceManager(keySpec: SecretKeySpec, algorithm: String = "HmacSHA256", timeoutMillis: Long = 60000, nonceGenerator: () -> String = { generateNonce() })

Functions

Link copied to clipboard
open suspend override fun newNonce(): String

Generate new nonce instance

Link copied to clipboard
open suspend override fun verifyNonce(nonce: String): Boolean

Verify nonce value

Properties

Link copied to clipboard
val algorithm: String

HMAC algorithm name, HmacSHA256 by default

Link copied to clipboard
val keySpec: SecretKeySpec

secret key spec for HMAC

Link copied to clipboard
val nonceGenerator: () -> String

function that produces random values

Link copied to clipboard
val timeoutMillis: Long = 60000

specifies the amount of time for a nonce to be considered valid