Versions in this module Expand all Collapse all v1 v1.0.0 Oct 25, 2023 Changes in this version + const JwtPayloadClientVersion + const JwtPayloadClientVersionName + var ErrTokenTheftDetectedError = NewError(ErrTokenTheftDetectedErrorType, "token theft detected, try re-log in") + var ErrTokenTheftDetectedErrorType = "ErrTokenTheftDetectedError" + var ErrTryRefreshTokenError = NewError(ErrTryRefreshTokenErrorType, "access token expired, try refresh token") + var ErrTryRefreshTokenErrorType = "ErrTryRefreshTokenError" + var ErrUnKnowErrorType = "ErrUnKnowError" + var ErrUnKnowErrorTypeError = NewError(ErrUnKnowErrorType, "un know err") + var ErrUnauthorizedError = NewError(ErrUnauthorizedErrorType, "unauthorized, your access token is invalid") + var ErrUnauthorizedErrorType = "ErrUnauthorizedError" + func GenSigningPublicKey(jwtSigningPublicKey string) (publicKey *rsa.PublicKey, publicKeyError error) + func NewError(t string, msg string) error + type Data struct + ClientPayload map[string]interface{} + CreateMSTime int64 + CreateString string + ExpiryMSTime int64 + ExpiryString string + IsExpire bool + ServerSessionData map[string]interface{} + ServerTokenHandle string + UserId string + type Err struct + Msg string + Type string + func (err *Err) Error() string + type Interface interface + Config func(refreshTokenExpireTime time.Duration, accessTokenExpireTime time.Duration) + CreateNewLogInToken func(userId string, clientJwtPayload map[string]interface{}, ...) (accessToken, refreshToken string, err error) + GetAllSessionsForUser func(userId string) (sessionInfos []Data, err error) + GetSessionInfoByAccessToken func(accessToken string, force bool) (tokenData Data, err error) + GetSignPublicKey func() (publicKey string, err error) + ParseAccessToken func(accessToken string, publicKey string) (tokenData Data, err error) + RefreshLogInToken func(refreshToken string) (newAccessToken string, newRefreshToken string, err error) + RevokeLogInTokenByAccessToken func(accessToken string) (revoke bool, err error) + RevokeLogInTokenByUserId func(userId string) error