Documentation
¶
Overview ¶
auth/tokens.go
Index ¶
- func GenerateAccessToken(userID string, duration time.Duration, secretKey string) (string, error)
- func GenerateBase64Token(length int) (string, error)
- func GenerateRandomToken(length int) (string, error)
- func GenerateRefreshToken() (string, error)
- func GenerateTokens(userID string, accessTokenttl time.Duration, refreshTokenTTl time.Duration, ...) (accessToken string, refreshToken string, err error)
- func HashPassword(password string) (string, error)
- func ValidatePassword(hashedPassword, password string) error
- func ValidateToken(tokenString string, secret string) (jwt.MapClaims, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateAccessToken ¶
func GenerateBase64Token ¶
GenerateBase64Token generates a random base64 encoded token
func GenerateRandomToken ¶
GenerateRandomToken generates a random token with the specified length in bytes
func GenerateRefreshToken ¶
func GenerateTokens ¶
func GenerateTokens(userID string, accessTokenttl time.Duration, refreshTokenTTl time.Duration, secret string) (accessToken string, refreshToken string, err error)
GenerateTokens creates a new JWT access token and refresh token
func HashPassword ¶
HashPassword creates a bcrypt hash of the password
func ValidatePassword ¶
ValidatePassword checks if the provided password is correct
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.