Skip to content

feat(auth): support friendlyName and user.name fallback for WebAuthn passkey enrollment#1603

Merged
spydon merged 2 commits into
mainfrom
worktree-SDK-701
Jul 15, 2026
Merged

feat(auth): support friendlyName and user.name fallback for WebAuthn passkey enrollment#1603
spydon merged 2 commits into
mainfrom
worktree-SDK-701

Conversation

@spydon

@spydon spydon commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the WebAuthn MFA enrollment friendlyName and user.name fallback from supabase-js in the Dart passkey API, reopening SDK-701 (previously resolved as not_applicable in #1556).

GoTruePasskeyApi.startRegistration() now accepts an optional friendlyName. Between fetching the registration options and the platform ceremony, it backfills options['user']['name'] (and displayName) when the server omits it, using friendlyName if given or a generic default (Passkey) otherwise. This mirrors supabase-js's pre-navigator.credentials.create() patch, expressed idiomatically without the ${user.id}: concatenation. GoTrueClientPasskey.registerPasskey() in supabase_flutter threads friendlyName through to the full ceremony.

Verify first (server behavior)

Confirmed against supabase/auth: webAuthnUser.WebAuthnName() returns the user's email or phone, and an empty string when the user has neither. The server therefore can omit a meaningful user.name, so the fallback is load-bearing, not merely defensive.

No passkeys library change needed

The passkeys plugin's UserType requires non-null name/displayName. Because the fallback runs in gotrue before the options reach the plugin, the plugin always receives a valid name and needs no change.

Outcome: implemented

Tests

  • packages/gotrue/test/passkey_test.dart: enrollment with friendlyName, without friendlyName (default), and the server-omits-user.name case; plus a guard that a server-provided user.name is preserved. All 20 passkey tests pass.

Compliance matrix

auth.mfa.enroll (partially_implemented): dropped the "WebAuthn has no Dart equivalent" caveat; the note now points to auth.passkey.register_passkey, which accepts a friendlyName and applies the same user.name fallback. No new public symbols (optional named parameters only).

Reference

supabase-js PR #1763, commit f99a58c.

Ref: SDK-701

@spydon
spydon requested a review from a team as a code owner July 15, 2026 09:58
@github-actions github-actions Bot added the auth This issue or pull request is related to authentication label Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@spydon, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f277823e-db0d-4ec9-b29c-9123b40166bf

📥 Commits

Reviewing files that changed from the base of the PR and between 20a82be and a7d4e4b.

📒 Files selected for processing (5)
  • packages/gotrue/lib/src/gotrue_passkey_api.dart
  • packages/gotrue/test/mocks/passkey_mock_client.dart
  • packages/gotrue/test/passkey_test.dart
  • packages/supabase_flutter/lib/src/supabase_passkey.dart
  • sdk-compliance.yaml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@spydon
spydon merged commit 558b034 into main Jul 15, 2026
31 checks passed
@spydon
spydon deleted the worktree-SDK-701 branch July 15, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth This issue or pull request is related to authentication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants