utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessToken = "access"
)

Variables

View Source
var (
	ErrInvalidToken = errors.New("invalid token")
	ErrExpiredToken = errors.New("token has expired")
)

Functions

func ComputeSHA256

func ComputeSHA256(token string) string

Types

type Claims

type Claims struct {
	UserID    uuid.UUID `json:"user_id"`
	Email     string    `json:"email,omitempty"`
	TokenType string    `json:"token_type"`
	jwt.RegisteredClaims
}

type JWTManager

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

func NewJWTManager

func NewJWTManager(secretKey string, tokenDuration time.Duration, refreshTokenDuration time.Duration) *JWTManager

func (*JWTManager) GenerateAccessToken

func (m *JWTManager) GenerateAccessToken(userID uuid.UUID, email string) (string, error)

func (*JWTManager) ValidateAccessToken

func (m *JWTManager) ValidateAccessToken(tokenString string) (*Claims, error)

Jump to

Keyboard shortcuts

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