Versions in this module Expand all Collapse all v0 v0.1.0 Mar 10, 2026 Changes in this version + var ErrExpiredRefreshToken = errors.New("refresh token has expired") + var ErrExpiredToken = errors.New("token has expired") + var ErrInvalidRefreshToken = errors.New("invalid refresh token") + var ErrInvalidToken = errors.New("invalid token") + var ErrMissingToken = errors.New("token is required") + var ErrRevokedRefreshToken = errors.New("refresh token has been revoked") + var ErrTokenAlreadyUsed = errors.New("token already used") + var ErrUserAlreadyExists = errors.New("user already exists") + var ErrUserNotFound = errors.New("user not found") + type AuthHandler struct + func NewAuthHandler(service service) *AuthHandler + func (h *AuthHandler) Logout(c *echo.Context) error + func (h *AuthHandler) Refresh(c *echo.Context) error + func (h *AuthHandler) Register(c *echo.Context) error + func (h *AuthHandler) RequestMagicLink(c *echo.Context) error + func (h *AuthHandler) Verify(c *echo.Context) error + func (h *AuthHandler) VerifyRedirect(c *echo.Context) error + type AuthRepository struct + func NewAuthRepository(db *gorm.DB) *AuthRepository + func (r *AuthRepository) CreateMagicLinkToken(ctx context.Context, token MagicLinkToken) error + func (r *AuthRepository) CreateRefreshToken(ctx context.Context, token RefreshToken) error + func (r *AuthRepository) GetMagicLinkToken(ctx context.Context, token string) (MagicLinkToken, error) + func (r *AuthRepository) GetRefreshTokenByHash(ctx context.Context, hash string) (*RefreshToken, error) + func (r *AuthRepository) MarkMagicLinkTokenAsUsed(ctx context.Context, tokenId uuid.UUID) error + func (r *AuthRepository) RevokeAllUserRefreshTokens(ctx context.Context, userID uuid.UUID) error + func (r *AuthRepository) RevokeRefreshToken(ctx context.Context, tokenID uuid.UUID) error + type AuthService struct + func NewAuthService(repository repository, users userRepository, emailSender emailSender, ...) *AuthService + func (s *AuthService) CreateMagicLink(ctx context.Context, email string) error + func (s *AuthService) LoginWithMagicLink(ctx context.Context, token string) (*LoginResponse, error) + func (s *AuthService) Logout(ctx context.Context, rawRefreshToken string) error + func (s *AuthService) RefreshAccessToken(ctx context.Context, rawRefreshToken string) (*LoginResponse, error) + func (s *AuthService) Register(ctx context.Context, email string, name string) error + type LoginResponse struct + AccessToken string + RefreshToken string + type LogoutRequest struct + RefreshToken string + type MagicLinkRequest struct + Email string + type MagicLinkToken struct + Email string + ExpiresAt time.Time + Token string + TokenID uuid.UUID + UsedAt *time.Time + UserID uuid.UUID + type RefreshRequest struct + RefreshToken string + type RefreshToken struct + CreatedAt time.Time + ExpiresAt time.Time + RevokedAt *time.Time + TokenHash string + TokenID uuid.UUID + UserID uuid.UUID + type RegisterRequest struct + Email string + Name string + type VerifyRequest struct + Token string