Skip to content

internal/auth

github.com/gamidoc/backend/internal/auth

Types

AuthResult

type AuthResult struct {

Handler

type Handler struct {

LoginInput

type LoginInput struct {

RegisterInput

type RegisterInput struct {

Service

type Service struct {

Functions

Handler.Routes

func (h *Handler) Routes() chi.Router {

NewHandler

func NewHandler(service *Service, tokenManager *token.Manager) *Handler {

NewService

func NewService(users user.Repository, tokens *token.Manager) *Service {

Service.Login

func (s *Service) Login(ctx context.Context, input LoginInput) (AuthResult, error) {

Service.Me

func (s *Service) Me(ctx context.Context, userID string) (user.User, error) {

Service.Register

func (s *Service) Register(ctx context.Context, input RegisterInput) (AuthResult, error) {

Variables

ErrEmailAlreadyExists

var ErrEmailAlreadyExists = errors.New("email already exists")

ErrInvalidCredentials

var ErrInvalidCredentials = errors.New("invalid credentials")

ErrInvalidEmail

var ErrInvalidEmail = errors.New("invalid email")

ErrInvalidPassword

var ErrInvalidPassword = errors.New("invalid password")