replace IllegalArgumentException with require

This commit is contained in:
2025-12-14 00:16:09 +01:00
parent 25e6fcdeab
commit 8870703608

View File

@@ -25,8 +25,7 @@ class HOTP(
secret: UByteArray, secret: UByteArray,
counter: Long, counter: Long,
): String { ): String {
if (counter < 0) require(counter >= 0)
throw IllegalArgumentException()
val hash = generateHash(secret, counter.toUByteArray()) val hash = generateHash(secret, counter.toUByteArray())
return otp(hash) return otp(hash)