Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("token is invalid") ErrExpiredToken = errors.New("token has expired") )
View Source
var ProviderSet = wire.NewSet(NewJWTMaker)
Functions ¶
This section is empty.
Types ¶
type JWTMaker ¶
type JWTMaker struct {
// contains filtered or unexported fields
}
JWTMaker implements the Maker interface.
func (*JWTMaker) CreateToken ¶
CreateToken create a new jwt token with userId and duration.
type Maker ¶
type Maker interface { CreateToken(username string, duration time.Duration) (string, error) VerifyToken(token string) (*Payload, error) }
Maker is a token maker.
func NewJWTMaker ¶
NewJWTMaker creates a JWTMaker with secret key length = 32.
Click to show internal directories.
Click to hide internal directories.