feat(auth): support friendlyName and user.name fallback for WebAuthn passkey enrollment#1603
Conversation
…passkey enrollment
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
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. Comment |
Summary
Implements the WebAuthn MFA enrollment
friendlyNameanduser.namefallback from supabase-js in the Dart passkey API, reopening SDK-701 (previously resolved as not_applicable in #1556).GoTruePasskeyApi.startRegistration()now accepts an optionalfriendlyName. Between fetching the registration options and the platform ceremony, it backfillsoptions['user']['name'](anddisplayName) when the server omits it, usingfriendlyNameif 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()insupabase_flutterthreadsfriendlyNamethrough 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 meaningfuluser.name, so the fallback is load-bearing, not merely defensive.No passkeys library change needed
The
passkeysplugin'sUserTyperequires non-nullname/displayName. Because the fallback runs ingotruebefore 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 withfriendlyName, withoutfriendlyName(default), and the server-omits-user.namecase; plus a guard that a server-provideduser.nameis 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 toauth.passkey.register_passkey, which accepts afriendlyNameand applies the sameuser.namefallback. No new public symbols (optional named parameters only).Reference
supabase-js PR #1763, commit f99a58c.
Ref: SDK-701