improvement(Passkey): Accept decimal values of cred params algorithm and round it to an int

This commit is contained in:
Artem Chepurnoy 2024-03-27 10:33:54 +02:00
parent 7cd468542e
commit 601984ac28
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
2 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import java.security.KeyPairGenerator
import java.security.PrivateKey
import java.security.Signature
import java.security.spec.ECGenParameterSpec
import kotlin.math.roundToInt
abstract class PasskeyGeneratorBase : PasskeyGenerator {
// https://www.iana.org/assignments/cose/cose.xhtml#algorithms
@ -17,7 +18,7 @@ abstract class PasskeyGeneratorBase : PasskeyGenerator {
*/
override fun handles(
params: CreatePasskeyPubKeyCredParams,
): Boolean = params.alg == type
): Boolean = params.alg.roundToInt() == type
}
interface PasskeyGenerator {

View File

@ -73,7 +73,7 @@ data class CreatePasskeyUser(
@Serializable
data class CreatePasskeyPubKeyCredParams(
// https://www.iana.org/assignments/cose/cose.xhtml#algorithms
val alg: Int,
val alg: Double,
val type: String,
)