services

package module
v0.0.0-...-a8afb48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound     = errors.New("user not found")
	ErrInvalidPassword  = errors.New("invalid password")
	ErrEmailExists      = errors.New("email already exists")
	ErrUnauthorized     = errors.New("unauthorized")
	ErrInvalidOperation = errors.New("invalid operation")
)
View Source
var DefaultPasswordPolicy = PasswordPolicy{
	MinLength:         12,
	RequireUppercase:  true,
	RequireLowercase:  true,
	RequireNumbers:    true,
	RequireSpecial:    true,
	MaximumAge:        90,
	PreventReuse:      true,
	HistorySize:       5,
	RequireUnique:     true,
	AllowedCharacters: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=[]{}|;:,.<>?",
}

Functions

This section is empty.

Types

type APIService

type APIService interface {
	CreateAPIKey(ctx context.Context, orgID uuid.UUID, name string, permissions []string) (*models.APIKey, error)
	RevokeAPIKey(ctx context.Context, keyID uuid.UUID) error
	ValidateAPIKey(ctx context.Context, key string) (*models.APIKey, error)
	ListAPIKeys(ctx context.Context, orgID uuid.UUID) ([]models.APIKey, error)
	CheckRateLimit(ctx context.Context, keyID uuid.UUID) error
}

func NewAPIService

func NewAPIService(repo repository.Repository, audit AuditService, licensing LicensingService) APIService

type AuditEventType

type AuditEventType string
const (
	AuditEventUserCreated          AuditEventType = "user.created"
	AuditEventUserLogin            AuditEventType = "user.login"
	AuditEventUserPasswordChanged  AuditEventType = "user.password_changed"
	AuditEventOrganizationCreated  AuditEventType = "organization.created"
	AuditEventOrganizationModified AuditEventType = "organization.modified"
	AuditEventRoleCreated          AuditEventType = "role.created"
	AuditEventRoleModified         AuditEventType = "role.modified"
	AuditEventVaultItemCreated     AuditEventType = "vault.item_created"
	AuditEventVaultItemAccessed    AuditEventType = "vault.item_accessed"
	AuditEventVaultItemModified    AuditEventType = "vault.item_modified"
	AuditEventPermissionAssigned   AuditEventType = "permission.assigned"
	AuditEventUserAddedToOrg       AuditEventType = "organization.user_added"
	AuditEventUserRemovedFromOrg   AuditEventType = "organization.user_removed"
)

type AuditMetadata

type AuditMetadata map[string]interface{}

type BackupService

type BackupService interface {
	CreateBackup(ctx context.Context, orgID uuid.UUID) (*models.Backup, error)
	RestoreBackup(ctx context.Context, backupID uuid.UUID) error
	ListBackups(ctx context.Context, orgID uuid.UUID) ([]models.Backup, error)
	DeleteBackup(ctx context.Context, backupID uuid.UUID) error
	ScheduleBackup(ctx context.Context, orgID uuid.UUID, schedule string) error
}

func NewBackupService

func NewBackupService(repo repository.Repository, encryption EncryptionService, vault VaultService) BackupService

type CacheService

type CacheService interface {
	Get(ctx context.Context, key string) (interface{}, error)
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
	Delete(ctx context.Context, key string) error
	Clear(ctx context.Context) error
	GetOrSet(ctx context.Context, key string, fn func() (interface{}, error), expiration time.Duration) (interface{}, error)
}

func NewCacheService

func NewCacheService(redisClient *redis.Client, config models.CacheConfig) CacheService

type CollectionService

type CollectionService interface {
	CreateCollection(ctx context.Context, orgID uuid.UUID, name string) (*models.Collection, error)
	UpdateCollection(ctx context.Context, collection *models.Collection) error
	DeleteCollection(ctx context.Context, collectionID uuid.UUID) error
	GetCollection(ctx context.Context, collectionID uuid.UUID) (*models.Collection, error)
	ListCollections(ctx context.Context, orgID uuid.UUID) ([]models.Collection, error)
	AddUserToCollection(ctx context.Context, collectionID, userID uuid.UUID, readOnly bool) error
	RemoveUserFromCollection(ctx context.Context, collectionID, userID uuid.UUID) error
}

func NewCollectionService

func NewCollectionService(repo repository.Repository, roleService RoleService) CollectionService

type ComplianceFramework

type ComplianceFramework string
const (
	ComplianceGDPR     ComplianceFramework = "gdpr"
	ComplianceHIPAA    ComplianceFramework = "hipaa"
	ComplianceSOC2     ComplianceFramework = "soc2"
	CompliancePCI      ComplianceFramework = "pci"
	ComplianceISO27001 ComplianceFramework = "iso27001"
)

type ComplianceService

type ComplianceService interface {
	GenerateReport(ctx context.Context, orgID uuid.UUID, framework ComplianceFramework) (*models.ComplianceReport, error)
	GetReport(ctx context.Context, reportID uuid.UUID) (*models.ComplianceReport, error)
	ListReports(ctx context.Context, orgID uuid.UUID) ([]models.ComplianceReport, error)
	ValidateCompliance(ctx context.Context, orgID uuid.UUID, framework ComplianceFramework) (*models.ComplianceValidation, error)
	ConfigureCompliance(ctx context.Context, orgID uuid.UUID, config models.ComplianceConfig) error
}

func NewComplianceService

func NewComplianceService(
	repo repository.Repository,
	audit AuditService,
	licensing LicensingService,
	policy PolicyService,
) ComplianceService

type ConfigService

type ConfigService interface {
	Get(ctx context.Context, key string) (interface{}, error)
	Set(ctx context.Context, key string, value interface{}) error
	Delete(ctx context.Context, key string) error
	GetAll(ctx context.Context) (map[string]interface{}, error)
	Watch(ctx context.Context, key string) (<-chan ConfigUpdate, error)
}

func NewConfigService

func NewConfigService(
	repo repository.Repository,
	cache CacheService,
) ConfigService

type ConfigUpdate

type ConfigUpdate struct {
	Key      string
	Value    interface{}
	IsDelete bool
}

type DeviceService

type DeviceService interface {
	RegisterDevice(ctx context.Context, userID uuid.UUID, device models.Device) error
	DeregisterDevice(ctx context.Context, deviceID uuid.UUID) error
	GetDevice(ctx context.Context, deviceID uuid.UUID) (*models.Device, error)
	ListDevices(ctx context.Context, userID uuid.UUID) ([]models.Device, error)
	AuthorizeDevice(ctx context.Context, deviceID uuid.UUID) error
	BlockDevice(ctx context.Context, deviceID uuid.UUID) error
	ValidateDeviceAccess(ctx context.Context, deviceID uuid.UUID) error
}

func NewDeviceService

func NewDeviceService(
	repo repository.Repository,
	audit AuditService,
	policy PolicyService,
) DeviceService

type DeviceType

type DeviceType string
const (
	DeviceBrowser DeviceType = "browser"
	DeviceDesktop DeviceType = "desktop"
	DeviceMobile  DeviceType = "mobile"
	DeviceCLI     DeviceType = "cli"
)

type DirectoryService

type DirectoryService interface {
	ConfigureDirectory(ctx context.Context, orgID uuid.UUID, config models.DirectoryConfig) error
	SyncDirectory(ctx context.Context, orgID uuid.UUID) error
	GetSyncStatus(ctx context.Context, orgID uuid.UUID) (*models.DirectorySync, error)
	ListDirectoryUsers(ctx context.Context, orgID uuid.UUID) ([]models.DirectoryUser, error)
	ValidateDirectoryConfig(ctx context.Context, config models.DirectoryConfig) error
	GetDirectoryGroups(ctx context.Context, orgID uuid.UUID) ([]models.DirectoryGroup, error)
}

func NewDirectoryService

func NewDirectoryService(repo repository.Repository, audit AuditService, licensing LicensingService) DirectoryService

type DirectoryType

type DirectoryType string
const (
	DirectoryTypeLDAP DirectoryType = "ldap"
	DirectoryTypeAD   DirectoryType = "active_directory"
	DirectoryTypeOkta DirectoryType = "okta"
)

type EmailService

type EmailService interface {
	SendEmail(ctx context.Context, email models.Email) error
	SendTemplatedEmail(ctx context.Context, template string, data interface{}, recipients []string) error
	GetEmailTemplate(ctx context.Context, templateName string) (*models.EmailTemplate, error)
	CreateEmailTemplate(ctx context.Context, template models.EmailTemplate) error
	UpdateEmailTemplate(ctx context.Context, template models.EmailTemplate) error
	GetEmailHistory(ctx context.Context, userID uuid.UUID) ([]models.EmailHistory, error)
}

func NewEmailService

func NewEmailService(
	repo repository.Repository,
	smtpConfig models.SMTPConfig,
) EmailService

type EmergencyAccessService

type EmergencyAccessService interface {
	GrantEmergencyAccess(ctx context.Context, granterID, granteeID uuid.UUID, accessType EmergencyAccessType, waitTime int) error
	RevokeEmergencyAccess(ctx context.Context, accessID uuid.UUID) error
	InitiateEmergencyAccess(ctx context.Context, accessID uuid.UUID) error
	ApproveEmergencyAccess(ctx context.Context, accessID uuid.UUID) error
	RejectEmergencyAccess(ctx context.Context, accessID uuid.UUID) error
	GetEmergencyAccess(ctx context.Context, accessID uuid.UUID) (*models.EmergencyAccess, error)
	ListGrantedAccess(ctx context.Context, userID uuid.UUID) ([]models.EmergencyAccess, error)
	ListTrustedAccess(ctx context.Context, userID uuid.UUID) ([]models.EmergencyAccess, error)
}

func NewEmergencyAccessService

func NewEmergencyAccessService(
	repo repository.Repository,
	audit AuditService,
	vault VaultService,
	notification NotificationService,
) EmergencyAccessService

type EmergencyAccessType

type EmergencyAccessType string
const (
	EmergencyAccessView     EmergencyAccessType = "view"
	EmergencyAccessTakeover EmergencyAccessType = "takeover"
)

type EncryptionService

type EncryptionService interface {
	GenerateKeyPair() (publicKey, privateKey []byte, err error)
	EncryptWithPublicKey(data []byte, publicKey []byte) ([]byte, error)
	DecryptWithPrivateKey(ciphertext []byte, privateKey []byte) ([]byte, error)
	GenerateSymmetricKey() ([]byte, error)
	EncryptSymmetric(data []byte, key []byte) ([]byte, error)
	DecryptSymmetric(ciphertext []byte, key []byte) ([]byte, error)
}

func NewEncryptionService

func NewEncryptionService() EncryptionService

type ExportFormat

type ExportFormat string

type FeatureFlagService

type FeatureFlagService interface {
	IsEnabled(ctx context.Context, flag string, orgID uuid.UUID) (bool, error)
	SetFlag(ctx context.Context, flag string, enabled bool, options models.FeatureFlagOptions) error
	DeleteFlag(ctx context.Context, flag string) error
	ListFlags(ctx context.Context) ([]models.FeatureFlag, error)
	GetFlag(ctx context.Context, flag string) (*models.FeatureFlag, error)
}

func NewFeatureFlagService

func NewFeatureFlagService(
	repo repository.Repository,
	cache CacheService,
	licensing LicensingService,
) FeatureFlagService

type HealthCheck

type HealthCheck func(ctx context.Context) error

type HealthService

type HealthService interface {
	CheckHealth(ctx context.Context) (*models.HealthStatus, error)
	CheckComponent(ctx context.Context, component string) (*models.ComponentHealth, error)
	RegisterCheck(name string, check HealthCheck)
	UnregisterCheck(name string)
}

func NewHealthService

func NewHealthService(
	cache CacheService,
	db repository.Repository,
	redis *redis.Client,
) HealthService

type HealthStatus

type HealthStatus string
const (
	StatusHealthy   HealthStatus = "healthy"
	StatusDegraded  HealthStatus = "degraded"
	StatusUnhealthy HealthStatus = "unhealthy"
)

type ImportExportService

type ImportExportService interface {
	ImportData(ctx context.Context, userID uuid.UUID, format ImportFormat, data []byte) error
	ExportData(ctx context.Context, userID uuid.UUID, format ExportFormat) ([]byte, error)
	ValidateImportData(ctx context.Context, format ImportFormat, data []byte) error
}

func NewImportExportService

func NewImportExportService(repo repository.Repository, vault VaultService, encryption EncryptionService) ImportExportService

type ImportFormat

type ImportFormat string
const (
	FormatBitwarden ImportFormat = "bitwarden"
	FormatLastPass  ImportFormat = "lastpass"
	FormatKeePass   ImportFormat = "keepass"
	FormatCSV       ImportFormat = "csv"
	FormatJSON      ImportFormat = "json"
)

type KeyMetadata

type KeyMetadata struct {
	Version   int       `json:"version"`
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`
	IsActive  bool      `json:"is_active"`
	KeyType   string    `json:"key_type"`
}

type KeyRotationService

type KeyRotationService interface {
	RotateUserKeys(ctx context.Context, userID uuid.UUID) error
	RotateOrganizationKeys(ctx context.Context, orgID uuid.UUID) error
	GetCurrentKey(ctx context.Context, keyID uuid.UUID) ([]byte, error)
}

func NewKeyRotationService

func NewKeyRotationService(repo repository.Repository, encryption EncryptionService) KeyRotationService

type LicenseType

type LicenseType string
const (
	LicenseFree       LicenseType = "free"
	LicensePremium    LicenseType = "premium"
	LicenseEnterprise LicenseType = "enterprise"
)

type LicensingService

type LicensingService interface {
	ValidateLicense(ctx context.Context, orgID uuid.UUID) error
	ActivateLicense(ctx context.Context, orgID uuid.UUID, key string) error
	DeactivateLicense(ctx context.Context, orgID uuid.UUID) error
	GetLicenseInfo(ctx context.Context, orgID uuid.UUID) (*models.License, error)
	CheckFeatureAccess(ctx context.Context, orgID uuid.UUID, feature string) (bool, error)
	ListFeatures(ctx context.Context, licenseType LicenseType) ([]string, error)
}

func NewLicensingService

func NewLicensingService(repo repository.Repository, audit AuditService) LicensingService

type MetricsService

type MetricsService interface {
	RecordLogin(ctx context.Context, userID uuid.UUID, success bool)
	RecordAPIRequest(ctx context.Context, endpoint string, statusCode int, duration time.Duration)
	RecordVaultAccess(ctx context.Context, userID uuid.UUID, itemType string)
	RecordAuthFailure(ctx context.Context, reason string)
	GetMetrics(ctx context.Context, orgID uuid.UUID, startTime, endTime time.Time) (*models.MetricsReport, error)
}

func NewMetricsService

func NewMetricsService(repo repository.Repository) MetricsService

type MigrationService

type MigrationService interface {
	RunMigrations(ctx context.Context) error
	RollbackMigration(ctx context.Context, version uint) error
	GetMigrationHistory(ctx context.Context) ([]models.Migration, error)
	CreateBackup(ctx context.Context) error
	ValidateSchema(ctx context.Context) error
}

func NewMigrationService

func NewMigrationService(repo repository.Repository, audit AuditService, db *sql.DB) MigrationService

type MonitoringService

type MonitoringService interface {
	CheckSystemHealth(ctx context.Context) (*models.HealthStatus, error)
	RecordSystemMetric(ctx context.Context, metricName string, value float64)
	GetSystemMetrics(ctx context.Context, startTime, endTime time.Time) ([]models.SystemMetric, error)
	ConfigureAlert(ctx context.Context, alertConfig models.AlertConfig) error
	GetActiveAlerts(ctx context.Context) ([]models.Alert, error)
}

func NewMonitoringService

func NewMonitoringService(repo repository.Repository, notification NotificationService) MonitoringService

type NotificationPreferencesService

type NotificationPreferencesService interface {
	GetPreferences(ctx context.Context, userID uuid.UUID) (*models.NotificationPreferences, error)
	UpdatePreferences(ctx context.Context, userID uuid.UUID, prefs *models.NotificationPreferences) error
	GetChannelPreference(ctx context.Context, userID uuid.UUID, channel string) (bool, error)
	GetEventPreference(ctx context.Context, userID uuid.UUID, eventType string) (bool, error)
	SetDefaultPreferences(ctx context.Context, userID uuid.UUID) error
}

func NewNotificationPreferencesService

func NewNotificationPreferencesService(
	repo repository.Repository,
	cache CacheService,
) NotificationPreferencesService

type NotificationService

type NotificationService interface {
	CreateNotification(ctx context.Context, userID uuid.UUID, notificationType NotificationType, message string, metadata map[string]interface{}) error
	MarkAsRead(ctx context.Context, notificationID uuid.UUID) error
	DeleteNotification(ctx context.Context, notificationID uuid.UUID) error
	GetUserNotifications(ctx context.Context, userID uuid.UUID, unreadOnly bool) ([]models.Notification, error)
	SendSystemNotification(ctx context.Context, orgID uuid.UUID, notificationType NotificationType, message string) error
}

func NewNotificationService

func NewNotificationService(repo repository.Repository) NotificationService

type NotificationType

type NotificationType string
const (
	NotificationTypeInfo    NotificationType = "info"
	NotificationTypeWarning NotificationType = "warning"
	NotificationTypeError   NotificationType = "error"
	NotificationTypeSuccess NotificationType = "success"
)

type OrganizationPreferencesService

type OrganizationPreferencesService interface {
	GetPreferences(ctx context.Context, orgID uuid.UUID) (*models.OrganizationPreferences, error)
	UpdatePreferences(ctx context.Context, orgID uuid.UUID, prefs *models.OrganizationPreferences) error
	GetPreference(ctx context.Context, orgID uuid.UUID, key string) (interface{}, error)
	SetPreference(ctx context.Context, orgID uuid.UUID, key string, value interface{}) error
	ResetPreferences(ctx context.Context, orgID uuid.UUID) error
	ApplyTemplate(ctx context.Context, orgID uuid.UUID, templateID string) error
}

func NewOrganizationPreferencesService

func NewOrganizationPreferencesService(
	repo repository.Repository,
	cache CacheService,
	audit AuditService,
) OrganizationPreferencesService

type PassphraseOptions

type PassphraseOptions struct {
	WordCount     int
	Separator     string
	Capitalize    bool
	IncludeNumber bool
}

type PasswordGeneratorService

type PasswordGeneratorService interface {
	GeneratePassword(options *PasswordOptions) (string, error)
	GeneratePassphrase(options *PassphraseOptions) (string, error)
	ValidateGeneratedPassword(password string, options *PasswordOptions) bool
}

func NewPasswordGeneratorService

func NewPasswordGeneratorService() PasswordGeneratorService

type PasswordOptions

type PasswordOptions struct {
	Length           int
	IncludeUpper     bool
	IncludeLower     bool
	IncludeNumbers   bool
	IncludeSpecial   bool
	MinSpecial       int
	MinNumbers       int
	MinUpper         int
	ExcludeSimilar   bool
	ExcludeAmbiguous bool
}

type PasswordPolicy

type PasswordPolicy struct {
	MinLength         int
	RequireUppercase  bool
	RequireLowercase  bool
	RequireNumbers    bool
	RequireSpecial    bool
	MaximumAge        int // in days
	PreventReuse      bool
	HistorySize       int
	RequireUnique     bool
	AllowedCharacters string
}

type PasswordPolicyService

type PasswordPolicyService interface {
	ValidatePassword(ctx context.Context, orgID uuid.UUID, password string) (bool, []string)
	GetPolicy(ctx context.Context, orgID uuid.UUID) (*models.PasswordPolicy, error)
	UpdatePolicy(ctx context.Context, orgID uuid.UUID, policy *models.PasswordPolicy) error
	CheckPasswordHistory(ctx context.Context, userID uuid.UUID, password string) (bool, error)
	EnforcePasswordRotation(ctx context.Context, orgID uuid.UUID) error
}

func NewPasswordPolicyService

func NewPasswordPolicyService(
	repo repository.Repository,
	cache CacheService,
	audit AuditService,
	orgPrefs OrganizationPreferencesService,
) PasswordPolicyService

type PasswordStrength

type PasswordStrength struct {
	Score           float64  // 0-100
	Entropy         float64  // Bits of entropy
	CrackTime       string   // Estimated time to crack
	Weaknesses      []string // List of identified weaknesses
	Recommendations []string // Suggestions for improvement
}

type PasswordStrengthService

type PasswordStrengthService interface {
	EvaluateStrength(password string) *PasswordStrength
	GetStrengthRequirements(orgID uuid.UUID) (*StrengthRequirements, error)
	UpdateStrengthRequirements(orgID uuid.UUID, requirements *StrengthRequirements) error
}

func NewPasswordStrengthService

func NewPasswordStrengthService(
	repo repository.Repository,
	cache CacheService,
) PasswordStrengthService

type PluginService

type PluginService interface {
	RegisterPlugin(ctx context.Context, orgID uuid.UUID, pluginPath string) (*models.Plugin, error)
	UnregisterPlugin(ctx context.Context, pluginID uuid.UUID) error
	EnablePlugin(ctx context.Context, pluginID uuid.UUID) error
	DisablePlugin(ctx context.Context, pluginID uuid.UUID) error
	GetPlugin(ctx context.Context, pluginID uuid.UUID) (*models.Plugin, error)
	ListPlugins(ctx context.Context, orgID uuid.UUID) ([]models.Plugin, error)
	ExecutePlugin(ctx context.Context, pluginID uuid.UUID, action string, params map[string]interface{}) (interface{}, error)
}

func NewPluginService

func NewPluginService(repo repository.Repository, audit AuditService) PluginService

type PluginType

type PluginType string
const (
	PluginTypeAuth        PluginType = "auth"
	PluginTypeStorage     PluginType = "storage"
	PluginTypeNotify      PluginType = "notify"
	PluginTypeIntegration PluginType = "integration"
)

type Policy

type Policy struct {
	Type     PolicyType      `json:"type"`
	Enabled  bool            `json:"enabled"`
	Settings json.RawMessage `json:"settings"`
}

type PolicyService

type PolicyService interface {
	CreatePolicy(ctx context.Context, orgID uuid.UUID, policy Policy) error
	UpdatePolicy(ctx context.Context, orgID uuid.UUID, policy Policy) error
	DeletePolicy(ctx context.Context, orgID uuid.UUID, policyType PolicyType) error
	GetPolicy(ctx context.Context, orgID uuid.UUID, policyType PolicyType) (*Policy, error)
	ListPolicies(ctx context.Context, orgID uuid.UUID) ([]Policy, error)
	EvaluatePolicy(ctx context.Context, orgID uuid.UUID, policyType PolicyType, data interface{}) (bool, error)
}

func NewPolicyService

func NewPolicyService(repo repository.Repository) PolicyService

type PolicyType

type PolicyType string
const (
	PolicyTwoFactorAuth      PolicyType = "two_factor_auth"
	PolicyPasswordComplexity PolicyType = "password_complexity"
	PolicySessionTimeout     PolicyType = "session_timeout"
	PolicyIPAllowlist        PolicyType = "ip_allowlist"
	PolicyMasterPassword     PolicyType = "master_password"
	PolicyVaultTimeout       PolicyType = "vault_timeout"
)

type RateLimitService

type RateLimitService interface {
	Allow(ctx context.Context, key string) (bool, error)
	AllowN(ctx context.Context, key string, n int) (bool, error)
	Reset(ctx context.Context, key string) error
	GetLimit(ctx context.Context, key string) (*models.RateLimit, error)
	SetLimit(ctx context.Context, key string, limit models.RateLimit) error
}

func NewRateLimitService

func NewRateLimitService(
	repo repository.Repository,
	cache CacheService,
	config models.RateLimitConfig,
) RateLimitService

type ReportType

type ReportType string
const (
	ReportTypeUsage      ReportType = "usage"
	ReportTypeSecurity   ReportType = "security"
	ReportTypeAudit      ReportType = "audit"
	ReportTypeCompliance ReportType = "compliance"
)

type ReportingService

type ReportingService interface {
	GenerateReport(ctx context.Context, orgID uuid.UUID, reportType ReportType, startTime, endTime time.Time) (*models.Report, error)
	ScheduleReport(ctx context.Context, orgID uuid.UUID, schedule models.ReportSchedule) error
	ListReports(ctx context.Context, orgID uuid.UUID) ([]models.Report, error)
	GetReport(ctx context.Context, reportID uuid.UUID) (*models.Report, error)
	DeleteReport(ctx context.Context, reportID uuid.UUID) error
}

func NewReportingService

func NewReportingService(repo repository.Repository, metrics MetricsService, audit AuditService) ReportingService

type SSOConfig

type SSOConfig struct {
	Provider      SSOProvider       `json:"provider"`
	ClientID      string            `json:"client_id"`
	ClientSecret  string            `json:"client_secret"`
	MetadataURL   string            `json:"metadata_url"`
	CallbackURL   string            `json:"callback_url"`
	Configuration map[string]string `json:"configuration"`
	Enabled       bool              `json:"enabled"`
}

type SSOProvider

type SSOProvider string
const (
	SSOProviderSAML   SSOProvider = "saml"
	SSOProviderOIDC   SSOProvider = "oidc"
	SSOProviderOAuth2 SSOProvider = "oauth2"
)

type SSOService

type SSOService interface {
	ConfigureSSO(ctx context.Context, orgID uuid.UUID, config SSOConfig) error
	GetSSOConfig(ctx context.Context, orgID uuid.UUID) (*SSOConfig, error)
	InitiateSSO(ctx context.Context, orgID uuid.UUID, provider SSOProvider) (string, error)
	HandleCallback(ctx context.Context, orgID uuid.UUID, code string) (*models.User, error)
}

func NewSSOService

func NewSSOService(repo repository.Repository, encryption EncryptionService) SSOService

type SearchOptions

type SearchOptions struct {
	Query       string
	Types       []string
	Collections []uuid.UUID
	StartTime   *time.Time
	EndTime     *time.Time
	SortBy      string
	SortOrder   string
	Limit       int
	Offset      int
}

type SearchService

type SearchService interface {
	Search(ctx context.Context, userID uuid.UUID, options SearchOptions) ([]models.SearchResult, error)
	SearchVaultItems(ctx context.Context, userID uuid.UUID, query string) ([]models.VaultItem, error)
	SearchCollections(ctx context.Context, userID uuid.UUID, query string) ([]models.Collection, error)
	SearchAuditLogs(ctx context.Context, orgID uuid.UUID, query string) ([]models.AuditLog, error)
	BuildSearchIndex(ctx context.Context, orgID uuid.UUID) error
}

func NewSearchService

func NewSearchService(
	repo repository.Repository,
	vault VaultService,
	collection CollectionService,
	audit AuditService,
) SearchService

type Service

type Service interface {
	// User operations
	CreateUser(ctx context.Context, email, name, password string) (*models.User, error)
	AuthenticateUser(ctx context.Context, email, password string) (*models.User, error)
	UpdateUserPassword(ctx context.Context, userID uuid.UUID, currentPassword, newPassword string) error
	Enable2FA(ctx context.Context, userID uuid.UUID) (string, error)
	Verify2FA(ctx context.Context, userID uuid.UUID, code string) error

	// Organization operations
	CreateOrganization(ctx context.Context, name, orgType string, ownerID uuid.UUID) (*models.Organization, error)
	AddUserToOrganization(ctx context.Context, orgID, userID, roleID uuid.UUID) error
	RemoveUserFromOrganization(ctx context.Context, orgID, userID uuid.UUID) error

	// Role and Permission operations
	CreateRole(ctx context.Context, orgID uuid.UUID, name, description string) (*models.Role, error)
	AssignPermissionsToRole(ctx context.Context, roleID uuid.UUID, permissionIDs []uuid.UUID) error

	// Vault operations
	CreateVaultItem(ctx context.Context, userID, orgID uuid.UUID, itemType, name string, data []byte) (*models.VaultItem, error)
	GetVaultItems(ctx context.Context, userID, orgID uuid.UUID) ([]models.VaultItem, error)
}

func NewService

func NewService(repo repository.Repository) Service

type SessionService

type SessionService interface {
	CreateSession(ctx context.Context, userID uuid.UUID, deviceInfo string) (*models.Session, error)
	ValidateSession(ctx context.Context, sessionID string) (*models.Session, error)
	RevokeSession(ctx context.Context, sessionID string) error
	RevokeAllUserSessions(ctx context.Context, userID uuid.UUID) error
}

func NewSessionService

func NewSessionService(repo repository.Repository) SessionService

type ShareType

type ShareType string
const (
	ShareTypeView   ShareType = "view"
	ShareTypeEdit   ShareType = "edit"
	ShareTypeManage ShareType = "manage"
)

type SharingService

type SharingService interface {
	ShareItem(ctx context.Context, itemID uuid.UUID, shareConfig models.ShareConfig) error
	UpdateSharing(ctx context.Context, shareID uuid.UUID, shareConfig models.ShareConfig) error
	RevokeSharing(ctx context.Context, shareID uuid.UUID) error
	GetSharing(ctx context.Context, shareID uuid.UUID) (*models.ShareConfig, error)
	ListSharedItems(ctx context.Context, userID uuid.UUID) ([]models.SharedItem, error)
	ListItemShares(ctx context.Context, itemID uuid.UUID) ([]models.ShareConfig, error)
	ValidateShareAccess(ctx context.Context, shareID uuid.UUID, accessType ShareType) error
}

func NewSharingService

func NewSharingService(
	repo repository.Repository,
	audit AuditService,
	encryption EncryptionService,
	notification NotificationService,
) SharingService

type StorageProvider

type StorageProvider string
const (
	StorageLocal StorageProvider = "local"
	StorageS3    StorageProvider = "s3"
	StorageAzure StorageProvider = "azure"
	StorageGCS   StorageProvider = "gcs"
)

type StorageService

type StorageService interface {
	StoreFile(ctx context.Context, file io.Reader, metadata models.FileMetadata) (*models.StoredFile, error)
	GetFile(ctx context.Context, fileID uuid.UUID) (*models.StoredFile, io.ReadCloser, error)
	DeleteFile(ctx context.Context, fileID uuid.UUID) error
	ListFiles(ctx context.Context, orgID uuid.UUID) ([]models.StoredFile, error)
	StoreBackup(ctx context.Context, backup io.Reader, metadata models.BackupMetadata) (*models.StoredBackup, error)
	GetBackup(ctx context.Context, backupID uuid.UUID) (*models.StoredBackup, io.ReadCloser, error)
	DeleteBackup(ctx context.Context, backupID uuid.UUID) error
	ListBackups(ctx context.Context, orgID uuid.UUID) ([]models.StoredBackup, error)
}

func NewStorageService

func NewStorageService(
	repo repository.Repository,
	audit AuditService,
	encryption EncryptionService,
	provider StorageProvider,
) StorageService

type StrengthRequirements

type StrengthRequirements struct {
	MinimumScore     float64
	MinimumEntropy   float64
	RequiredPatterns []string
}

type UserPreferencesService

type UserPreferencesService interface {
	GetPreferences(ctx context.Context, userID uuid.UUID) (*models.UserPreferences, error)
	UpdatePreferences(ctx context.Context, userID uuid.UUID, prefs *models.UserPreferences) error
	GetPreference(ctx context.Context, userID uuid.UUID, key string) (interface{}, error)
	SetPreference(ctx context.Context, userID uuid.UUID, key string, value interface{}) error
	ResetPreferences(ctx context.Context, userID uuid.UUID) error
}

func NewUserPreferencesService

func NewUserPreferencesService(
	repo repository.Repository,
	cache CacheService,
) UserPreferencesService

type ValidationService

type ValidationService interface {
	Validate(ctx context.Context, data interface{}) error
	ValidateField(ctx context.Context, field string, value interface{}, tag string) error
	RegisterValidation(tag string, fn validator.Func) error
	RegisterStructValidation(fn validator.StructLevelFunc, types ...interface{}) error
}

func NewValidationService

func NewValidationService() ValidationService

type WebhookService

type WebhookService interface {
	RegisterWebhook(ctx context.Context, webhook models.Webhook) error
	SendWebhook(ctx context.Context, notification models.Notification) error
	GetWebhook(ctx context.Context, webhookID uuid.UUID) (*models.Webhook, error)
	ListWebhooks(ctx context.Context, orgID uuid.UUID) ([]models.Webhook, error)
	DeleteWebhook(ctx context.Context, webhookID uuid.UUID) error
	ValidateWebhook(ctx context.Context, webhook models.Webhook) error
}

func NewWebhookService

func NewWebhookService(
	repo repository.Repository,
	audit AuditService,
) WebhookService

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL