Versions in this module Expand all Collapse all v0 v0.0.1 Aug 13, 2022 Changes in this version + var ErrExpiredToken = errors.New("token has expired") + var ErrInvalidToken = errors.New("token is invalid") + type JWTMaker struct + func (maker *JWTMaker) CreateToken(userID int64, username string, duration time.Duration) (string, *Payload, error) + func (maker *JWTMaker) VerifyToken(token string) (*Payload, error) + type Maker interface + CreateToken func(userID int64, username string, duration time.Duration) (string, *Payload, error) + VerifyToken func(token string) (*Payload, error) + func NewJWTMaker(secretKey string) (Maker, error) + func NewPasetoMaker(symmetricKey string) (Maker, error) + type PasetoMaker struct + func (maker *PasetoMaker) CreateToken(userID int64, username string, duration time.Duration) (string, *Payload, error) + func (maker *PasetoMaker) VerifyToken(token string) (*Payload, error) + type Payload struct + ExpiredAt time.Time + ID uuid.UUID + IssuedAt time.Time + Others map[string]interface{} + UserID int64 + Username string + func NewPayload(userID int64, username string, duration time.Duration, ...) (*Payload, error) + func (p *Payload) Valid() error