Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidToken = errors.New("jwt token is invalid")
Functions ¶
func CheckPasswordHash ¶
Compares the password with the hash using bcrypt.CompareHashAndPassword
func HashPassword ¶
Hashes a password string using default cost
Types ¶
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
JWT implements the Tokener interface. Create method takes in id as the payload.
It is important to note that bcrypt is a slow hashing function, which means that it can take a long time to generate and verify hashes. This is a security feature, as it makes it more difficult for attackers to guess or brute-force the hashes. However, it also means that bcrypt may not be the most suitable choice for generating and verifying tokens, especially if you need to do it frequently or in high-concurrency situations.
type JWTOption ¶
type JWTOption func(*JWT)
func ExpiresAfter ¶
Configure the expiry of the JWT token.
func SigningMethod ¶
func SigningMethod(method jwt.SigningMethod) JWTOption
Configure the JWT signing method. The default is jwt.SigningMethodHS256