Documentation
¶
Index ¶
- func GenerateAccessJWT(userID string, scope string) (string, error)
- func GenerateHMACSignature(payload map[string]interface{}, privateKey string) string
- func GeneratePairJWT(userID string, scope string) (string, string, error)
- func GeneratePrivateKey() (string, error)
- func GenerateRefreshJWT(userID string, scope string) (string, error)
- func SortMapRecursively(m map[string]interface{}) map[string]interface{}
- func SortSliceRecursively(s []interface{}) []interface{}
- func ValidateJWT(tokenString string) (jwt.MapClaims, error)
- func VerifyHMACSignature(payload map[string]interface{}, privateKey string, signature string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateAccessJWT ¶
GenerateAccessJWT generates an access token with a short expiry time ~ 15 minutes
func GenerateHMACSignature ¶
GenerateHMACSignature generates the HMAC signature for the given payload using the private key. The signature is returned as a hex-encoded string.
func GeneratePairJWT ¶
GeneratePairJWT generates a pair of access and refresh tokens
func GeneratePrivateKey ¶
GeneratePrivateKey generates a private key (Secret Key).
func GenerateRefreshJWT ¶
GenerateRefreshJWT generates a refresh token with a long expiry time >= 24 hours
func SortMapRecursively ¶
SortMapRecursively sorts a map recursively by its keys
func SortSliceRecursively ¶
func SortSliceRecursively(s []interface{}) []interface{}
SortMapRecursively sorts a map recursively by its keys
func ValidateJWT ¶
ValidateJWT validates the JWT token string and returns the claims if valid.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.