Major feature additions across backend and frontend: Backend: - Unix domain socket admin server with JSON-RPC protocol - CLI subcommands: user/agent management, audit, backup, messages, channels - Managed API keys (sb_ prefix) with permissions, channel limits, expiry - Thread/reply support in messaging core (reply_to column) - Context-based trace owner_id propagation for proper audit filtering - Two-step auth middleware supporting both agent keys and managed API keys Frontend: - Complete Slack-like dark theme redesign with custom CSS properties - Sidebar with Channels, Direct Messages, and Admin sections - Thread panel (slide-in) for viewing message replies - API key management page with create form, key display, and ready-to-use MCP/Claude Code config snippets with copy-to-clipboard - All pages restyled: login, dashboard, agents, conversations, settings E2E Tests: - Fixed test runner binary path resolution - Added pyproject.toml for test dependencies Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
// Package apikeys provides API key management with permissions for SynapBus.
|
|
package apikeys
|
|
|
|
import "time"
|
|
|
|
// APIKey represents a managed API key with permissions.
|
|
type APIKey struct {
|
|
ID int64 `json:"id"`
|
|
UserID int64 `json:"user_id"`
|
|
AgentID *int64 `json:"agent_id,omitempty"` // nil = user-level
|
|
Name string `json:"name"`
|
|
KeyPrefix string `json:"key_prefix"`
|
|
Permissions Permissions `json:"permissions"`
|
|
AllowedChannels []string `json:"allowed_channels"`
|
|
ReadOnly bool `json:"read_only"`
|
|
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
|
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
RevokedAt *time.Time `json:"revoked_at,omitempty"`
|
|
}
|
|
|
|
// Permissions defines the access level for an API key.
|
|
type Permissions struct {
|
|
Read bool `json:"read"`
|
|
Write bool `json:"write"`
|
|
Admin bool `json:"admin"`
|
|
}
|
|
|
|
// CreateKeyRequest holds parameters for creating a new API key.
|
|
type CreateKeyRequest struct {
|
|
UserID int64 `json:"user_id"`
|
|
AgentID *int64 `json:"agent_id,omitempty"`
|
|
Name string `json:"name"`
|
|
Permissions Permissions `json:"permissions"`
|
|
AllowedChannels []string `json:"allowed_channels"`
|
|
ReadOnly bool `json:"read_only"`
|
|
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
|
}
|