MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / DeleteAPIKey

Method DeleteAPIKey

internal/identity/store.go:3490–3501  ·  view source on GitHub ↗
(ctx context.Context, keyID, userID string)

Source from the content-addressed store, hash-verified

3488var ErrAPIKeyNotFound = errors.New("api key not found")
3489
3490func (s *Store) DeleteAPIKey(ctx context.Context, keyID, userID string) error {
3491 tag, err := s.pool.Exec(ctx,
3492 `UPDATE api_keys SET revoked_at = now() WHERE id = $1 AND user_id = $2 AND revoked_at IS NULL`, keyID, userID,
3493 )
3494 if err != nil {
3495 return err
3496 }
3497 if tag.RowsAffected() == 0 {
3498 return ErrAPIKeyNotFound
3499 }
3500 return nil
3501}
3502
3503// GetUserByAPIKey authenticates a bearer token and returns the owning
3504// user. Rejects revoked keys and time-expired keys; touches last_used_at

Callers 3

TestDeleteAPIKeyFunction · 0.95
handleDeleteAPIKeyMethod · 0.80
HandleDeleteAPIKeyMethod · 0.80

Implementers 1

Storeinternal/identity/store.go

Calls 1

ExecMethod · 0.65

Tested by 1

TestDeleteAPIKeyFunction · 0.76