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

Method HandleListAPIKeys

internal/auth/auth.go:823–841  ·  view source on GitHub ↗

HandleListAPIKeys lists API keys for the authenticated user (without key values).

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

821
822// HandleListAPIKeys lists API keys for the authenticated user (without key values).
823func (ua *UserAuth) HandleListAPIKeys(w http.ResponseWriter, r *http.Request) {
824 user := ua.AuthenticateRequest(r)
825 if user == nil {
826 http.Error(w, "not authenticated", http.StatusUnauthorized)
827 return
828 }
829
830 keys, err := ua.store.ListAPIKeys(r.Context(), user.ID)
831 if err != nil {
832 http.Error(w, "failed to list API keys", http.StatusInternalServerError)
833 return
834 }
835 if keys == nil {
836 keys = []identity.APIKey{}
837 }
838
839 w.Header().Set("Content-Type", "application/json")
840 writeJSON(w, keys)
841}
842
843// HandleDeleteAPIKey deletes an API key owned by the authenticated user.
844func (ua *UserAuth) HandleDeleteAPIKey(w http.ResponseWriter, r *http.Request) {

Calls 4

AuthenticateRequestMethod · 0.95
ListAPIKeysMethod · 0.80
writeJSONFunction · 0.70
ErrorMethod · 0.45