Documentation ¶ Index ¶ func GenSignedToken(option SignOption) (string, error) func Middleware(secret []byte, requireToken bool) func(next http.Handler) http.Handler type JWT type SignOption Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func GenSignedToken ¶ func GenSignedToken(option SignOption) (string, error) func Middleware ¶ func Middleware(secret []byte, requireToken bool) func(next http.Handler) http.Handler Types ¶ type JWT ¶ type JWT struct { Secret string `yaml:"secret"` // JwtSecret is the secret used to sign the JWT TTL int64 `yaml:"ttl"` // JwtTTL is the time to live for the JWT in seconds } type SignOption ¶ type SignOption struct { Username string UserID int64 Duration time.Duration Secret []byte } Source Files ¶ View all Source files token.go Click to show internal directories. Click to hide internal directories.