Re: [webauthn] `publicKey` member name in `CredentialCreationRequestOptions` should be `"public-key"`, or vice-versa?

> and dispatches based on which it is

Right, the question is how that dispatch happens.  Looking at the linked code, it looks like Chrome hardcodes the fact that the  "publicKey" member maps to the PublicKeyCredential interface, right?

And then the PublicKeyCredential implementation is hardcoded to set "public-key" instead of having a `[[type]]` it gets from the interface object itself.

> I don't understand why these two strings need to be same

The spec is trying to do dispatch for all this stuff without hardcoding a specific list of possible credentials.  So it walks the list of all the interfaces looking for one whose `[[type]]` matches the dictionary member name _and_ it also uses `[[type]]` for the value of the `type` member.

The spec could switch to having two different internal slots, or to defining a mapping from dictionary member names to `[[type]]` values or vice versa.  Or it could explicitly list all the possible cases (which is what the Chrome code is doing, basically) and not have this problem at all, at the cost of making it harder for someone to add a new type of credential without changing the spec (arguably a good thing, actually).

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

Received on Thursday, 2 August 2018 17:46:12 UTC