Files
agent-desk-ng/internal/pkg/dto/dto.go
mono 63e0457886 fix: harden identity, live access, drafts and setup (review only)
Source-reviewed hardening changes and regression tests. UNBUILT / UNTESTED: not a deployable release. Go formatting, compilation, automated regression tests, full frontend validation and staging acceptance remain required. See docs/hardening/VALIDATION.md. Main remains the original clean snapshot; no upstream Git history imported.
2026-10-16 12:15:20 +00:00

95 lines
3.8 KiB
Go

// Modified in the independent hardening fork; see docs/hardening.
package dto
import (
"agent-desk/internal/pkg/enums"
"time"
)
type AuthPrincipal struct {
UserID int64
Username string
Nickname string
Avatar string
UserType enums.UserType
Status enums.Status
Roles []string
Permissions []string
// Session metadata stays internal and binds long-lived connections to the
// original login session and its absolute deadline.
LoginSessionID int64 `json:"-"`
ExpiresAt time.Time `json:"-"`
}
type WebChannelConfig struct {
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
UserTokenSecret string `json:"userTokenSecret,omitempty"`
RequireSignedIdentity bool `json:"requireSignedIdentity,omitempty"`
PromptStarters []string `json:"promptStarters,omitempty"`
}
type TelegramChannelConfig struct {
BotToken string `json:"botToken"`
BotUsername string `json:"botUsername,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}
type ZaloOAChannelConfig struct {
AppID string `json:"appId,omitempty"`
OAID string `json:"oaId,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}
type SlackChannelConfig struct {
BotToken string `json:"botToken,omitempty"` // xoxb-... Bot Token
SigningSecret string `json:"signingSecret,omitempty"` // Slack Signing Secret
AppID string `json:"appId,omitempty"` // Slack App ID
TeamID string `json:"teamId,omitempty"` // Slack Workspace Team ID
TeamName string `json:"teamName,omitempty"` // Slack Workspace Team Name
DefaultChannel string `json:"defaultChannel,omitempty"` // Default channel to post
}
type EmailChannelConfig struct {
EmailAddress string `json:"emailAddress,omitempty"`
ForwardingAddress string `json:"forwardingAddress,omitempty"`
SenderName string `json:"senderName,omitempty"`
Provider string `json:"provider,omitempty"`
APIKey string `json:"apiKey,omitempty"`
SMTPHost string `json:"smtpHost,omitempty"`
SMTPPort int `json:"smtpPort,omitempty"`
SMTPUser string `json:"smtpUser,omitempty"`
SMTPPassword string `json:"smtpPassword,omitempty"`
// SMTPUseTLS is a pointer so "not set" stays distinguishable from an explicit
// false. A plain bool cannot say that, and inheriting the system value is the
// wrong answer for a channel deliberately bound to a plaintext test server.
SMTPUseTLS *bool `json:"smtpUseTls,omitempty"`
// SMTPAllowInsecure accepts a self-signed certificate and skips opportunistic
// STARTTLS, so a channel can be bound to a local test SMTP server. Never
// enable it for a real mailbox.
SMTPAllowInsecure bool `json:"smtpAllowInsecure,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}
type DiscordChannelConfig struct {
GuildID string `json:"guildId,omitempty"`
GuildName string `json:"guildName,omitempty"`
ChannelScope string `json:"channelScope,omitempty"` // all | dm_only
BotToken string `json:"botToken,omitempty"`
ApplicationID string `json:"applicationId,omitempty"`
PublicKey string `json:"publicKey,omitempty"`
WebhookSecret string `json:"webhookSecret,omitempty"`
WelcomeMessage string `json:"welcomeMessage,omitempty"`
}