handler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

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

AuthHandler handles authentication-related HTTP requests.

func NewAuthHandler

func NewAuthHandler(service domain.AuthService) *AuthHandler

NewAuthHandler creates a new AuthHandler with the given service and logger.

func (*AuthHandler) RefreshToken

func (h *AuthHandler) RefreshToken(w http.ResponseWriter, r *http.Request)

RefreshToken handles POST /v1/auth/token/refresh

func (*AuthHandler) RequestOTP

func (h *AuthHandler) RequestOTP(w http.ResponseWriter, r *http.Request)

RequestOTP handles POST /v1/auth/otp/request

func (*AuthHandler) VerifyOTP

func (h *AuthHandler) VerifyOTP(w http.ResponseWriter, r *http.Request)

VerifyOTP handles POST /v1/auth/otp/verify

type RequestOTPRequest

type RequestOTPRequest struct {
	Email string `json:"email" validate:"required,email"`
}

RequestOTPRequest defines the payload for requesting an OTP.

type TokenResponse

type TokenResponse struct {
	// ExpiresAt is the timestamp when the access token expires.
	ExpiresAt time.Time `json:"expires_at"`
	// AccessToken is the PASETO access token.
	//
	//nolint:gosec
	AccessToken string `json:"access_token"`
	// RefreshToken is the PASETO refresh token.
	//
	//nolint:gosec
	RefreshToken string `json:"refresh_token"`
}

TokenResponse defines the successful authentication response.

type VerifyOTPRequest

type VerifyOTPRequest struct {
	Email string `json:"email" validate:"required,email"`
	Code  string `json:"code"  validate:"required,len=6"`
}

VerifyOTPRequest defines the payload for verifying an OTP.

Jump to

Keyboard shortcuts

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