This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Conversation
… methods if available.
Contributor
🚀 Preview Release Statusfalse Last updated: 2025-09-24T14:20:00Z |
hf
reviewed
Sep 18, 2025
hf
approved these changes
Sep 19, 2025
Contributor
hf
left a comment
There was a problem hiding this comment.
A huge amount of effort but is great! Left comments on Slack for minor improvements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Feature - This PR introduces YubiKey support for Multi-Factor Authentication (MFA) via WebAuthn, enabling users to authenticate with hardware security keys.
What is the current behavior?
Currently, Supabase Auth JS supports two MFA methods:
What is the new behavior?
This PR adds full WebAuthn support to the authentication library, the defaults enable yubikey support at the moment, but it allows the user to override some parameters client-side to use other types of passkey methods.
The PR adds the 'webauthn' factor type, to
listFactors,enroll(),challenge(), andverify()(De)serialization of the webauthn reponse/credential object is done behind the scenes via dedicated objects.
it also adds a new
experimentalnamespace.mfa.webauthnwhich has a.register()and.authenticate()methods, these methods allows single click yubikey 2FA addition with a single function call.additionally, we have
webauthn.{enroll|challenge|verify}(), which abstract away some of the logic surrounding enrollment, interaction with the verifier, and have defaults for factortype etc.Two ways to use the new api:
Single Step
Multi Step Composition
Additional context
While this PR focuses on YubiKey support, the architecture is designed to accommodate additional authenticator types in future releases (platform authenticators, passkeys, etc.) without requiring significant refactoring.
I've added
webauthn.dom.tsandwebauthn.errors.tswhich attempt to augment the typescript interfaces for webauthn since they are out of date and there are some new features that its not aware of yet but are publicly available in all major browsers.For all such types, and due to the complexity of the API, I've added comprehensive jsdocs for each parameter with reference to the w3a spec for reference on their usage.
in all webauthn related methods, I've added the ability to override any of the parameters we pass by default to the
credentials.{get|create}()method for convenience.This PR is dependent on my previous PR for streamlining types #1116
and this PR for
authsupabase/auth#2163