Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrExpiredToken = errors.New("token has expired") ErrInvalidToken = errors.New("token is invalid") )
Different types of token Errors we will return
Functions ¶
This section is empty.
Types ¶
type AsymPasetoMaker ¶
type AsymPasetoMaker struct {
// contains filtered or unexported fields
}
func (*AsymPasetoMaker) CreateToken ¶
func (*AsymPasetoMaker) VerifyToken ¶
func (maker *AsymPasetoMaker) VerifyToken(token string) (*Payload, error)
type JWTMaker ¶
type JWTMaker struct {
// contains filtered or unexported fields
}
type Maker ¶
type Maker interface {
// CreateToken Create a token for a specific username with a duration
CreateToken(username string, role string, duration time.Duration) (string, *Payload, error)
// VerifyToken Check if the input token is valid or not
VerifyToken(token string) (*Payload, error)
}
Maker interface will be used to manage the token creation and verification We will be creating support for both JWT and PASETO tokens
func NewAsymPasetoMaker ¶
func NewJWTMaker ¶
func NewPasetoMaker ¶
type PasetoMaker ¶
type PasetoMaker struct {
// contains filtered or unexported fields
}
func (*PasetoMaker) CreateToken ¶
func (*PasetoMaker) VerifyToken ¶
func (maker *PasetoMaker) VerifyToken(token string) (*Payload, error)
Click to show internal directories.
Click to hide internal directories.