Support seralization of PublicKeyCredentialCreationOptions

Created on 28 November 2024, 23 days ago

Problem/Motivation

There used to be a jsonSerialize() method on the PublicKeyCredentialCreationOptions but now that is gone.

json_encode should not be used as in 5.0.+ the objects do not implement the JsonSerializable interface.

But it looks like the serializePublicKeyCredential() method could be modified to accept PublicKeyCredentialCreationOptions.

I have tried this with a quick test by hacking the module and while it did serialize my object:

{"challenge":"1rdlxMvJcwva-KAWBVGp7Q","rp":{"id":"localhost","name":"Drupal","icon":""},"user":{"id":"MjkzZTE0NjQtZWU2Yy00NWEwLWFmM2UtNGI2ODlmNWFkYWRj","name":"goat@meals.com","displayName":"goat@meals.com"},"pubKeyCredParams":[{"type":"public-key","alg":-7},{"type":"public-key","alg":-257}],"authenticatorSelection":{"userVerification":"preferred","residentKey":"preferred"},"excludeCredentials":[]}

Passing that into simplewebauthn/browser startRegistration() resulted in "TypeError: base64URLString is undefined"

This used to work so I have confidence I'm not doing anything else stupid, but I'm unable to find why this is not working at the moment.

Proposed resolution

Add PublicKeyCredentialCreationOptions as allowed option to pass into Webauthn::serializePublicKeyCredential()

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom dahousecat

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024