Repository navigation
feat(auth): list the signed-in user's passkeys - #634
Merged
Merged
Conversation
Adds IGotrueClient.ListPasskeysAsync (GET /passkeys), enables passkeys on the local stack and adds a software WebAuthn authenticator so E2E tests can seed passkeys. Refs #251
Tr00d
marked this pull request as ready for review
November 2, 2026 14:33
This was referenced Nov 2, 2026
This was referenced Nov 10, 2026
6 tasks
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.
Summary
A signed-in user can list the passkeys registered to their account, to review the credentials tied to it.
Capability:
auth.passkey.list_passkeys— List Passkeys. No capability spec exists for it. Partially addresses #251.Public API
New type,
Supabase.Gotrue.ListPasskeys.Passkey:Behavior
GET /auth/v1/passkeys, authenticated with the signed-in user's access token (Authorization: Bearer) and the apikey.created_atascending. Each JSON item{id, friendly_name?, created_at, last_used_at?}maps to aPasskey. An empty array or an absent body (null) maps to an empty list, never null. No authenticator assurance level is required.GotrueException,Reason = Offline, no request sent.GotrueException,Reason = NoSessionFound, no request sent.passkey_disabledwhen passkeys are off on the server →GotrueExceptionwith thatErrorCode. No newFailureHint.Reasonis added; the code is documented, as on the recovery-code methods.GotrueExceptionwith the server'sErrorCode, through the existing error mapping.gotrue.list_passkeysspan parents the HTTP span.Contract sources: the auth server's handler, since
supabase/authopenapi.yamldocuments no/passkeyspaths:internal/api/passkey_manage.go(PasskeyList,PasskeyListItem)api.goroutesmiddleware.go(requirePasskeyEnabled)Behavioral references:
auth-js/src/GoTrueClient.ts(_listPasskeys),lib/types.ts(PasskeyListItem)d7eb4936)packages/supabase_auth/lib/src/auth_passkey_api.dart(list),types/passkey.dart(Passkey, same shape as this one)Deviations from supabase-js
_useSession) and supabase-flutter (auth_client.dart:485,_userAccessTokenviagetSession) refresh an expired session first. This SDK uses the current access token, like the neighbouringGetUserIdentitiesAsyncand the recovery-code methods. Auto-refresh keeps that token fresh while it is enabled.Guidid. Both references expose the id as a string. The server always returns a UUID, and aGuidkeeps a malformed id out of the upcoming delete and update calls.data. This one returns a read-only list of immutable records and throws the typed exception on failure.Tests
ListPasskeysTestsFriendlyName = "Passkey"with noLastUsedAt. A user without passkeys gets an empty list.ListPasskeysContractTestsGET /passkeyswith bearer + apikey; item mapping incl. absent optional fields; empty array andnullbody → empty list;passkey_disabledsurfaced; NoSessionFound (no session / no access token, no request sent); Offline; cancellation reaches the HTTP call; no capture of the caller's context.ObservabilityContractTestsgotrue.list_passkeysdomain span parentsGET /passkeys.Changed-line coverage: 100% (28 lines). Mutation: 8/8 tested mutants on changed lines killed, 0 survivors.
Notes
supabase/config.tomlenables passkeys ([auth.passkey] enabled = true). The auth server's default is off, and every/passkeysroute answers 404passkey_disabledwhen it is off. The file also sets the WebAuthn relying party ([auth.webauthn],rp_id = "localhost", originhttp://localhost:3000).Gotrue.Tests/Support/SoftwareAuthenticatorseeds passkeys without a browser or hardware key. It runsPOST /passkeys/registration/options→/verifywith a plainHttpClient, answering the challenge with a fresh P-256 key in thenoneattestation format. The CBOR is hand-encoded, the same approach as supabase/auth'spasskey_virtual_authenticator_test.go. Delete and update passkey will reuse it. supabase-flutter's passkey tests are mock-only, so they do not exercise this route./passkeysendpoints.