use UByteArray for SecretGenerator
This commit is contained in:
@@ -2,13 +2,14 @@ package com.infendro.otp
|
|||||||
|
|
||||||
import com.infendro.hash.HashFunction
|
import com.infendro.hash.HashFunction
|
||||||
import com.infendro.random.csprng.CSPRNG
|
import com.infendro.random.csprng.CSPRNG
|
||||||
|
import kotlin.random.nextUBytes
|
||||||
|
|
||||||
class SecretGenerator(
|
class SecretGenerator(
|
||||||
val function: HashFunction,
|
val function: HashFunction,
|
||||||
) {
|
) {
|
||||||
private val random = CSPRNG.HMAC(function)
|
private val random = CSPRNG.HMAC(function)
|
||||||
|
|
||||||
fun generate(): ByteArray {
|
fun generate(): UByteArray {
|
||||||
return random.nextBytes(function.bytes)
|
return random.nextUBytes(function.bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user