service

package
v0.0.0-...-5591888 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const SESSION_VALIDITY_IN_DAYS = 60
View Source
const TOKEN_RAND_SIZE = 32

Variables

View Source
var (
	UserNotFound    = errors.New("User not found")
	InvalidPassword = errors.New("Invalid password")
)

Functions

func GenerateRandomToken

func GenerateRandomToken() []byte

Types

type UserService

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

func NewUserService

func NewUserService(db queries.DBTX) UserService

func (*UserService) AuthenticateUserByEmailPassword

func (s *UserService) AuthenticateUserByEmailPassword(ctx context.Context, email, password string) (*queries.User, error)

func (*UserService) RegisterUser

func (s *UserService) RegisterUser(ctx context.Context, params types.NewUserParams) (*queries.User, error, validate.Errors)

type UserTokenService

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

func NewUserTokenService

func NewUserTokenService(db queries.DBTX) UserTokenService

func (*UserTokenService) GenerateUserSessionToken

func (s *UserTokenService) GenerateUserSessionToken(ctx context.Context, user *queries.User) ([]byte, error)

func (*UserTokenService) GetUserBySessionToken

func (s *UserTokenService) GetUserBySessionToken(ctx context.Context, token []byte) (*queries.User, error)

Jump to

Keyboard shortcuts

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