MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / ListAPIKeys

Method ListAPIKeys

api/apikeys.go:43–57  ·  view source on GitHub ↗

ListAPIKeys lists all API keys for the authenticated user Parameters: - c: The Gin context containing the request and response Responses: - 200 OK: Returns the list of API keys - 500 Internal Server Error: If there's an error retrieving the keys

(c *gin.Context)

Source from the content-addressed store, hash-verified

41// - 200 OK: Returns the list of API keys
42// - 500 Internal Server Error: If there's an error retrieving the keys
43func (a Api) ListAPIKeys(c *gin.Context) {
44 owner := c.Query("owner")
45 if owner == "" {
46 c.JSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"})
47 return
48 }
49
50 keys, err := a.ledgerforge.ListAPIKeys(c.Request.Context(), owner)
51 if err != nil {
52 c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
53 return
54 }
55
56 c.JSON(http.StatusOK, keys)
57}
58
59// RevokeAPIKey revokes an API key
60//

Callers

nothing calls this directly

Calls 2

ListAPIKeysMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected