Versions in this module Expand all Collapse all v4 v4.1.3 Sep 3, 2021 v4.1.2 Sep 2, 2021 Changes in this version + const UnsafeAllowNoneSignatureType + var ErrHashUnavailable = errors.New("jwt: the requested hash function is unavailable") + var ErrInvalidKey = errors.New("jwt: key is invalid") + var ErrInvalidKeyType = errors.New("jwt: invalid key type") + var ErrInvalidSigningMethod = errors.New("jwt: invalid signing method") + var ErrKeyFuncError = errors.New("jwt: KeyFunc returned an error") + var ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") + var ErrMalformedToken = errors.New("jwt: token is malformed") + var ErrMissingKeyFunc = errors.New("jwt: KeyFunc not provided") + var ErrNoneSignatureTypeDisallowed = errors.New(`jwt: "none" signature type is not allowed`) + var ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") + var ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") + var ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key") + var ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key") + var ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") + var ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") + var ErrSignatureInvalid = errors.New("jwt: signature is invalid") + var ErrTokenContainsBearer = errors.New(`jwt: token may not contain "bearer "`) + var ErrTokenExpired = errors.New("jwt: the token is expired") + var ErrTokenNotYetValid = errors.New("jwt: the token is not yet valid") + var ErrTokenUsedBeforeIssued = errors.New("jwt: the token was used before issued") + var ErrUnregisteredSigningMethod = errors.New("jwt: signing method not registered") + var MarshalSingleStringAsArray = true + var SigningMethodNone *signingMethodNone + var TimeFunc = time.Now + var TimePrecision = time.Second + var ValidationErrorFormat = func(errs []error) string + func DecodeSegment(seg string) ([]byte, error) + func EncodeSegment(seg []byte) string + func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) + func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) + func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) + func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) + func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) + func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) + func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) + func RegisterSigningMethod(alg string, f func() SigningMethod) + type ClaimStrings []string + func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) + func (s ClaimStrings) MarshalJSON() (b []byte, err error) + type Claims interface + Valid func() error + type ExpiredError struct + AttemptedAt time.Time + ExpiredAt time.Time + func (err *ExpiredError) Delta() time.Duration + func (err *ExpiredError) Error() string + func (err *ExpiredError) Unwrap() error + type InvalidSigningMethodError struct + Alg string + func (err *InvalidSigningMethodError) Error() string + func (err *InvalidSigningMethodError) Unwrap() error + type KeyFuncError struct + Err error + func (err *KeyFuncError) Error() string + func (err *KeyFuncError) Is(target error) bool + func (err *KeyFuncError) Unwrap() error + type Keyfunc func(*Token) (interface{}, error) + type MalformedTokenError string + func (err MalformedTokenError) Error() string + func (err MalformedTokenError) Unwrap() error + type MapClaims map[string]interface + func (m MapClaims) Audience() ([]string, error) + func (m MapClaims) ExpiresAt() interface{} + func (m MapClaims) IssuedAt() interface{} + func (m MapClaims) Issuer() interface{} + func (m MapClaims) NotBefore() interface{} + func (m MapClaims) Valid() error + func (m MapClaims) VerifyAudience(cmp string, req bool) bool + func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool + func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool + func (m MapClaims) VerifyIssuer(cmp string, req bool) bool + func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool + type NotYetValidError struct + AttemptedAt time.Time + ValidAt time.Time + func (err *NotYetValidError) Delta() time.Duration + func (err *NotYetValidError) Error() string + func (err *NotYetValidError) Unwrap() error + type NumericDate struct + func NewNumericDate(t time.Time) *NumericDate + func (date *NumericDate) UnmarshalJSON(b []byte) (err error) + func (date NumericDate) MarshalJSON() (b []byte, err error) + type Parser struct + SkipClaimsValidation bool + UseJSONNumber bool + ValidMethods []string + func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) + func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) + func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) + type RegisteredClaims struct + Audience ClaimStrings + ExpiresAt *NumericDate + ID string + IssuedAt *NumericDate + Issuer string + NotBefore *NumericDate + Subject string + func (c *RegisteredClaims) VerifyAudience(cmp string, req bool) bool + func (c *RegisteredClaims) VerifyExpiresAt(cmp time.Time, req bool) bool + func (c *RegisteredClaims) VerifyIssuedAt(cmp time.Time, req bool) bool + func (c *RegisteredClaims) VerifyNotBefore(cmp time.Time, req bool) bool + func (c RegisteredClaims) Valid() error + type SignatureVerificationError struct + Algorithm string + func (err *SignatureVerificationError) Error() string + func (err *SignatureVerificationError) Is(cmp error) bool + func (err *SignatureVerificationError) Unwrap() error + type SigningMethod interface + Alg func() string + Sign func(signingString string, key interface{}) (string, error) + Verify func(signingString, signature string, key interface{}) error + func GetSigningMethod(alg string) SigningMethod + type SigningMethodECDSA struct + CurveBits int + Hash crypto.Hash + KeySize int + Name string + var SigningMethodES256 *SigningMethodECDSA + var SigningMethodES384 *SigningMethodECDSA + var SigningMethodES512 *SigningMethodECDSA + func (m *SigningMethodECDSA) Alg() string + func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string, error) + func (m *SigningMethodECDSA) Verify(signingString, signature string, key interface{}) error + type SigningMethodEd25519 struct + var SigningMethodEdDSA *SigningMethodEd25519 + func (m *SigningMethodEd25519) Alg() string + func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) (string, error) + func (m *SigningMethodEd25519) Verify(signingString, signature string, key interface{}) error + type SigningMethodHMAC struct + Hash crypto.Hash + Name string + var SigningMethodHS256 *SigningMethodHMAC + var SigningMethodHS384 *SigningMethodHMAC + var SigningMethodHS512 *SigningMethodHMAC + func (m *SigningMethodHMAC) Alg() string + func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, error) + func (m *SigningMethodHMAC) Verify(signingString, signature string, key interface{}) error + type SigningMethodRSA struct + Hash crypto.Hash + Name string + var SigningMethodRS256 *SigningMethodRSA + var SigningMethodRS384 *SigningMethodRSA + var SigningMethodRS512 *SigningMethodRSA + func (m *SigningMethodRSA) Alg() string + func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) + func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error + type SigningMethodRSAPSS struct + Options *rsa.PSSOptions + VerifyOptions *rsa.PSSOptions + var SigningMethodPS256 *SigningMethodRSAPSS + var SigningMethodPS384 *SigningMethodRSAPSS + var SigningMethodPS512 *SigningMethodRSAPSS + func (m *SigningMethodRSAPSS) Sign(signingString string, key interface{}) (string, error) + func (m *SigningMethodRSAPSS) Verify(signingString, signature string, key interface{}) error + type StandardClaims struct + Audience string + ExpiresAt int64 + Id string + IssuedAt int64 + Issuer string + NotBefore int64 + Subject string + func (c *StandardClaims) VerifyAudience(cmp string, req bool) bool + func (c *StandardClaims) VerifyExpiresAt(cmp int64, req bool) bool + func (c *StandardClaims) VerifyIssuedAt(cmp int64, req bool) bool + func (c *StandardClaims) VerifyIssuer(cmp string, req bool) bool + func (c *StandardClaims) VerifyNotBefore(cmp int64, req bool) bool + func (c StandardClaims) Valid() error + type Token struct + Claims Claims + Header map[string]interface{} + Method SigningMethod + Raw string + Signature string + Valid bool + func New(method SigningMethod) *Token + func NewWithClaims(method SigningMethod, claims Claims) *Token + func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) + func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) + func (t *Token) SignedString(key interface{}) (string, error) + func (t *Token) SigningString() (string, error) + type UnregisteredSigningMethodError struct + Alg string + func (err *UnregisteredSigningMethodError) Error() string + func (err *UnregisteredSigningMethodError) Unwrap() error + type UsedBeforeIssuedError struct + AttemptedAt time.Time + IssuedAt time.Time + func (err *UsedBeforeIssuedError) Delta() time.Duration + func (err *UsedBeforeIssuedError) Error() string + func (err *UsedBeforeIssuedError) Unwrap() error Other modules containing this package github.com/chanced/go-jwt