service

package
v0.0.0-...-129bed4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccountsService

func NewAccountsService(repo repository.AccountRepository,
	logger *logrus.Logger,
	registrationRepository repository.RegistrationRepository,
	sessionsRepository repository.SessionsRepository,
	accountEvents events.AccountsEventsMQ,
	tokenDeliveryMQ events.TokensDeliveryMQ,
	cfg *AccountsServiceConfig) *accountsService

Types

type AccountsService

type AccountsService interface {
	CreateAccount(ctx context.Context, dto models.CreateAccountDTO) error
	DeleteAccount(ctx context.Context, sessionID, machineID string) error
	RequestAccountVerificationToken(ctx context.Context, email, callbackURL string) error
	VerifyAccount(ctx context.Context, token string) error
	SignIn(ctx context.Context, dto models.SignInDTO) (sessionID string, err error)
	GetAccountID(ctx context.Context, sessionID, machineID string) (accountID string, err error)
	Logout(ctx context.Context, sessionID, machineID string) error
	RequestChangePasswordToken(ctx context.Context, email, callbackURL string) error
	ChangePassword(ctx context.Context, token, newPassword string) error
	GetAllSessions(ctx context.Context, sessionID, machineID string) (map[string]*models.SessionInfo, error)
	TerminateSessions(ctx context.Context, sessionID, machineID string, sessionsToTerminateIds []string) error
}

type AccountsServiceConfig

type AccountsServiceConfig struct {
	ChangePasswordTokenTTL             time.Duration
	ChangePasswordTokenSecret          string
	VerifyAccountTokenTTL              time.Duration
	VerifyAccountTokenSecret           string
	NumRetriesForTerminateSessions     uint32
	RetrySleepTimeForTerminateSessions time.Duration
	NonActivatedAccountTTL             time.Duration
	BcryptCost                         int
	SessionTTL                         time.Duration
}

Jump to

Keyboard shortcuts

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