Documentation ¶
Index ¶
- func CheckAndCreateDataDirectory()
- func GenerateJWT(user models.User, jwtSecret string) (string, error)
- func GenerateLoginTokens(user models.User, jwtSecret string) (at, rt string, err error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(n int) (string, error)
- func GenerateRandomStringURLSafe(n int) (string, error)
- func VerifyRefreshToken(refreshToken string) (valid bool, username string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAndCreateDataDirectory ¶
func CheckAndCreateDataDirectory()
CheckAndCreateDataDirectory creates the data directory if it doesn't exist
func GenerateJWT ¶
GenerateJWT generates a JWT for the given user with 1hr validity
func GenerateLoginTokens ¶
GenerateLoginTokens creates a JWT with 1 hour validity and a refresh token (which is synced with the DB) Returns (access token, refresh token, error)
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomStringURLSafe ¶
GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
Types ¶
This section is empty.