bug(fix): Support webauthn implementations that return plain object#20401
Merged
vpomerleau merged 1 commit intomainfrom Apr 24, 2026
Merged
bug(fix): Support webauthn implementations that return plain object#20401vpomerleau merged 1 commit intomainfrom
vpomerleau merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses passkey/WebAuthn typing and compatibility issues encountered during passkey registration testing, including support for password manager “proxy” credential objects.
Changes:
- Duck-types WebAuthn credentials by checking for
toJSON()to support non-PublicKeyCredentialproxy objects (e.g., 1Password). - Fixes Buffer vs
Uint8Arraytype expectations in the server-side WebAuthn adapter foruserIDandpublicKey.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
packages/fxa-settings/src/lib/passkeys/webauthn.ts |
Adjusts credential handling to prefer toJSON() duck-typing over relying on instanceof PublicKeyCredential. |
libs/accounts/passkey/src/lib/webauthn-adapter.ts |
Converts Buffer inputs to Uint8Array for fields typed as Uint8Array by SimpleWebAuthn server types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b867902 to
6a5fea2
Compare
dschom
reviewed
Apr 23, 2026
| throw new DOMException(`${operation} returned null`, 'UnknownError'); | ||
| } | ||
| if (typeof (rawCredential as CredentialWithToJSON).toJSON === 'function') { | ||
| return (rawCredential as CredentialWithToJSON).toJSON!(); |
Contributor
There was a problem hiding this comment.
We shouldn't use !. A type guard should be able to avoid having to use the !.
6a5fea2 to
637b2ad
Compare
dschom
reviewed
Apr 24, 2026
| // ─── Credential extraction ────────────────────────────────────────────────── | ||
|
|
||
| /** Type guard for objects that can serialize to credential JSON. */ | ||
| function hasToJSON( |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Because
PublicKeyCredentialbut is not aninstanceofmatch, which broke the WebAuthn browser path.This pull request
Issue that this pull request solves
Closes: (issue number)
Checklist
Put an
xin the boxes that applyHow to review (Optional)
Screenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
This PR previously contained other types mismatches - these changes were moved to their own PR