Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrExpiredToken = errors.New("token has expired") ErrInvalidToken = errors.New("token is invalid") )
Functions ¶
This section is empty.
Types ¶
type Maker ¶
type Maker interface {
// CreateToken generates a new token for a specific username valid for a specific duration of time
CreateToken(username string, role string, duration time.Duration) (string, *Payload, error)
// VerifyToken checks and verifies the payload of the token
VerifyToken(token string) (*Payload, error)
}
Maker is an interface for managing tokens
func NewPasetoMaker ¶
type PasetoMaker ¶
type PasetoMaker struct {
// contains filtered or unexported fields
}
PasetoMaker is a PASETO token master
func (*PasetoMaker) CreateToken ¶
func (maker *PasetoMaker) CreateToken(username string, role string, duration time.Duration) (string, *Payload, error)
CreateToken generates a new token for a specific username valid for a specific duration of time
func (*PasetoMaker) VerifyToken ¶
func (maker *PasetoMaker) VerifyToken(token string) (*Payload, error)
VerifyToken checks and verifies the payload of the token
Click to show internal directories.
Click to hide internal directories.