ScuttleBot
style: gofmt api key files
Commit
e6074da5483c324751b7e9808ba34e4ff3f3b8f217573ef63ac2ae9d07952933
Parent
2428c83591b1007…
2 files changed
+11
-11
+1
-1
+11
-11
| --- internal/api/apikeys.go | ||
| +++ internal/api/apikeys.go | ||
| @@ -13,26 +13,26 @@ | ||
| 13 | 13 | Scopes []string `json:"scopes"` |
| 14 | 14 | ExpiresIn string `json:"expires_in,omitempty"` // e.g. "720h" for 30 days, empty = never |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | type createAPIKeyResponse struct { |
| 18 | - ID string `json:"id"` | |
| 19 | - Name string `json:"name"` | |
| 20 | - Token string `json:"token"` // plaintext, shown only once | |
| 18 | + ID string `json:"id"` | |
| 19 | + Name string `json:"name"` | |
| 20 | + Token string `json:"token"` // plaintext, shown only once | |
| 21 | 21 | Scopes []auth.Scope `json:"scopes"` |
| 22 | - CreatedAt time.Time `json:"created_at"` | |
| 23 | - ExpiresAt *time.Time `json:"expires_at,omitempty"` | |
| 22 | + CreatedAt time.Time `json:"created_at"` | |
| 23 | + ExpiresAt *time.Time `json:"expires_at,omitempty"` | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | type apiKeyListEntry struct { |
| 27 | - ID string `json:"id"` | |
| 28 | - Name string `json:"name"` | |
| 27 | + ID string `json:"id"` | |
| 28 | + Name string `json:"name"` | |
| 29 | 29 | Scopes []auth.Scope `json:"scopes"` |
| 30 | - CreatedAt time.Time `json:"created_at"` | |
| 31 | - LastUsed *time.Time `json:"last_used,omitempty"` | |
| 32 | - ExpiresAt *time.Time `json:"expires_at,omitempty"` | |
| 33 | - Active bool `json:"active"` | |
| 30 | + CreatedAt time.Time `json:"created_at"` | |
| 31 | + LastUsed *time.Time `json:"last_used,omitempty"` | |
| 32 | + ExpiresAt *time.Time `json:"expires_at,omitempty"` | |
| 33 | + Active bool `json:"active"` | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // handleListAPIKeys handles GET /v1/api-keys. |
| 37 | 37 | func (s *Server) handleListAPIKeys(w http.ResponseWriter, r *http.Request) { |
| 38 | 38 | keys := s.apiKeys.List() |
| 39 | 39 |
| --- internal/api/apikeys.go | |
| +++ internal/api/apikeys.go | |
| @@ -13,26 +13,26 @@ | |
| 13 | Scopes []string `json:"scopes"` |
| 14 | ExpiresIn string `json:"expires_in,omitempty"` // e.g. "720h" for 30 days, empty = never |
| 15 | } |
| 16 | |
| 17 | type createAPIKeyResponse struct { |
| 18 | ID string `json:"id"` |
| 19 | Name string `json:"name"` |
| 20 | Token string `json:"token"` // plaintext, shown only once |
| 21 | Scopes []auth.Scope `json:"scopes"` |
| 22 | CreatedAt time.Time `json:"created_at"` |
| 23 | ExpiresAt *time.Time `json:"expires_at,omitempty"` |
| 24 | } |
| 25 | |
| 26 | type apiKeyListEntry struct { |
| 27 | ID string `json:"id"` |
| 28 | Name string `json:"name"` |
| 29 | Scopes []auth.Scope `json:"scopes"` |
| 30 | CreatedAt time.Time `json:"created_at"` |
| 31 | LastUsed *time.Time `json:"last_used,omitempty"` |
| 32 | ExpiresAt *time.Time `json:"expires_at,omitempty"` |
| 33 | Active bool `json:"active"` |
| 34 | } |
| 35 | |
| 36 | // handleListAPIKeys handles GET /v1/api-keys. |
| 37 | func (s *Server) handleListAPIKeys(w http.ResponseWriter, r *http.Request) { |
| 38 | keys := s.apiKeys.List() |
| 39 |
| --- internal/api/apikeys.go | |
| +++ internal/api/apikeys.go | |
| @@ -13,26 +13,26 @@ | |
| 13 | Scopes []string `json:"scopes"` |
| 14 | ExpiresIn string `json:"expires_in,omitempty"` // e.g. "720h" for 30 days, empty = never |
| 15 | } |
| 16 | |
| 17 | type createAPIKeyResponse struct { |
| 18 | ID string `json:"id"` |
| 19 | Name string `json:"name"` |
| 20 | Token string `json:"token"` // plaintext, shown only once |
| 21 | Scopes []auth.Scope `json:"scopes"` |
| 22 | CreatedAt time.Time `json:"created_at"` |
| 23 | ExpiresAt *time.Time `json:"expires_at,omitempty"` |
| 24 | } |
| 25 | |
| 26 | type apiKeyListEntry struct { |
| 27 | ID string `json:"id"` |
| 28 | Name string `json:"name"` |
| 29 | Scopes []auth.Scope `json:"scopes"` |
| 30 | CreatedAt time.Time `json:"created_at"` |
| 31 | LastUsed *time.Time `json:"last_used,omitempty"` |
| 32 | ExpiresAt *time.Time `json:"expires_at,omitempty"` |
| 33 | Active bool `json:"active"` |
| 34 | } |
| 35 | |
| 36 | // handleListAPIKeys handles GET /v1/api-keys. |
| 37 | func (s *Server) handleListAPIKeys(w http.ResponseWriter, r *http.Request) { |
| 38 | keys := s.apiKeys.List() |
| 39 |
+1
-1
| --- internal/auth/apikeys.go | ||
| +++ internal/auth/apikeys.go | ||
| @@ -37,11 +37,11 @@ | ||
| 37 | 37 | |
| 38 | 38 | // APIKey is a single API key record. |
| 39 | 39 | type APIKey struct { |
| 40 | 40 | ID string `json:"id"` |
| 41 | 41 | Name string `json:"name"` |
| 42 | - Hash string `json:"hash"` // SHA-256 of the plaintext token | |
| 42 | + Hash string `json:"hash"` // SHA-256 of the plaintext token | |
| 43 | 43 | Scopes []Scope `json:"scopes"` |
| 44 | 44 | CreatedAt time.Time `json:"created_at"` |
| 45 | 45 | LastUsed time.Time `json:"last_used,omitempty"` |
| 46 | 46 | ExpiresAt time.Time `json:"expires_at,omitempty"` // zero = never |
| 47 | 47 | Active bool `json:"active"` |
| 48 | 48 |
| --- internal/auth/apikeys.go | |
| +++ internal/auth/apikeys.go | |
| @@ -37,11 +37,11 @@ | |
| 37 | |
| 38 | // APIKey is a single API key record. |
| 39 | type APIKey struct { |
| 40 | ID string `json:"id"` |
| 41 | Name string `json:"name"` |
| 42 | Hash string `json:"hash"` // SHA-256 of the plaintext token |
| 43 | Scopes []Scope `json:"scopes"` |
| 44 | CreatedAt time.Time `json:"created_at"` |
| 45 | LastUsed time.Time `json:"last_used,omitempty"` |
| 46 | ExpiresAt time.Time `json:"expires_at,omitempty"` // zero = never |
| 47 | Active bool `json:"active"` |
| 48 |
| --- internal/auth/apikeys.go | |
| +++ internal/auth/apikeys.go | |
| @@ -37,11 +37,11 @@ | |
| 37 | |
| 38 | // APIKey is a single API key record. |
| 39 | type APIKey struct { |
| 40 | ID string `json:"id"` |
| 41 | Name string `json:"name"` |
| 42 | Hash string `json:"hash"` // SHA-256 of the plaintext token |
| 43 | Scopes []Scope `json:"scopes"` |
| 44 | CreatedAt time.Time `json:"created_at"` |
| 45 | LastUsed time.Time `json:"last_used,omitempty"` |
| 46 | ExpiresAt time.Time `json:"expires_at,omitempty"` // zero = never |
| 47 | Active bool `json:"active"` |
| 48 |