Versions in this module Expand all Collapse all v1 v1.0.1 Jul 29, 2026 Changes in this version + var ErrExpLost = errors.New("expiry date lost") + var ErrIatLost = errors.New("date of issue lost") + var ErrJwtChangeIssuer = errors.New("JWT is not allow to change issuer") + var ErrJwtIllegal = errors.New("JWT illegal") + var ErrJwtInavailable = errors.New("JWT inavailable") + var ErrKidIllegal = errors.New("Kid should between 1100 to 2999") + var ErrPriKeyInavailable = errors.New("private key inavailable") + var ErrPubKeyInavailable = errors.New("public key inavailable") + type ClaimStrings []string + type Claims interface + GetAudience func() (ClaimStrings, error) + GetExpirationTime func() (*NumericDate, error) + GetIssuedAt func() (*NumericDate, error) + GetIssuer func() (string, error) + GetNotBefore func() (*NumericDate, error) + GetSubject func() (string, error) + type EcdsaKey struct + PriKey *ecdsa.PrivateKey + PubKey *ecdsa.PublicKey + func GetEcdsaKey(priStr string, pubStr string) (key *EcdsaKey, err error) + type Ed25519Key struct + PriKey ed25519.PrivateKey + PubKey ed25519.PublicKey + func GetEd25519Key(priStr string, pubStr string) (key *Ed25519Key, err error) + type JwtHeader struct + Alg string + Kid int16 + Typ string + func CheckJwtStr(jwtStr string) (header JwtHeader, err error) + type JwtX struct + Exp time.Time + Iat time.Time + Id int64 + Issuer int64 + Kid int16 + Nob time.Time + PriKey interface{} + PubKey interface{} + Sub SubConfig + TTL int + func (m *JwtX) ChangeIssuer(issuer int64) (rs string, err error) + func (m *JwtX) GenJwt() (jwtStr string, err error) + func (m *JwtX) ParseJwt(jwtStr string) (result *JwtX, err error) + type Keyfunc func(*Token) (any, error) + type NumericDate struct + func NewNumericDate(t time.Time) *NumericDate + func (n *NumericDate) UnmarshalJSON(b []byte) error + func (n NumericDate) MarshalJSON() ([]byte, error) + type RegisteredClaims struct + Audience ClaimStrings + ExpiresAt *NumericDate + ID string + IssuedAt *NumericDate + Issuer string + NotBefore *NumericDate + Subject string + func (c RegisteredClaims) GetAudience() (ClaimStrings, error) + func (c RegisteredClaims) GetExpirationTime() (*NumericDate, error) + func (c RegisteredClaims) GetIssuedAt() (*NumericDate, error) + func (c RegisteredClaims) GetIssuer() (string, error) + func (c RegisteredClaims) GetNotBefore() (*NumericDate, error) + func (c RegisteredClaims) GetSubject() (string, error) + type SigningMethod interface + Alg func() string + Sign func(signingString string, key any) ([]byte, error) + Verify func(signingString string, sig []byte, key any) error + type SigningMethodECDSA struct + CurveBits int + KeySize int + Name string + func (m *SigningMethodECDSA) Alg() string + func (m *SigningMethodECDSA) Sign(signingString string, key any) ([]byte, error) + func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key any) error + type SigningMethodEd25519 struct + func (m *SigningMethodEd25519) Alg() string + func (m *SigningMethodEd25519) Sign(signingString string, key any) ([]byte, error) + func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key any) error + type SubConfig struct + AttendeeId int64 + CanRefresh bool + OpenId string + type Token struct + Claims Claims + Header map[string]any + Method SigningMethod + Raw string + Signature []byte + Valid bool + func NewWithClaims(method SigningMethod, claims Claims) *Token + func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) + func (t *Token) SignedString(key any) (string, error) + func (t *Token) SigningString() (string, error)