Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRevoked token has been revoked ErrRevoked = fmt.Errorf("token has been revoked") )
Functions ¶
This section is empty.
Types ¶
type JWTClaims ¶
type JWTClaims struct {
jwt.RegisteredClaims
UID string `json:"uid"`
}
JWTClaims is the claims for the JWT token
type TokenService ¶
type TokenService interface {
// New creates a new token.
New(id int64, expire time.Duration) (string, error)
// Validate validates the token.
Validate(ctx context.Context, token string) (string, int64, error)
// Revoke revokes the token.
Revoke(ctx context.Context, id string) error
}
TokenService is the interface for token service.
func NewTokenService ¶
func NewTokenService(privateKeyString string) (TokenService, error)
NewTokenService creates a new token service.
Click to show internal directories.
Click to hide internal directories.