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.random.csprng.CSPRNG
|
||||
import kotlin.random.nextUBytes
|
||||
|
||||
class SecretGenerator(
|
||||
val function: HashFunction,
|
||||
) {
|
||||
private val random = CSPRNG.HMAC(function)
|
||||
|
||||
fun generate(): ByteArray {
|
||||
return random.nextBytes(function.bytes)
|
||||
fun generate(): UByteArray {
|
||||
return random.nextUBytes(function.bytes)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user