Documentation
¶
Index ¶
- func GenerateChatToken(info ChatToken, secret string, expiresIn time.Duration) (string, time.Time, error)
- func GenerateToken(userID, secret string, expiresIn time.Duration) (string, time.Time, error)
- func JWTMiddleware(secret string, skipper middleware.Skipper) echo.MiddlewareFunc
- func RefreshTokenFromContext(c echo.Context, secret string, defaultExpiresIn time.Duration) (string, time.Time, error)
- func UserIDFromContext(c echo.Context) (string, error)
- type ChatToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateChatToken ¶
func GenerateChatToken(info ChatToken, secret string, expiresIn time.Duration) (string, time.Time, error)
GenerateChatToken creates a signed JWT for chat route reply.
func GenerateToken ¶
GenerateToken creates a signed JWT for the user.
func JWTMiddleware ¶
func JWTMiddleware(secret string, skipper middleware.Skipper) echo.MiddlewareFunc
JWTMiddleware returns a JWT auth middleware configured for HS256 tokens.
func RefreshTokenFromContext ¶ added in v0.1.1
func RefreshTokenFromContext(c echo.Context, secret string, defaultExpiresIn time.Duration) (string, time.Time, error)
RefreshTokenFromContext extracts the current token from context and issues a new one with the same claims but a renewed expiration time.
Types ¶
Click to show internal directories.
Click to hide internal directories.