Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JWTSecret []byte
JWTSecret is the secret key for signing JWT tokens
View Source
var RefreshSecret []byte
RefreshSecret is the secret key for signing refresh tokens
View Source
var RefreshTokenExpireDuration = time.Hour * 24
RefreshTokenExpireDuration is the duration for refresh token expiration
View Source
var TokenExpireDuration = time.Hour
TokenExpireDuration is the duration for JWT token expiration
Functions ¶
func CreateRefreshToken ¶
func GenerateAccessToken ¶
func VerifyAccessToken ¶
func VerifyAccessToken(tokenString string) (*jwt.StandardClaims, error)
Types ¶
type RefreshToken ¶
RefreshToken represents a refresh token
func VerifyRefreshToken ¶
func VerifyRefreshToken(tokenString string) (*RefreshToken, error)
type User ¶
type User struct { gorm.Model Username string `json:"username"` Email string `json:"email"` Password string `json:"-" gorm:"-"` Salt string `json:"-"` PasswordHash string `json:"-"` LastLogin int64 }
func GetUserByID ¶
func (*User) GeneratePasswordSalt ¶
GeneratePasswordSalt generates a random string of the specified length
func (*User) HashPassword ¶
HashPassword hashes a password with a given salt using bcrypt
Click to show internal directories.
Click to hide internal directories.