- From: Matthew Miller via GitHub <sysbot+gh@w3.org>
- Date: Wed, 23 Mar 2022 22:51:58 +0000
- To: public-webauthn@w3.org
> > * `getCreationOptionsFromJSON()`
> > * `getRequestOptionsFromJSON()`
>
> This sounds reasonable on the surface, but I think `get` has the potential to be a _really_ confusing prefix, given that exactly one out of two of these results is passed to a function called `get`. 😳
Thank you for the feedback. Thinking about it from that perspective, I couldn't help but think about how the method would be consumed:
```js
const options = PublicKeyCredential.getRequestOptionsFromJSON({
'rpId': 'localhost',
'challenge': 'Ecue...5ZDE',
'allowCredentials': [
{
'id': 'ASdG...om6A',
'type': 'public-key',
'transports': ['internal'],
}
],
});
const resp = await navigator.credentials.get(options);
```
This seems fine to me, though. If `navigator.credentials.get()` were actually `PublicKeyCredential.get()` then I think I'd agree more strongly with you.
I'm trying _really_ hard not to end up with another `isUserVerifyingPlatformAuthenticatorAvailable()` method name. I already sacrificed the simple "`optionsFromJSON()`" name I originally wanted. If I don't use `get` as a prefix, though, I fear the next logical prefix would be something like `generate` or the even more "correct" `deserialize`...
- `PublicKeyCredential.deserializeCreationOptionsFromJSON()`
- `PublicKeyCredential.deserializeRequestOptionsFromJSON()`
It's happening again... 🙈
Maybe `parse`?
- `PublicKeyCredential.parseCreationOptionsFromJSON()`
- `PublicKeyCredential.parseRequestOptionsFromJSON()`
```js
const options = PublicKeyCredential.parseRequestOptionsFromJSON({
'rpId': 'localhost',
'challenge': 'Ecue...5ZDE',
'allowCredentials': [
{
'id': 'ASdG...om6A',
'type': 'public-key',
'transports': ['internal'],
}
],
});
const resp = await navigator.credentials.get(options);
```
--
GitHub Notification of comment by MasterKale
Please view or discuss this issue at https://github.com/w3c/webauthn/pull/1703#issuecomment-1076897270 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 23 March 2022 22:51:59 UTC