Documentation ¶
Index ¶
- Variables
- type Service
- func (service Service) GenerateTokenForUserID(UserID id.ID) (result string, err error)
- func (service Service) GetUserIDFromToken(tokenString string) (userID id.ID, err error)
- func (service Service) InvalidateToken(tokenString string) (err error)
- func (service Service) IsValid(tokenString string) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrCodeInvalidExpiryDate is the error code when claims[keyExp] is invalid ErrCodeInvalidExpiryDate = stacktrace.ErrorCode(1) )
View Source
var ( // ErrTokenBlacklisted is thrown when a jwt token is blacklisted ErrTokenBlacklisted = errors.New("token has been blacklisted") )
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a new instance of the JWT service
func NewService ¶
NewService creates a new instance of the JWT service
func (Service) GenerateTokenForUserID ¶
GenerateTokenForUserID generates a jwt token and assign a email to it's claims and return it
func (Service) GetUserIDFromToken ¶
GetUserIDFromToken parses a jwt token and returns the user ID
func (Service) InvalidateToken ¶
InvalidateToken invalidates a jwt token
Click to show internal directories.
Click to hide internal directories.