feat(18-02): REST API handlers for /api/v1/* endpoints

- Stats, keys, providers, scan, recon, dorks, config endpoints
- JSON response wrappers with proper tags for all entities
- Filtering, pagination, 404/204/202 status codes
- SSE hub stub (full impl in task 2)
- Resolved merge conflict in schema.sql
- 16 passing tests covering all endpoints
This commit is contained in:
salvacybersec
2026-04-06 18:05:39 +03:00
parent 17c17944aa
commit 76601b11b5
7 changed files with 962 additions and 19 deletions

34
pkg/web/server.go Normal file
View File

@@ -0,0 +1,34 @@
// Package web implements the KeyHunter embedded web dashboard and REST API.
package web
import (
"github.com/salvacybersec/keyhunter/pkg/dorks"
"github.com/salvacybersec/keyhunter/pkg/engine"
"github.com/salvacybersec/keyhunter/pkg/providers"
"github.com/salvacybersec/keyhunter/pkg/recon"
"github.com/salvacybersec/keyhunter/pkg/storage"
)
// ServerConfig holds all dependencies injected into the web Server.
type ServerConfig struct {
DB *storage.DB
EncKey []byte
Providers *providers.Registry
Dorks *dorks.Registry
ScanEngine *engine.Engine
ReconEngine *recon.Engine
}
// Server is the central HTTP server holding all handler dependencies.
type Server struct {
cfg ServerConfig
sse *SSEHub
}
// NewServer creates a Server with the given configuration.
func NewServer(cfg ServerConfig) *Server {
return &Server{
cfg: cfg,
sse: NewSSEHub(),
}
}