createRandomSecret

fun createRandomSecret(hmacAlgorithm: HmacAlgorithm): ByteArray

Generates a secure random secret with the same length as a hash of the given HMAC algorithm (defined in HmacAlgorithm.hashBytes).

Parameters

hmacAlgorithm

the HMAC algorithm from that the number of bytes is taken.


fun createRandomSecret(secretBytes: Int): ByteArray

Generates a secure random secret with variable length.

Parameters

secretBytes

the length (as number of bytes) of the generated secret.