Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( InvalidToken = errors.New("invalid token") ExpiredToken = errors.New("expired token") )
Functions ¶
func GenerateSymmetricKey ¶
func GenerateSymmetricKey() string
Types ¶
type JWTMaker ¶
type JWTMaker struct {
// contains filtered or unexported fields
}
func (*JWTMaker) CreateToken ¶
CreateToken returns token, paylaod if creates token that specified username and duration success else error
type Maker ¶
type Maker interface { CreateToken(username string, duration time.Duration) (string, *Payload, error) VerifyToken(token string) (*Payload, error) }
func NewJWTMaker ¶
NewJWTMaker create a JWT token maker follow the Maker interface
func NewPasetoMaker ¶
NewPasetoMaker create a paseto token maker follow the Maker interface
type PasetoMaker ¶
type PasetoMaker struct {
// contains filtered or unexported fields
}
func (*PasetoMaker) CreateToken ¶
func (p *PasetoMaker) CreateToken(username string, duration time.Duration) (string, *Payload, error)
CreateToken returns token, payload if creates token that specified username and duration success else error
func (*PasetoMaker) VerifyToken ¶
func (p *PasetoMaker) VerifyToken(token string) (*Payload, error)
VerifyToken return the payload if the token is valid passed else error
Click to show internal directories.
Click to hide internal directories.