Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the "name" field in PublicKeyCredentialEntity be marked required? #538

Closed
kpaulh opened this issue Aug 28, 2017 · 3 comments
Closed

Comments

@kpaulh
Copy link
Contributor

kpaulh commented Aug 28, 2017

https://w3c.github.io/webauthn/#dictionary-makecredentialoptions
The text says that the "name" field for both the rp and user are required. Should the IDL reflect that?
Same question for the "displayName" field for user.

@AngeloKai
Copy link
Contributor

The issue was brought up in past discussions around CredMan. If needed, I can dig up the related discussions. I believe the required keyword on IDL is omitted due to the need to integrate with CredMan. @mikewest probably has better memory about this. The argument is that it is ok for the keyword to be omitted as long as a DOM Exception error would be thrown.

On the code level, I believe the expectation is that instead of JS throwing a type error due to missing parameter, it now throws a DOM Exception error.

As for documentation, MDN just needs the document the difference.

@equalsJeffH
Copy link
Contributor

this is a good question. I attempted to find discussion about this in the public-webauthn archives but could not. I'm curious about the rationale details (I do not recall this discussion).

It appears the requisite DOM exception is indeed thrown in #createCredential step 3.

@AngeloKai
Copy link
Contributor

The RP and User dictionary both inherit from the same parent dictionary. Name is a common field that is shared between both dictionaries. But displayName and id are two fields that aren't shared. We decided to remove the required keyword and let JS throw the TypeError so that the inheritance would be clearer.

If a developer miss any of the required parameters listed in #createCredential step 3, a TypeError would be thrown. TypeError is the same error that will be thrown if there's a required keyword on the IDL. There will be a small difference about the order of when the error is thrown. If the required keyword is on the IDL, the error would likely be thrown first (depending on JS engine design). If the JS is checking whether the parameter is present, the error would likely be thrown after other checks. Either way, there is no difference for web developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants