services

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountService

type AccountService interface {
	Create(ctx context.Context, userID string, accountID string, providerID string, password *string) (*models.Account, error)
	CreateOAuth2(ctx context.Context, userID string, providerAccountID string, provider string, accessToken string, refreshToken *string, accessTokenExpiresAt *time.Time, refreshTokenExpiresAt *time.Time, scope *string) (*models.Account, error)
	GetByUserID(ctx context.Context, userID string) (*models.Account, error)
	GetByUserIDAndProvider(ctx context.Context, userID string, provider string) (*models.Account, error)
	GetByProviderAndAccountID(ctx context.Context, provider string, accountID string) (*models.Account, error)
	Update(ctx context.Context, account *models.Account) (*models.Account, error)
	UpdateFields(ctx context.Context, userID string, fields map[string]any) error
}

type ConfigManagerService

type ConfigManagerService interface {
	GetConfig(ctx context.Context) (*models.Config, error)
	GetAuthSettings(ctx context.Context) (map[string]any, error)
	GetPluginConfig(ctx context.Context, pluginName string) (any, error)
	RegisterConfigWatcher(pluginID string, plugin models.PluginWithConfigWatcher) error
	NotifyWatchers(config *models.Config) error
}

type CoreServices

type CoreServices struct {
	UserService         UserService
	AccountService      AccountService
	SessionService      SessionService
	VerificationService VerificationService
	TokenService        TokenService
}

type JWTService

type JWTService interface {
	ValidateToken(token string) (userID string, err error)
}

type MailerService

type MailerService interface {
	SendEmail(ctx context.Context, to string, subject string, text string, html string) error
}

type PasswordService

type PasswordService interface {
	Hash(password string) (string, error)
	Verify(password, encoded string) bool
}

type SecondaryStorageService

type SecondaryStorageService interface {
	// GetStorage returns the configured SecondaryStorage backend
	GetStorage() models.SecondaryStorage
	// GetProviderName returns the name of the currently active provider (e.g., "redis", "database", "memory")
	GetProviderName() string
}

SecondaryStorageService provides access to the configured secondary storage backend

type SessionService

type SessionService interface {
	GetByID(ctx context.Context, id string) (*models.Session, error)
	Create(ctx context.Context, userID string, hashedToken string, ipAddress *string, userAgent *string, maxAge time.Duration) (*models.Session, error)
	GetByUserID(ctx context.Context, userID string) (*models.Session, error)
	GetByToken(ctx context.Context, hashedToken string) (*models.Session, error)
	Update(ctx context.Context, session *models.Session) (*models.Session, error)
	Delete(ctx context.Context, ID string) error
	DeleteAllByUserID(ctx context.Context, userID string) error
}

type TokenService

type TokenService interface {
	Generate() (string, error)
	Hash(token string) string
	Encrypt(token string) (string, error)
	Decrypt(encrypted string) (string, error)
}

type UserService

type UserService interface {
	Create(ctx context.Context, name string, email string, emailVerified bool, image *string) (*models.User, error)
	GetByID(ctx context.Context, id string) (*models.User, error)
	GetByEmail(ctx context.Context, email string) (*models.User, error)
	Update(ctx context.Context, user *models.User) (*models.User, error)
	UpdateFields(ctx context.Context, id string, fields map[string]any) error
}

type VerificationService

type VerificationService interface {
	Create(ctx context.Context, userID string, hashedToken string, vType models.VerificationType, value string, expiry time.Duration) (*models.Verification, error)
	GetByToken(ctx context.Context, hashedToken string) (*models.Verification, error)
	Delete(ctx context.Context, id string) error
	DeleteByUserIDAndType(ctx context.Context, userID string, vType models.VerificationType) error
	IsExpired(verif *models.Verification) bool
}

Jump to

Keyboard shortcuts

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