Implements API key authentication for all rdev endpoints:
## Database (internal/db)
- Auto-migrating postgres connection
- Embedded SQL migrations via go:embed
- api_keys table with scopes, expiration, project restrictions
## Auth Package (internal/auth)
- Key generation: rdev_sk_<prefix>_<random> format
- Scopes: projects:read, projects:execute, keys:read, keys:write, admin
- SHA-256 key hashing (secrets never stored)
- Expiration options: 30d, 60d, 90d, 1y, never
- Middleware skips /health, /ready, /docs, /openapi.json
## Key Management API
- GET /keys - List keys (keys:read)
- POST /keys - Create key (keys:write)
- GET /keys/{id} - Get key details (keys:read)
- DELETE /keys/{id} - Revoke key (keys:write)
## Environment Variables
- DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME
- RDEV_ADMIN_KEY - Super admin key for bootstrapping
Version bumped to 0.5.0.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
12 lines
199 B
Modula-2
12 lines
199 B
Modula-2
module github.com/orchard9/rdev
|
|
|
|
go 1.23
|
|
|
|
require (
|
|
github.com/bdpiprava/scalar-go v0.13.0
|
|
github.com/go-chi/chi/v5 v5.1.0
|
|
github.com/lib/pq v1.10.9
|
|
)
|
|
|
|
require gopkg.in/yaml.v3 v3.0.1 // indirect
|