auth

package
v0.0.0-...-1351168 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	Token string  `json:"token"`
	User  db.User `json:"user"`
}

type Claims

type Claims struct {
	UserID int32  `json:"user_id"`
	Email  string `json:"email"`
	jwt.RegisteredClaims
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,min=6"`
}

type RegisterRequest

type RegisterRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Name     string `json:"name" validate:"required"`
	Surname  string `json:"surname" validate:"required"`
	Password string `json:"password" validate:"required,min=6"`
}

type Service

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

func NewService

func NewService(queries db.Querier, config config.AuthConfig) *Service

func (*Service) JWTMiddleware

func (s *Service) JWTMiddleware() echo.MiddlewareFunc

func (*Service) Login

func (s *Service) Login(ctx context.Context, req LoginRequest) (*AuthResponse, error)

func (*Service) Register

func (s *Service) Register(ctx context.Context, req RegisterRequest) (*AuthResponse, error)

func (*Service) ValidateToken

func (s *Service) ValidateToken(tokenString string) (*Claims, error)

Jump to

Keyboard shortcuts

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