services

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountServiceImpl

type AccountServiceImpl struct {
	// contains filtered or unexported fields
}

func NewAccountServiceImpl

func NewAccountServiceImpl(config *models.Config, db *gorm.DB) *AccountServiceImpl

func (*AccountServiceImpl) CreateAccount

func (s *AccountServiceImpl) CreateAccount(a *models.Account) error

CreateAccount creates a new account in the database.

func (*AccountServiceImpl) GetAccountByProviderAndAccountID

func (s *AccountServiceImpl) GetAccountByProviderAndAccountID(provider models.ProviderType, accountID string) (*models.Account, error)

GetAccountByProviderAndAccountID retrieves an account by provider and provider's account ID.

func (*AccountServiceImpl) GetAccountByUserID

func (s *AccountServiceImpl) GetAccountByUserID(userID string) (*models.Account, error)

GetAccountByUserID retrieves an account by the associated user ID.

func (*AccountServiceImpl) UpdateAccount

func (s *AccountServiceImpl) UpdateAccount(account *models.Account) error

UpdateAccount updates an existing account in the database.

type Argon2PasswordService added in v1.4.0

type Argon2PasswordService struct{}

func NewArgon2PasswordService added in v1.4.0

func NewArgon2PasswordService() *Argon2PasswordService

func (*Argon2PasswordService) HashPassword added in v1.4.0

func (s *Argon2PasswordService) HashPassword(password string) (string, error)

HashPassword hashes the given password using Argon2id.

func (*Argon2PasswordService) VerifyPassword added in v1.4.0

func (s *Argon2PasswordService) VerifyPassword(password string, hash string) (bool, error)

VerifyPassword verifies the given password against the provided hash using Argon2id.

type RateLimitServiceImpl

type RateLimitServiceImpl struct {
	// contains filtered or unexported fields
}

func NewRateLimitServiceImpl

func NewRateLimitServiceImpl(config *models.Config, logger models.Logger, pluginRateLimits []models.PluginRateLimit) *RateLimitServiceImpl

func (*RateLimitServiceImpl) Allow

func (s *RateLimitServiceImpl) Allow(ctx context.Context, key string, req *http.Request) (bool, error)

Allow checks if a request is allowed based on rate limiting rules

func (*RateLimitServiceImpl) BuildKey

func (s *RateLimitServiceImpl) BuildKey(key string) string

BuildKey constructs a rate limit key for storage

func (*RateLimitServiceImpl) GetClientIP

func (s *RateLimitServiceImpl) GetClientIP(req *http.Request) string

GetClientIP extracts the client's IP address from the request based on configured headers

type SMTPMailerService added in v1.4.0

type SMTPMailerService struct {
	// contains filtered or unexported fields
}

func NewSMTPMailerService added in v1.4.0

func NewSMTPMailerService(config *models.Config) *SMTPMailerService

func (*SMTPMailerService) Send added in v1.4.0

func (s *SMTPMailerService) Send(ctx context.Context, to string, subject string, body string, htmlBody string) error

type SessionServiceImpl

type SessionServiceImpl struct {
	// contains filtered or unexported fields
}

func NewSessionServiceImpl

func NewSessionServiceImpl(config *models.Config, db *gorm.DB) *SessionServiceImpl

func (*SessionServiceImpl) CreateSession

func (s *SessionServiceImpl) CreateSession(userID string, token string) (*models.Session, error)

CreateSession creates a new session for a user

func (*SessionServiceImpl) DeleteSessionByID

func (s *SessionServiceImpl) DeleteSessionByID(ID string) error

DeleteSessionByID deletes a session by its ID.

func (*SessionServiceImpl) GetSessionByToken

func (s *SessionServiceImpl) GetSessionByToken(token string) (*models.Session, error)

GetSessionByToken retrieves a session by its token.

func (*SessionServiceImpl) GetSessionByUserID

func (s *SessionServiceImpl) GetSessionByUserID(userID string) (*models.Session, error)

GetSessionByUserID retrieves a session by the associated userID.

type TokenServiceImpl

type TokenServiceImpl struct {
	// contains filtered or unexported fields
}

TokenServiceImpl manages token operations using the application secret. This service uses Config.Secret for signing, encryption, and hashing tokens.

func NewTokenServiceImpl

func NewTokenServiceImpl(config *models.Config) *TokenServiceImpl

NewTokenServiceImpl creates a new TokenServiceImpl with the provided config.

func (*TokenServiceImpl) DecryptToken

func (ts *TokenServiceImpl) DecryptToken(encryptedToken string) (string, error)

DecryptToken decrypts an encrypted token using the application secret.

func (*TokenServiceImpl) EncryptToken

func (ts *TokenServiceImpl) EncryptToken(token string) (string, error)

EncryptToken encrypts a plain token using the application secret.

func (*TokenServiceImpl) GenerateEncryptedToken

func (ts *TokenServiceImpl) GenerateEncryptedToken() (string, error)

GenerateEncryptedToken generates a token and encrypts it with the application secret.

func (*TokenServiceImpl) GenerateToken

func (ts *TokenServiceImpl) GenerateToken() (string, error)

GenerateToken generates a new cryptographically secure random token.

func (*TokenServiceImpl) HashToken

func (ts *TokenServiceImpl) HashToken(token string) string

HashToken creates a hash of the token using the application secret. This is more secure than plain SHA256 hashing for token storage.

type UserServiceImpl

type UserServiceImpl struct {
	// contains filtered or unexported fields
}

func NewUserServiceImpl

func NewUserServiceImpl(config *models.Config, db *gorm.DB) *UserServiceImpl

func (*UserServiceImpl) CreateUser

func (s *UserServiceImpl) CreateUser(user *models.User) error

CreateUser creates a new user in the database.

func (*UserServiceImpl) GetUserByEmail

func (s *UserServiceImpl) GetUserByEmail(email string) (*models.User, error)

GetUserByEmail retrieves a user by their email.

func (*UserServiceImpl) GetUserByID

func (s *UserServiceImpl) GetUserByID(id string) (*models.User, error)

GetUserByID retrieves a user by their ID.

func (*UserServiceImpl) UpdateUser

func (s *UserServiceImpl) UpdateUser(user *models.User) error

UpdateUser updates an existing user in the database.

type VerificationServiceImpl

type VerificationServiceImpl struct {
	// contains filtered or unexported fields
}

func NewVerificationServiceImpl

func NewVerificationServiceImpl(config *models.Config, db *gorm.DB) *VerificationServiceImpl

func (*VerificationServiceImpl) CreateVerification

func (s *VerificationServiceImpl) CreateVerification(v *models.Verification) error

Creates a new verification record

func (*VerificationServiceImpl) DeleteVerification

func (s *VerificationServiceImpl) DeleteVerification(id string) error

Deletes a verification record by ID

func (*VerificationServiceImpl) GetVerificationByToken

func (s *VerificationServiceImpl) GetVerificationByToken(token string) (*models.Verification, error)

Retrieves a verification record by token

func (*VerificationServiceImpl) IsExpired

func (s *VerificationServiceImpl) IsExpired(verification *models.Verification) bool

Checks if the verification token is expired

Jump to

Keyboard shortcuts

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