Re: [webauthn] New PublicKeyCredential methods for JSON (de)serialization (#1703)

Right now the method descriptions don't quite agree with the WebIDL definitions - the descriptions say that they take in and put out JSON, which would be DOMString values, but the definitions work with JavaScript objects. We need to clarify which of the two it is - probably the latter, since there's already the `JSON.parse()` and `.stringify()` methods to transform to/from JSON?

I'm not sure whether WebIDL allows the overloaded signature for `optionsFromJSON`, but either way I think the API is a bit confusing. Clearly the `method` property is meant for the client to decide which method variant is being called, but it's specified with default values, which would probably work against that? It might be better to split this function into two `PublicKeyCredentialCreationOptions.fromJson()` and `PublicKeyCredentialRequestOptions.fromJson()` functions, to clearly separate them.

---

> One thing I need help with (aside from review of the IDL definitions) is figuring out the proper way to address "FATAL ERROR"s like this:

These errors are because the WebIDL block is enclosed in the `<dl dfn-type="attribute" dfn-for="PublicKeyCredential">` tag with the member definitions, so Bikeshed looks for definitions like `PublicKeyCredential.Base64URLString` and fails to find them. I tried a couple things:

- Move the `toJSON()` block out of the parent `<dl>`. This fixes the errors and otherwise seems to still work, but it seems a bit strange to have `toJSON()` outside the definition list where it does belong (it's just the inline type definitions clashing a bit).
- Enclose the `<xmp>` with `<dl dfn-for="">`. This also seems to fix the errors and otherwise work, but I don't know how correct it is.

-- 
GitHub Notification of comment by emlun
Please view or discuss this issue at https://github.com/w3c/webauthn/pull/1703#issuecomment-1060800373 using your GitHub account


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

Received on Monday, 7 March 2022 15:18:15 UTC