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, blacklist *token.Blacklist, refreshTTL time.Duration, secureCookie bool) *Handler {
NewService¶
func NewService(users user.Repository, tokens *token.Manager, refreshStore *token.RefreshStore, blacklist *token.Blacklist) *Service {
Service.Login¶
func (s *Service) Login(ctx context.Context, input LoginInput) (AuthResult, error) {
Service.Logout¶
func (s *Service) Logout(ctx context.Context, accessToken string, refreshToken string) error {
Service.Me¶
func (s *Service) Me(ctx context.Context, userID string) (user.User, error) {
Service.Refresh¶
func (s *Service) Refresh(ctx context.Context, refreshToken string) (AuthResult, 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")