Repository navigation
feat(auth): list a user's passkeys as an admin - #651
Merged
Merged
Conversation
Tr00d
marked this pull request as ready for review
November 3, 2026 10:48
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
An admin client can list the passkeys a user has registered, with their names and when they were created and last used.
Capability:
auth.passkey_admin.list_passkeys— Admin List Passkeys. No capability spec exists.Public API
Passkey(Common/, unshipped) is reused unchanged; its summary now says "registered by a user" instead of "by the signed-in user".Behavior
GET /admin/users/{user_id}/passkeyswith a full-access key (service_role) as Bearer.userIdis aGuid, so it is always a valid path segment; no checks before the wire. No query, no body.created_at). An empty array,nullor absent body gives an empty list. Absentfriendly_name/last_used_atmap to null.GotrueException):no_authorization, 403bad_jwt/not_admin:Reason.AdminTokenRequired.user_not_found:Reason.UserNotFound.requirePasskeyEnabled, sopasskey_disabledcannot occur.user_not_foundis mapped globally inFailureHint. Every call answering it (GetUserById,UpdateFactorAsync,DeleteUser, adminSignOutAsync, …) now reportsReason.UserNotFoundinstead ofReason.Unknown;ErrorCodeis unchanged.Deviations from supabase-js
Guid userIdinstead of{ userId }with a runtime UUID check: the type guarantees the UUID.GotrueExceptioninstead of{ data, error }.ListFactors/UpdateFactorAsync, instead of anadmin.passkeysub-object.IGotrueApitwin is namedAdminListPasskeysAsync, notListPasskeysAsync. An overload beside the user-levelListPasskeysAsync(string jwt, CancellationToken = default)trips RS0026 (multiple public overloads with optional parameters), and "User" would be ambiguous with that user-level operation, which lists the signed-in user's passkeys. TheAdminprefix is applied onIGotrueApionly where an admin twin collides with a user-level operation, so released admin twins stay unprefixed.Tests
AdminListPasskeysTestsUserNotFoundfor an unknown user;AdminTokenRequiredfor the anon keyAdminListPasskeysContractTestsnullbody;user_not_foundandnot_adminmapping; cancellation before the wire; no context captureFailureHintTestsuser_not_foundmaps toReason.UserNotFoundChanged-line coverage: 100% (7 lines). Mutation: 3/3 on changed lines killed, 0 survivors.
Notes
supabase/config.tomlchange: the admin route is served regardless of[auth.passkey]; the existing passkey settings are only needed to seed passkeys through the registration ceremony in E2E.internal/api/passkey_admin.go(served since gotrue v2.197.0 at the latest).