Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("token is invalid") ErrExpiredToken = errors.New("token has expired") )
Functions ¶
This section is empty.
Types ¶
type JWTMaker ¶
type JWTMaker struct {
// contains filtered or unexported fields
}
JWTMaker is a Maker for JWT tokens
func (*JWTMaker) CreateToken ¶
type JWTPayload ¶
type JWTPayload struct { Username string `json:username` jwt.RegisteredClaims }
Payload contains data of token
type Maker ¶
type Maker interface { // CreateToken creates a new token for a given username and duration CreateToken(username string, duration time.Duration) (string, *Payload, error) // VerifyToken checks given token's validity VerifyToken(token string) (*Payload, error) }
Maker is an interface to manage tokens
func NewJWTMaker ¶
func NewPasetoMaker ¶
NewPasetoMaker creates a new PasetoMaker
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.