Documentation
¶
Overview ¶
Package api provides HTTP handlers for the OzyBase Core.
Index ¶
- func APIKeyMiddleware(db *data.DB) echo.MiddlewareFunc
- func APIVersionHeader(version string) echo.MiddlewareFunc
- func AccessMiddleware(db *data.DB, requirement string) echo.MiddlewareFunc
- func AuthMiddleware(db *data.DB, jwtSecret string, optional bool) echo.MiddlewareFunc
- func ConstantTimeCompare(a, b string) bool
- func GenerateRandomKey() (string, error)
- func IsCommonPassword(password string) bool
- func MetricsMiddleware(h *Handler) echo.MiddlewareFunc
- func PrometheusMiddleware() echo.MiddlewareFunc
- func RLSMiddleware(db *data.DB) echo.MiddlewareFunc
- func RegisterPrometheus(e *echo.Echo)
- func RegisterStaticRoutes(e *echo.Echo)
- func RequireRole(requiredRole string) echo.MiddlewareFunc
- func SecurityHeadersDefault() echo.MiddlewareFunc
- func SecurityHeadersMiddleware(config SecurityConfig) echo.MiddlewareFunc
- func TimeoutMiddleware(timeout time.Duration) echo.MiddlewareFunc
- func ValidateEmail(email string) error
- func ValidatePasswordComplexity(password string, policy PasswordPolicy) error
- func ValidatePasswordSimple(password string) error
- func WorkspaceMiddleware(db *data.DB, jwtSecret string) echo.MiddlewareFunc
- type APIKey
- type AnalyticsHandler
- type AuthHandler
- func (h *AuthHandler) ConfirmReset(c echo.Context) error
- func (h *AuthHandler) GetOAuthURL(c echo.Context) error
- func (h *AuthHandler) ListSessions(c echo.Context) error
- func (h *AuthHandler) Login(c echo.Context) error
- func (h *AuthHandler) OAuthCallback(c echo.Context) error
- func (h *AuthHandler) RequestReset(c echo.Context) error
- func (h *AuthHandler) RevokeSession(c echo.Context) error
- func (h *AuthHandler) Signup(c echo.Context) error
- func (h *AuthHandler) UpdateRole(c echo.Context) error
- func (h *AuthHandler) VerifyEmail(c echo.Context) error
- type AuthRequest
- type AuthService
- type Collection
- type CreateCollectionRequest
- type CronHandler
- type CronJobInfo
- type DbMetrics
- type ExtensionInfo
- type FileHandler
- type FixHealthRequest
- type FunctionInfo
- type FunctionsHandler
- type GeoStat
- type Handler
- func (h *Handler) AddColumn(c echo.Context) error
- func (h *Handler) AddNotificationRecipient(c echo.Context) error
- func (h *Handler) CreateAPIKey(c echo.Context) error
- func (h *Handler) CreateCollection(c echo.Context) error
- func (h *Handler) CreateIPRule(c echo.Context) error
- func (h *Handler) CreateIntegration(c echo.Context) error
- func (h *Handler) CreateRecord(c echo.Context) error
- func (h *Handler) CreateSecret(c echo.Context) error
- func (h *Handler) CreateWrapper(c echo.Context) error
- func (h *Handler) DeleteAPIKey(c echo.Context) error
- func (h *Handler) DeleteCollection(c echo.Context) error
- func (h *Handler) DeleteColumn(c echo.Context) error
- func (h *Handler) DeleteIPRule(c echo.Context) error
- func (h *Handler) DeleteIntegration(c echo.Context) error
- func (h *Handler) DeleteNotificationRecipient(c echo.Context) error
- func (h *Handler) DeleteRecord(c echo.Context) error
- func (h *Handler) DeleteSecret(c echo.Context) error
- func (h *Handler) DeleteWrapper(c echo.Context) error
- func (h *Handler) ExportLogs(c echo.Context) error
- func (h *Handler) FirewallMiddleware() echo.MiddlewareFunc
- func (h *Handler) FixHealthIssues(c echo.Context) error
- func (h *Handler) GetGeoStats(c echo.Context) error
- func (h *Handler) GetHealthIssues(c echo.Context) error
- func (h *Handler) GetLogs(c echo.Context) error
- func (h *Handler) GetNotificationRecipients(c echo.Context) error
- func (h *Handler) GetProjectInfo(c echo.Context) error
- func (h *Handler) GetPrometheusMetrics(c echo.Context) error
- func (h *Handler) GetRecord(c echo.Context) error
- func (h *Handler) GetSecurityAlerts(c echo.Context) error
- func (h *Handler) GetSecurityPolicies(c echo.Context) error
- func (h *Handler) GetSecurityStats(c echo.Context) error
- func (h *Handler) GetStats(c echo.Context) error
- func (h *Handler) GetSystemStatus(c echo.Context) error
- func (h *Handler) GetTableSchema(c echo.Context) error
- func (h *Handler) GetTrafficStats(c echo.Context) error
- func (h *Handler) GetVisualizeSchema(c echo.Context) error
- func (h *Handler) HandleExecuteSQL(c echo.Context) error
- func (h *Handler) HandleGraphQL(c echo.Context) error
- func (h *Handler) HandleSyncSystem(c echo.Context) error
- func (h *Handler) Health(c echo.Context) error
- func (h *Handler) ImportRecords(c echo.Context) error
- func (h *Handler) ListAPIKeys(c echo.Context) error
- func (h *Handler) ListCollections(c echo.Context) error
- func (h *Handler) ListExtensions(c echo.Context) error
- func (h *Handler) ListIPRules(c echo.Context) error
- func (h *Handler) ListIntegrations(c echo.Context) error
- func (h *Handler) ListRecords(c echo.Context) error
- func (h *Handler) ListSchemas(c echo.Context) error
- func (h *Handler) ListSecrets(c echo.Context) error
- func (h *Handler) ListWrappers(c echo.Context) error
- func (h *Handler) SetupSystem(c echo.Context) error
- func (h *Handler) StartLogCleaner(ctx context.Context)
- func (h *Handler) StartLogExporter(ctx context.Context)
- func (h *Handler) TestIntegration(c echo.Context) error
- func (h *Handler) ToggleAPIKey(c echo.Context) error
- func (h *Handler) ToggleExtension(c echo.Context) error
- func (h *Handler) UpdateCollectionRules(c echo.Context) error
- func (h *Handler) UpdateRealtimeToggle(c echo.Context) error
- func (h *Handler) UpdateRecord(c echo.Context) error
- func (h *Handler) UpdateSecurityPolicy(c echo.Context) error
- type HealthIssue
- type HealthResponse
- type IPRule
- type IPStat
- type LogEntry
- type Metrics
- type PasswordPolicy
- type ProjectInfo
- type RealtimeHandler
- type SQLExecuteRequest
- type SQLExecuteResponse
- type SQLSyncResponse
- type Secret
- type SecurityConfig
- type SecurityStats
- type SlowQuery
- type TimelineEvent
- type TwoFactorHandler
- type ValidationError
- type WebhookHandler
- type WebhookInfo
- type WorkspaceHandler
- func (h *WorkspaceHandler) AddMember(c echo.Context) error
- func (h *WorkspaceHandler) Create(c echo.Context) error
- func (h *WorkspaceHandler) Delete(c echo.Context) error
- func (h *WorkspaceHandler) List(c echo.Context) error
- func (h *WorkspaceHandler) ListMembers(c echo.Context) error
- func (h *WorkspaceHandler) RemoveMember(c echo.Context) error
- func (h *WorkspaceHandler) Update(c echo.Context) error
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIKeyMiddleware ¶ added in v1.1.1
func APIKeyMiddleware(db *data.DB) echo.MiddlewareFunc
APIKeyMiddleware validates OzyBase API keys (Enterprise Phase 1)
func APIVersionHeader ¶
func APIVersionHeader(version string) echo.MiddlewareFunc
APIVersionHeader adds API version header to responses
func AccessMiddleware ¶
func AccessMiddleware(db *data.DB, requirement string) echo.MiddlewareFunc
AccessMiddleware checks per-collection permissions (ACL)
func AuthMiddleware ¶
func ConstantTimeCompare ¶
ConstantTimeCompare performs a constant-time comparison of two strings This prevents timing attacks when comparing sensitive data like tokens
func GenerateRandomKey ¶ added in v1.1.1
GenerateRandomKey creates a new random secure key
func IsCommonPassword ¶
IsCommonPassword checks if the password is in a list of common passwords
func MetricsMiddleware ¶ added in v1.1.1
func MetricsMiddleware(h *Handler) echo.MiddlewareFunc
MetricsMiddleware tracks activity for the dashboard and persists audit logs
func PrometheusMiddleware ¶ added in v1.1.1
func PrometheusMiddleware() echo.MiddlewareFunc
PrometheusMiddleware is a placeholder for custom Prometheus request tracking (Enterprise Phase 1)
func RLSMiddleware ¶ added in v1.1.1
func RLSMiddleware(db *data.DB) echo.MiddlewareFunc
RLSMiddleware injects user context into Postgres for the duration of the request
func RegisterPrometheus ¶ added in v1.1.1
RegisterPrometheus registers the metrics endpoint (Enterprise Phase 1)
func RegisterStaticRoutes ¶
RegisterStaticRoutes registers the routes for serving the embedded frontend
func RequireRole ¶ added in v1.1.1
func RequireRole(requiredRole string) echo.MiddlewareFunc
RequireRole enforces an exact role match for sensitive routes.
func SecurityHeadersDefault ¶
func SecurityHeadersDefault() echo.MiddlewareFunc
SecurityHeadersDefault is a convenience function using default config
func SecurityHeadersMiddleware ¶
func SecurityHeadersMiddleware(config SecurityConfig) echo.MiddlewareFunc
SecurityHeadersMiddleware adds security headers to all responses
func TimeoutMiddleware ¶
func TimeoutMiddleware(timeout time.Duration) echo.MiddlewareFunc
TimeoutMiddleware adds a timeout to each request
func ValidateEmail ¶
ValidateEmail validates email format using regex for more precise control
func ValidatePasswordComplexity ¶
func ValidatePasswordComplexity(password string, policy PasswordPolicy) error
ValidatePasswordComplexity validates password against the policy
func ValidatePasswordSimple ¶
ValidatePasswordSimple performs basic password validation (minimum length only) Use this for less strict environments, ValidatePasswordComplexity for production
func WorkspaceMiddleware ¶ added in v1.1.1
func WorkspaceMiddleware(db *data.DB, jwtSecret string) echo.MiddlewareFunc
WorkspaceMiddleware ensures the user has access to the requested workspace
Types ¶
type APIKey ¶ added in v1.1.1
type APIKey struct {
ID string `json:"id"`
Name string `json:"name"`
Prefix string `json:"prefix"`
Role string `json:"role"`
IsActive bool `json:"is_active"`
ExpiresAt *time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
LastUsedAt *time.Time `json:"last_used_at"`
WorkspaceID string `json:"workspace_id,omitempty"`
}
type AnalyticsHandler ¶ added in v1.1.1
type AnalyticsHandler struct {
Handler *Handler
}
AnalyticsHandler handles high-performance analytics queries
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func NewAuthHandler ¶
func NewAuthHandler(authService AuthService) *AuthHandler
func (*AuthHandler) ConfirmReset ¶ added in v1.1.1
func (h *AuthHandler) ConfirmReset(c echo.Context) error
func (*AuthHandler) GetOAuthURL ¶ added in v1.1.1
func (h *AuthHandler) GetOAuthURL(c echo.Context) error
func (*AuthHandler) ListSessions ¶ added in v1.1.1
func (h *AuthHandler) ListSessions(c echo.Context) error
func (*AuthHandler) OAuthCallback ¶ added in v1.1.1
func (h *AuthHandler) OAuthCallback(c echo.Context) error
func (*AuthHandler) RequestReset ¶ added in v1.1.1
func (h *AuthHandler) RequestReset(c echo.Context) error
func (*AuthHandler) RevokeSession ¶ added in v1.1.1
func (h *AuthHandler) RevokeSession(c echo.Context) error
func (*AuthHandler) UpdateRole ¶ added in v1.1.1
func (h *AuthHandler) UpdateRole(c echo.Context) error
func (*AuthHandler) VerifyEmail ¶ added in v1.1.1
func (h *AuthHandler) VerifyEmail(c echo.Context) error
type AuthRequest ¶
type AuthService ¶ added in v1.1.1
type AuthService interface {
Signup(ctx context.Context, email, password string) (*core.User, error)
Login(ctx context.Context, email, password string) (*core.AuthLoginResult, error)
RequestPasswordReset(ctx context.Context, email string) (string, error)
ConfirmPasswordReset(ctx context.Context, token, newPassword string) error
VerifyEmail(ctx context.Context, token string) error
UpdateUserRole(ctx context.Context, userID, newRole string) error
HandleOAuthLogin(ctx context.Context, provider, providerID, email string, data map[string]any) (string, *core.User, error)
ListSessions(ctx context.Context, userID string) ([]core.Session, error)
RevokeSession(ctx context.Context, sessionID, userID string) error
}
type Collection ¶
type Collection struct {
ID string `json:"id"`
Name string `json:"name"`
IsSystem bool `json:"is_system"`
Schema []data.FieldSchema `json:"schema"`
ListRule string `json:"list_rule"`
CreateRule string `json:"create_rule"`
RlsEnabled bool `json:"rls_enabled"`
RlsRule string `json:"rls_rule"`
RealtimeEnabled bool `json:"realtime_enabled"`
WorkspaceID string `json:"workspace_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Collection represents a collection in the system
type CreateCollectionRequest ¶
type CreateCollectionRequest struct {
Name string `json:"name"`
Schema []data.FieldSchema `json:"schema"`
ListRule string `json:"list_rule"` // "public", "auth", "admin"
CreateRule string `json:"create_rule"` // "auth", "admin"
RlsEnabled bool `json:"rls_enabled"`
RlsRule string `json:"rls_rule"`
RealtimeEnabled bool `json:"realtime_enabled"`
WorkspaceID string `json:"workspace_id"`
}
CreateCollectionRequest represents the request to create a new collection
type CronHandler ¶ added in v1.1.1
type CronHandler struct {
DB *data.DB
Cron *realtime.CronManager
}
func NewCronHandler ¶ added in v1.1.1
func NewCronHandler(db *data.DB, cronMgr *realtime.CronManager) *CronHandler
type CronJobInfo ¶ added in v1.1.1
type DbMetrics ¶ added in v1.1.1
type DbMetrics struct {
DbRequests int `json:"db_requests"`
AuthRequests int `json:"auth_requests"`
StorageRequests int `json:"storage_requests"`
RealtimeRequests int `json:"realtime_requests"`
DbHistory []int `json:"db_history"`
AuthHistory []int `json:"auth_history"`
StorageHistory []int `json:"storage_history"`
RealtimeHistory []int `json:"realtime_history"`
CpuHistory []float64 `json:"cpu_history"`
RamHistory []float64 `json:"ram_history"`
}
type ExtensionInfo ¶ added in v1.1.1
type FileHandler ¶
FileHandler handles file uploads and storage policies
func NewFileHandler ¶
func NewFileHandler(db *data.DB, storageDir string) *FileHandler
NewFileHandler creates a new instance of FileHandler
func (*FileHandler) CreateBucket ¶ added in v1.1.1
func (h *FileHandler) CreateBucket(c echo.Context) error
CreateBucket handles POST /api/files/buckets
func (*FileHandler) List ¶ added in v1.1.1
func (h *FileHandler) List(c echo.Context) error
List handles GET /api/files
func (*FileHandler) ListBuckets ¶ added in v1.1.1
func (h *FileHandler) ListBuckets(c echo.Context) error
ListBuckets handles GET /api/files/buckets
type FixHealthRequest ¶ added in v1.1.1
FixHealthRequest represents a request to fix a health issue
type FunctionInfo ¶ added in v1.1.1
type FunctionsHandler ¶ added in v1.1.1
func NewFunctionsHandler ¶ added in v1.1.1
func NewFunctionsHandler(db *data.DB, dir string) *FunctionsHandler
func (*FunctionsHandler) Create ¶ added in v1.1.1
func (h *FunctionsHandler) Create(c echo.Context) error
func (*FunctionsHandler) Invoke ¶ added in v1.1.1
func (h *FunctionsHandler) Invoke(c echo.Context) error
func (*FunctionsHandler) List ¶ added in v1.1.1
func (h *FunctionsHandler) List(c echo.Context) error
func (*FunctionsHandler) ListExtensions ¶ added in v1.1.1
func (h *FunctionsHandler) ListExtensions(c echo.Context) error
type Handler ¶
type Handler struct {
DB *data.DB
Metrics *Metrics
Broker *realtime.Broker
Webhooks *realtime.WebhookDispatcher
Geo *core.GeoService
Mailer mailer.Mailer
Integrations *realtime.WebhookIntegration
Auth *core.AuthService
Audit *core.AuditService
Storage storage.Provider
PubSub realtime.PubSub
Migrations *migrations.Generator
Applier *migrations.Applier
StartTime time.Time
}
Handler holds dependencies for HTTP handlers
func NewHandler ¶
func NewHandler(db *data.DB, broker *realtime.Broker, webhooks *realtime.WebhookDispatcher, mailSvc mailer.Mailer, storageSvc storage.Provider, ps realtime.PubSub, migrator *migrations.Generator, applier *migrations.Applier, audit *core.AuditService) *Handler
NewHandler creates a new Handler with the given dependencies
func (*Handler) AddNotificationRecipient ¶ added in v1.1.1
AddNotificationRecipient handles POST /api/project/security/notifications
func (*Handler) CreateCollection ¶
CreateCollection handles POST /api/collections
func (*Handler) CreateIntegration ¶ added in v1.1.1
CreateIntegration handles POST /api/project/integrations
func (*Handler) CreateRecord ¶
CreateRecord handles POST /api/collections/:name/records
func (*Handler) CreateWrapper ¶ added in v1.1.1
func (*Handler) DeleteCollection ¶ added in v1.1.1
DeleteCollection handles DELETE /api/collections/:name
func (*Handler) DeleteColumn ¶ added in v1.1.1
DeleteColumn handles DELETE /api/tables/:name/columns/:col
func (*Handler) DeleteIntegration ¶ added in v1.1.1
DeleteIntegration handles DELETE /api/project/integrations/:id
func (*Handler) DeleteNotificationRecipient ¶ added in v1.1.1
DeleteNotificationRecipient handles DELETE /api/project/security/notifications/:id
func (*Handler) DeleteRecord ¶ added in v1.1.1
DeleteRecord handles DELETE /api/collections/:name/records/:id
func (*Handler) DeleteWrapper ¶ added in v1.1.1
func (*Handler) ExportLogs ¶ added in v1.1.1
ExportLogs handles GET /api/project/logs/export
func (*Handler) FirewallMiddleware ¶ added in v1.1.1
func (h *Handler) FirewallMiddleware() echo.MiddlewareFunc
FirewallMiddleware checks every request against the IP blacklist/whitelist
func (*Handler) FixHealthIssues ¶ added in v1.1.1
FixHealthIssues handles POST /api/project/health/fix
func (*Handler) GetGeoStats ¶ added in v1.1.1
GetGeoStats returns traffic distribution by country
func (*Handler) GetHealthIssues ¶ added in v1.1.1
GetHealthIssues handles GET /api/project/health
func (*Handler) GetLogs ¶ added in v1.1.1
GetLogs handles GET /api/project/logs Supports ?source=memory for real-time live tail (in-memory buffer) Defaults to database source for historical explorer view
func (*Handler) GetNotificationRecipients ¶ added in v1.1.1
GetNotificationRecipients handles GET /api/project/security/notifications
func (*Handler) GetProjectInfo ¶ added in v1.1.1
GetProjectInfo handles GET /api/project/info
func (*Handler) GetPrometheusMetrics ¶ added in v1.1.1
GetPrometheusMetrics returns Go runtime statistics in Prometheus format
func (*Handler) GetSecurityAlerts ¶ added in v1.1.1
GetSecurityAlerts handles GET /api/project/security/alerts
func (*Handler) GetSecurityPolicies ¶ added in v1.1.1
GetSecurityPolicies handles GET /api/project/security/policies
func (*Handler) GetSecurityStats ¶ added in v1.1.1
GetSecurityStats handles GET /api/project/security/stats
func (*Handler) GetSystemStatus ¶ added in v1.1.1
GetSystemStatus checks if the system is initialized (has an admin user)
func (*Handler) GetTableSchema ¶
GetTableSchema handles GET /api/schema/:name
func (*Handler) GetTrafficStats ¶ added in v1.1.1
GetTrafficStats returns aggregated traffic data (requests per minute/hour) This leverages PostgreSQL's speed instead of JS client-side processing
func (*Handler) GetVisualizeSchema ¶ added in v1.1.1
GetVisualizeSchema handles GET /api/collections/visualize
func (*Handler) HandleExecuteSQL ¶ added in v1.1.1
HandleExecuteSQL executes a raw SQL query provided by the admin
func (*Handler) HandleGraphQL ¶ added in v1.1.1
GRAPHQL HANDLER
func (*Handler) HandleSyncSystem ¶ added in v1.1.1
HandleSyncSystem triggers the internal migrations to repair system schema
func (*Handler) ImportRecords ¶ added in v1.1.1
ImportRecords handles POST /api/tables/:name/import
func (*Handler) ListCollections ¶
ListCollections handles GET /api/collections
func (*Handler) ListExtensions ¶ added in v1.1.1
I will move this to handlers.go or a new extensions.go that uses Handler struct
func (*Handler) ListIntegrations ¶ added in v1.1.1
ListIntegrations handles GET /api/project/integrations
func (*Handler) ListRecords ¶
ListRecords handles GET /api/collections/:name/records
func (*Handler) ListSchemas ¶ added in v1.1.1
ListSchemas handles GET /api/schemas
func (*Handler) ListSecrets ¶ added in v1.1.1
VAULT HANDLERS
func (*Handler) ListWrappers ¶ added in v1.1.1
WRAPPERS HANDLERS
func (*Handler) SetupSystem ¶ added in v1.1.1
SetupSystem handles the initial setup (First Time Run)
func (*Handler) StartLogCleaner ¶ added in v1.1.1
StartLogCleaner removes logs older than 30 days every 24 hours
func (*Handler) StartLogExporter ¶ added in v1.1.1
StartLogExporter starts a background worker to flush logs to SIEM
func (*Handler) TestIntegration ¶ added in v1.1.1
TestIntegration handles POST /api/project/integrations/:id/test
func (*Handler) ToggleExtension ¶ added in v1.1.1
func (*Handler) UpdateCollectionRules ¶ added in v1.1.1
UpdateCollectionRules handles PATCH /api/collections/rules
func (*Handler) UpdateRealtimeToggle ¶ added in v1.1.1
UpdateRealtimeToggle handles PATCH /api/collections/realtime
func (*Handler) UpdateRecord ¶ added in v1.1.1
UpdateRecord handles PATCH /api/collections/:name/records/:id
type HealthIssue ¶ added in v1.1.1
type HealthIssue struct {
Type string `json:"type"` // "security" | "performance"
Title string `json:"title"`
Description string `json:"description"`
}
HealthIssue represents a security or performance recommendation
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Database string `json:"database"`
Timestamp string `json:"timestamp"`
Uptime string `json:"uptime"`
Memory struct {
Alloc uint64 `json:"alloc_mb"`
TotalAlloc uint64 `json:"total_alloc_mb"`
Sys uint64 `json:"sys_mb"`
NumGC uint32 `json:"num_gc"`
} `json:"memory"`
}
HealthResponse represents the health check response
type LogEntry ¶ added in v1.1.1
type LogEntry struct {
ID string `json:"id"`
Time string `json:"time"`
Method string `json:"method"`
Path string `json:"path"`
Status int `json:"status"`
Latency string `json:"latency"`
IP string `json:"ip"`
Country string `json:"country,omitempty"`
City string `json:"city,omitempty"`
Timestamp time.Time `json:"timestamp"` // Exposed for frontend comparisons
}
LogEntry represents a single request log
type Metrics ¶ added in v1.1.1
type Metrics struct {
sync.RWMutex
DbRequests int
AuthRequests int
StorageRequests int
DbHistory []int
AuthHistory []int
StorageHistory []int
RealtimeHistory []int
CpuHistory []float64
RamHistory []float64
}
Metrics holds in-memory activity stats
type PasswordPolicy ¶
type PasswordPolicy struct {
MinLength int
RequireUppercase bool
RequireLowercase bool
RequireNumber bool
RequireSpecial bool
}
PasswordPolicy defines the requirements for a valid password
func DefaultPasswordPolicy ¶
func DefaultPasswordPolicy() PasswordPolicy
DefaultPasswordPolicy returns the default password requirements
type ProjectInfo ¶ added in v1.1.1
type ProjectInfo struct {
Name string `json:"name"`
Host string `json:"host"`
Port string `json:"port"`
Database string `json:"database"`
User string `json:"user"`
TableCount int `json:"table_count"`
UserTableCount int `json:"user_table_count"`
SystemTableCount int `json:"system_table_count"`
FunctionCount int `json:"function_count"`
SchemaCount int `json:"schema_count"`
DbSize string `json:"db_size"`
Version string `json:"version"`
Metrics DbMetrics `json:"metrics"`
SlowQueries []SlowQuery `json:"slow_queries"`
}
ProjectInfo represents the project information response
type RealtimeHandler ¶
RealtimeHandler handles the SSE connection
func NewRealtimeHandler ¶
func NewRealtimeHandler(broker *realtime.Broker) *RealtimeHandler
NewRealtimeHandler creates a new instances of RealtimeHandler
type SQLExecuteRequest ¶ added in v1.1.1
type SQLExecuteRequest struct {
Query string `json:"query"`
}
type SQLExecuteResponse ¶ added in v1.1.1
type SQLSyncResponse ¶ added in v1.1.1
type SecurityConfig ¶
type SecurityConfig struct {
// ContentSecurityPolicy - Controls resources the browser is allowed to load
ContentSecurityPolicy string
// XFrameOptions - Prevents clickjacking attacks
XFrameOptions string
// XContentTypeOptions - Prevents MIME type sniffing
XContentTypeOptions string
// XSSProtection - XSS filter in browsers
XSSProtection string
// HSTSMaxAge - HTTP Strict Transport Security max age in seconds
HSTSMaxAge int
// HSTSIncludeSubdomains - Include subdomains in HSTS
HSTSIncludeSubdomains bool
// ReferrerPolicy - Controls how much referrer info is sent
ReferrerPolicy string
// PermissionsPolicy - Controls browser features
PermissionsPolicy string
}
SecurityConfig holds configuration for security middleware
func DefaultSecurityConfig ¶
func DefaultSecurityConfig() SecurityConfig
DefaultSecurityConfig returns production-ready security headers configuration
type SecurityStats ¶ added in v1.1.1
type SecurityStats struct {
TotalChecks int64 `json:"total_checks"`
AllowedRequests int64 `json:"allowed_requests"`
BlockedRequests int64 `json:"blocked_requests"`
TopCountries []GeoStat `json:"top_countries"`
TopIPs []IPStat `json:"top_ips"`
AlertsTimeline []TimelineEvent `json:"alerts_timeline"`
TotalBreaches int64 `json:"total_breaches"`
LastBreachAt string `json:"last_breach_at"`
}
SecurityStats represents data for the security dashboard
type TimelineEvent ¶ added in v1.1.1
type TwoFactorHandler ¶ added in v1.1.1
type TwoFactorHandler struct {
// contains filtered or unexported fields
}
func NewTwoFactorHandler ¶ added in v1.1.1
func NewTwoFactorHandler(service *core.TwoFactorService, authService *core.AuthService) *TwoFactorHandler
func (*TwoFactorHandler) Disable2FA ¶ added in v1.1.1
func (h *TwoFactorHandler) Disable2FA(c echo.Context) error
Disable2FA disables 2FA for the user
func (*TwoFactorHandler) Enable2FA ¶ added in v1.1.1
func (h *TwoFactorHandler) Enable2FA(c echo.Context) error
Enable2FA enables 2FA after verifying the code
func (*TwoFactorHandler) Get2FAStatus ¶ added in v1.1.1
func (h *TwoFactorHandler) Get2FAStatus(c echo.Context) error
Get2FAStatus returns whether 2FA is enabled for the user
type ValidationError ¶
ValidationError represents a validation failure with details
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type WebhookHandler ¶ added in v1.1.1
func NewWebhookHandler ¶ added in v1.1.1
func NewWebhookHandler(db *data.DB) *WebhookHandler
func (*WebhookHandler) Create ¶ added in v1.1.1
func (h *WebhookHandler) Create(c echo.Context) error
type WebhookInfo ¶ added in v1.1.1
type WorkspaceHandler ¶ added in v1.1.1
type WorkspaceHandler struct {
// contains filtered or unexported fields
}
func NewWorkspaceHandler ¶ added in v1.1.1
func NewWorkspaceHandler(service *core.WorkspaceService, mailer mailer.Mailer) *WorkspaceHandler
func (*WorkspaceHandler) AddMember ¶ added in v1.1.1
func (h *WorkspaceHandler) AddMember(c echo.Context) error
func (*WorkspaceHandler) Create ¶ added in v1.1.1
func (h *WorkspaceHandler) Create(c echo.Context) error
func (*WorkspaceHandler) Delete ¶ added in v1.1.1
func (h *WorkspaceHandler) Delete(c echo.Context) error
func (*WorkspaceHandler) List ¶ added in v1.1.1
func (h *WorkspaceHandler) List(c echo.Context) error
func (*WorkspaceHandler) ListMembers ¶ added in v1.1.1
func (h *WorkspaceHandler) ListMembers(c echo.Context) error
func (*WorkspaceHandler) RemoveMember ¶ added in v1.1.1
func (h *WorkspaceHandler) RemoveMember(c echo.Context) error