Documentation
¶
Index ¶
- func CheckPasswordHash(password, hash string) error
- func HashPassword(password string) (string, error)
- type TokenHandler
- func (handler *TokenHandler) BlacklistToken(tokenString string, expiry time.Duration) error
- func (handler *TokenHandler) CreateToken(user *storage.User, duration time.Duration, tokenType string) (string, *UserClaims, error)
- func (handler *TokenHandler) NewUserClaims(user *storage.User, duration time.Duration, tokenType string) (*UserClaims, error)
- func (handler *TokenHandler) VerifyToken(tokenString string, expectedType string) (*UserClaims, error)
- type UserClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
CheckPasswordHash checks if the provided password is correct or not
func HashPassword ¶
HashPassword returns the bcrypt hash of the password
Types ¶
type TokenHandler ¶
type TokenHandler struct {
// contains filtered or unexported fields
}
func NewTokenHandler ¶
func NewTokenHandler(secret string, redisClient *redis.Client) TokenHandler
func (*TokenHandler) BlacklistToken ¶
func (handler *TokenHandler) BlacklistToken(tokenString string, expiry time.Duration) error
Add token to blacklist in Redis
func (*TokenHandler) CreateToken ¶
func (handler *TokenHandler) CreateToken(user *storage.User, duration time.Duration, tokenType string) (string, *UserClaims, error)
func (*TokenHandler) NewUserClaims ¶
func (handler *TokenHandler) NewUserClaims(user *storage.User, duration time.Duration, tokenType string) (*UserClaims, error)
func (*TokenHandler) VerifyToken ¶
func (handler *TokenHandler) VerifyToken(tokenString string, expectedType string) (*UserClaims, error)
Click to show internal directories.
Click to hide internal directories.