package
0.0.0-20250128180613-533bbf8506b3
Repository: https://github.com/glebradaev/shlink.git
Documentation: pkg.go.dev

# Functions

CreateCookie creates and returns an HTTP cookie with the specified name and value.
Generate generates a random string of the specified length, using characters from the charset constant (letters and digits).
GenerateJWT creates a JWT token containing the provided user ID with a 3-hour expiration time.
GenerateUUID generates a new UUID (Universally Unique Identifier).
GetOrSetUserIDFromCookie checks if a valid user ID is present in the cookie.
GetUserIDFromCookie retrieves the user ID from the cookie in the request.
IsValidID checks if the given ID string has the exact specified length and contains only characters from the allowed charset (letters and digits).
ParseJWT parses and validates a JWT token string.
SetUserIDInCookie generates a new user ID, creates a JWT with that ID, and sets the token as a cookie in the response.
ValidateContentType validates the `Content-Type` header of the incoming HTTP request.
ValidateURL validates the format and scheme of the provided URL string.

# Constants

Name of the cookie where the user ID is stored.
Secret key used to sign JWT tokens.
Expiration time for the JWT token.

# Structs

Claims represents the JWT claims structure, including standard claims from the JWT specification and custom user data like UserID.