Skip to content

Example to illustrate the use of the Web Authentication API#629

Open
rebloor wants to merge 2 commits intomdn:mainfrom
rebloor:Bug-1956484-WebAuthn-example
Open

Example to illustrate the use of the Web Authentication API#629
rebloor wants to merge 2 commits intomdn:mainfrom
rebloor:Bug-1956484-WebAuthn-example

Conversation

@rebloor
Copy link
Copy Markdown
Collaborator

@rebloor rebloor commented Apr 5, 2026

Description

This is the example extension suggested in Bug 1956484 "Allow web extensions to assert WebAuthn relying party identifiers of a web domain they have host permissions for" to support the documentation about the Web Authentication API provided in mdn/content#43653.

To do

Add cross reference to the MDN documentation

@rebloor rebloor requested review from Rob--W and bacharakis April 5, 2026 17:47
@rebloor rebloor self-assigned this Apr 5, 2026
@rebloor rebloor added the example New or updated example label Apr 5, 2026
@rebloor rebloor requested a review from a team as a code owner April 5, 2026 17:47
@rebloor rebloor requested a review from LeoMcA April 5, 2026 17:47
Comment thread webauthn/manifest.json Outdated
Comment on lines +14 to +16
"permissions": [
"storage"
],
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rob--W is there any need for this? I can't see that we are using any APIs or features that need it. However, as I can't fully test the extension, I've not been able to confirm it's not needed for some reason.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed for this example, as the browser.storage API is not used anywhere.

Comment thread webauthn/manifest.json Outdated
Comment on lines +14 to +16
"permissions": [
"storage"
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed for this example, as the browser.storage API is not used anywhere.

Comment thread webauthn/manifest.json Outdated

"browser_specific_settings": {
"gecko": {
"id": "beastify@mozilla.org",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixup id please.

Comment thread webauthn/popup.js Outdated
const authButton = document.getElementById('authButton');
const optionsText = document.getElementById('optionsText');

// Helper function to convert a Base64 string to an ArrayBuffer
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the code example according to my review at mdn/content#43653 (review)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rob--W done. Also, note I added optional chaining to the options.allowCredentials processing.

@rebloor rebloor requested a review from Rob--W April 20, 2026 23:43
Copy link
Copy Markdown
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to examples.json looks fine

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

Labels

example New or updated example

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants