Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("token is invalid") ErrExpiredToken = errors.New("token has expired") )
Different types of functions returned by the VerifyToken function
Functions ¶
This section is empty.
Types ¶
type JWTMaker ¶
type JWTMaker struct {
// contains filtered or unexported fields
}
JWTMaker is a json web token maker
func (*JWTMaker) CreateToken ¶
Create a token for a specific username and duration
type Maker ¶
type Maker interface { //Create a token for a specific username and duration CreateToken(username string, duration time.Duration) (string, error) //Check if input token is valid or not VerifyToken(token string) (*Payload, error) }
Maker is an interface for managing tokens
func NewPasetoMaker ¶
Create a new PasetoMaker instance
type PasetoMaker ¶
type PasetoMaker struct {
// contains filtered or unexported fields
}
func (*PasetoMaker) CreateToken ¶
Create a new token for a specific username and duration
func (*PasetoMaker) VerifyToken ¶
func (maker *PasetoMaker) VerifyToken(token string) (*Payload, error)
Verify token
Click to show internal directories.
Click to hide internal directories.