Repository navigation
feat(auth): delete one of the signed-in user's passkeys - #637
Merged
Merged
Conversation
Adds IGotrueClient.DeletePasskeyAsync (DELETE /passkeys/{passkey_id}).
Refs #251
Tr00d
marked this pull request as ready for review
November 2, 2026 14:51
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 delete one of their own passkeys. This revokes the credential without admin privileges.
Capability:
auth.passkey.delete_passkey— Delete Passkey. No capability spec exists for it. Partially addresses #251.Public API
No new types.
Behavior
DELETE /auth/v1/passkeys/{passkey_id}, authenticated with the signed-in user's access token (Authorization: Bearer) and the apikey. The id goes on the path in its canonical lowercase form.Guid, so a malformed or path-escaping id cannot reach the wire. Before the wire the SDK requires the client to be online and a session with an access token to exist.GotrueException,Reason = Offline, no request sent.GotrueException,Reason = NoSessionFound, no request sent.insufficient_aalwhen the user has MFA enabled and the session is not at aal2 →GotrueExceptionwith thatErrorCode.validation_failed("Passkey not found") when the user has no passkey with that id. This is surfaced as aGotrueException(StatusCode404), not treated as an already-deleted success.passkey_disabledwhen passkeys are off on the server.GotrueExceptionwith the server'sErrorCode, through the existing error mapping.FailureHint.Reasonvalues.passkey_deletedaudit entry. Agotrue.delete_passkeyspan parents the HTTP span.Contract sources: the auth server's handler, since
supabase/authopenapi.yamldocuments no/passkeyspaths:internal/api/passkey_manage.go(PasskeyDelete)passkey_webauthn.go(requirePasskeyManagementAAL)middleware.go(requirePasskeyEnabled)Behavioral references:
auth-js/src/GoTrueClient.ts(_deletePasskey)d7eb4936)packages/supabase_auth/lib/src/auth_passkey_api.dart(delete())Deviations from supabase-js
_useSession) and supabase-flutter (delete()calls_userAccessToken, which goes throughgetSession,auth_client.dart:485) refresh an expired session first. This SDK uses the current access token, likeListPasskeysAsyncand the recovery-code methods.Guidid. Both references take a stringpasskeyId.{ data: null, error }. This returnsTaskand throws the typed exception on failure.Tests
DeletePasskeyTestsinsufficient_aal. The same user at aal2 (after verifying TOTP) deletes the passkey.DeletePasskeyContractTestsDELETE /passkeys/{id}with bearer + apikey and the canonical id; 204 completes;insufficient_aal, not-found 404 andpasskey_disabledsurfaced; NoSessionFound (no session / no access token, no request sent); Offline; cancellation reaches the HTTP call; no capture of the caller's context.ObservabilityContractTestsgotrue.delete_passkeydomain span parents theDELETE /passkeys/{id}HTTP span.Changed-line coverage: 100% (9 lines). Mutation: 7/7 tested mutants on changed lines killed, 0 survivors.
Notes
supabase/config.tomlpasskey block andGotrue.Tests/Support/SoftwareAuthenticatorfrom feat(auth): list the signed-in user's passkeys #634. The E2E checks deletion throughListPasskeysAsync, which is now on master./passkeysendpoints.