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

fix/597-shadow-dom-support #621

Merged
merged 5 commits into from
Oct 6, 2024
Merged

fix/597-shadow-dom-support #621

merged 5 commits into from
Oct 6, 2024

Conversation

MasterKale
Copy link
Owner

@MasterKale MasterKale commented Oct 6, 2024

This PR adds a new verifyBrowserAutofillInput options to @simplewebauthn/browser's startAuthentication(). When set to false the method will no longer raise an error when it cannot find a suitable <input autocomplete="... webauthn"> element.

Most users of this method shouldn't need to use this new flag. However projects using e.g. shadow components which contain an otherwise suitable element for conditional UI can use this new flag to benefit from startAuthentication() as well.

Fixes #597.

Breaking Changes

startAuthentication() now uses an option object

Positional arguments have been replaced by a single object containing all options. Keywords match the name of the previously positional arguments.

To update existing implementations, wrap existing options in an object with corresponding properties:

Before:

startAuthentication(options, true);

After:

startAuthentication({ optionsJSON: options, useBrowserAutofill: true });

startRegistration() now uses an option object

Positional arguments have been replaced by a single object containing all options. Keywords match the name of the previously positional arguments.

To update existing implementations, wrap existing options in an object with corresponding properties:

Before:

startRegistration(options);

After:

startRegistration({ optionsJSON: options });

(It may seem premature to make this change to startRegistration() too, but this is in preparation for #582)

@MasterKale MasterKale added this to the v10.1.0 milestone Oct 6, 2024
@MasterKale MasterKale added the package:browser @simplewebauthn/browser label Oct 6, 2024
@MasterKale MasterKale merged commit 3c613f4 into master Oct 6, 2024
1 check passed
@MasterKale MasterKale deleted the fix/597-shadow-dom-support branch October 6, 2024 20:28
@treeder
Copy link

treeder commented Oct 6, 2024

Curious why you didn't call it options instead of optionsJSON? It's not actually a JSON string is it?

@MasterKale
Copy link
Owner Author

Curious why you didn't call it options instead of optionsJSON? It's not actually a JSON string is it?

Historically that option has been called optionsJSON to try and communicate that the input is not standard WebAuthn options (e.g. PublicKeyCredentialCreationOptions) but the JSON-ified output of them from the corresponding generate...Options() method in @simplewebauthn/server (e.g. PublicKeyCredentialCreationOptionsJSON that just arrived in the browser as JSON.)

I debated a different name but figured the goal remains unchanged so I'm sticking with it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:browser @simplewebauthn/browser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The check for browser auto fill doesn't take into account shadow DOMs (ie: web components)
2 participants