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)
| 41 | // - 200 OK: Returns the list of API keys |
| 42 | // - 500 Internal Server Error: If there's an error retrieving the keys |
| 43 | func (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 | // |
nothing calls this directly
no test coverage detected