[PM-6125] Handle kp.alg is string (#10285)

* fix: handle cases when `kp.alg` is `string` in `createCredential` for `Fido2`

* feat: simplify and move fix to mappers

* fix null filter

---------

Co-authored-by: Alessio Cosenza <cosenzaalessio17@gmail.com>
Co-authored-by: Merissa Weinstein <merissa.k.weinstein@gmail.com>
Co-authored-by: Todd Martin <tmartin@bitwarden.com>
This commit is contained in:
Andreas Coroiu 2024-08-19 10:17:15 +02:00 committed by GitHub
parent 3e37daf236
commit 71413a7b3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -36,10 +36,13 @@ export class WebauthnUtils {
extensions: { extensions: {
credProps: keyOptions.extensions?.credProps, credProps: keyOptions.extensions?.credProps,
}, },
pubKeyCredParams: keyOptions.pubKeyCredParams.map((params) => ({ pubKeyCredParams: keyOptions.pubKeyCredParams
alg: params.alg, .map((params) => ({
type: params.type, // Fix for spec-deviation: Sites using KeycloakJS send `kp.alg` as a string
})), alg: Number(params.alg),
type: params.type,
}))
.filter((params) => !isNaN(params.alg)),
rp: { rp: {
id: keyOptions.rp.id, id: keyOptions.rp.id,
name: keyOptions.rp.name, name: keyOptions.rp.name,