Re: [webauthn] Provide request deserialization, response serialization (#1683)

> > ...if someone is willing to push for it...
> 
> I'll take this on. I'll try and get a draft PR up before too long, I know it'll need a lot of TLC but I think it'd be a worthwhile addition to the spec.

The WebIDL spec already allows for interfaces to provide a [`toJSON()` method](https://webidl.spec.whatwg.org/#idl-tojson-operation). So I could see us here doing something like adding a `toJSON()` operation to the `AuthenticatorAttestationResponse` and `AuthenticatorAssertionResponse` interfaces. Those methods would return a JSON object for the attribute members of those interfaces, with ArrayBuffer valued attributes converted to base64url encoded strings.

WebIDL doesn't have similar "fromJSON" provisions AFAIK. But if we wanted to allow instantiation of `PublicKeyCredentialCreation/RequestOptions` from a server-supplied JSON object, we could e.g. define `PublicKeyCredential.publicKeyCredentialCreation{Creation,Request}OptionsFromJson()`, with basically the inverse conversion rules of `toJSON()`. I.e., callers pass a JSON object with the respective members, and the method returns an equivalent dictionary with ArrayBuffer-valued attribute values parsed from their base64url encoding.

-- 
GitHub Notification of comment by kreichgauer
Please view or discuss this issue at https://github.com/w3c/webauthn/issues/1683#issuecomment-975855036 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 22 November 2021 19:36:00 UTC