Versions in this module Expand all Collapse all v1 v1.1.1 Oct 23, 2024 v1.1.0 Jun 21, 2023 Changes in this version + var InvalidAudienceErr = errors.New("the audience is invalid") + var MalformedHeaderContentErr = errors.New("the header content is malformed") + var MalformedHeaderErr = errors.New("the header is malformed") + var MalformedPayloadContentErr = errors.New("the payload content is malformed") + var MalformedSignatureErr = errors.New("the signature is malformed") + var SegmentCountErr = errors.New("a JWT must have three segments separated by period characters") + var TokenExpiredErr = errors.New("the token is expired") + var UnrecognizedAlgorithmErr = errors.New("unrecognized algorithm") + var UnrecognizedSignatureErr = errors.New("unrecognized signature") + type Algorithm interface + ComputeHash func(value, secret []byte) []byte + Name func() string + type Decoder struct + func NewDecoder(options ...DecoderOption) *Decoder + func (this Decoder) Decode(token string, claims interface{}) error + type DecoderOption func(*Decoder) + func WithDecodingAlgorithm(algorithm Algorithm) DecoderOption + func WithDecodingSecrets(callback func(id string) (secret []byte)) DecoderOption + func WithDecodingValidator(validator Validator) DecoderOption + func WithNamedDecodingAlgorithms(names ...string) DecoderOption + type DefaultValidator struct + func NewDefaultValidator(audiences ...string) DefaultValidator + func (this DefaultValidator) Validate(claim interface{}) error + type Encoder struct + func NewEncoder(options ...EncoderOption) *Encoder + func (this *Encoder) Encode(claims interface{}) (token string, err error) + type EncoderOption func(encoder *Encoder) + func WithEncodingAlgorithm(algorithm Algorithm) EncoderOption + func WithEncodingSecret(id string, secret []byte) EncoderOption + func WithNamedEncodingAlgorithm(algorithm string) EncoderOption + type HS256 struct + func (this HS256) ComputeHash(value, secret []byte) []byte + func (this HS256) Name() string + type HS384 struct + func (this HS384) ComputeHash(value, secret []byte) []byte + func (this HS384) Name() string + type HS512 struct + func (this HS512) ComputeHash(value, secret []byte) []byte + func (this HS512) Name() string + type NoAlgorithm struct + func (this NoAlgorithm) ComputeHash(value, secret []byte) []byte + func (this NoAlgorithm) Name() string + type StandardClaims struct + Audience string + Expiration int64 + func (this StandardClaims) TokenAudience() string + func (this StandardClaims) TokenExpiration() time.Time + type TokenAudience interface + TokenAudience func() string + type TokenExpiration interface + TokenExpiration func() time.Time + type Validator interface + Validate func(claims interface{}) error