Versions in this module Expand all Collapse all v1 v1.0.0 Jan 18, 2021 Changes in this version + var ErrExpiredToken = errors.New("expired token") + var ErrInvalidClaims = errors.New("invalid claims") + var ErrInvalidSign = errors.New("invalid sign") + var ErrMalformedToken = errors.New("malformed token") + var ErrWrongAlgorithm = errors.New("wrong algorithm") + func New(key []byte, algo *Algorithm, claims *Claims) ([]byte, error) + func NewHS256(key []byte, claims *Claims) ([]byte, error) + func NewHS256Custom(key []byte, claims interface{}) ([]byte, error) + func NewHS384(key []byte, claims *Claims) ([]byte, error) + func NewHS384Custom(key []byte, claims interface{}) ([]byte, error) + func NewHS512(key []byte, claims *Claims) ([]byte, error) + func NewHS512Custom(key []byte, claims interface{}) ([]byte, error) + func NewWithCustom(key []byte, algo *Algorithm, claims interface{}) ([]byte, error) + func Parse(token []byte, header *Header, claims *Claims) ([]byte, []byte, error) + func ParseAndValidate(token, key []byte, algo *Algorithm, claims *Claims) error + func ParseAndValidateCustom(token, key []byte, algo *Algorithm, claims interface{}, ...) error + func ParseCustom(token []byte, header *Header, claims interface{}) ([]byte, []byte, error) + func ParseHS256(key, token []byte, claims *Claims) error + func ParseHS256Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error + func ParseHS384(key, token []byte, claims *Claims) error + func ParseHS384Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error + func ParseHS512(key, token []byte, claims *Claims) error + func ParseHS512Custom(key, token []byte, claims interface{}, validator ValidatorFunction) error + func Verify(algo *Algorithm, message, sign, key []byte) error + type Algorithm struct + Hash func() hash.Hash + Name string + type Claims struct + Audience string + ExpiresAt int64 + ID string + IssuedAt int64 + Issuer string + NotBefore int64 + Subject string + func (c *Claims) CheckAud(check string) bool + func (c *Claims) CheckExp(check int64) bool + func (c *Claims) CheckIss(check string) bool + func (c *Claims) CheckNbf(check int64) bool + func (c *Claims) Decode(data []byte) error + func (c *Claims) Encode() (string, error) + func (v *Claims) UnmarshalEasyJSON(l *jlexer.Lexer) + func (v *Claims) UnmarshalJSON(data []byte) error + func (v Claims) MarshalEasyJSON(w *jwriter.Writer) + func (v Claims) MarshalJSON() ([]byte, error) + type Header struct + Algorithm string + Type string + func (h *Header) Decode(data []byte) error + func (h *Header) Encode() (string, error) + func (v *Header) UnmarshalEasyJSON(l *jlexer.Lexer) + func (v *Header) UnmarshalJSON(data []byte) error + func (v Header) MarshalEasyJSON(w *jwriter.Writer) + func (v Header) MarshalJSON() ([]byte, error) + type ValidatorFunction func(claims interface{}) bool