Documentation
¶
Index ¶
- Variables
- type CustomClaims
- type JWT
- func (j *JWT[T]) CreateDefaultToken(signInfo T, expiresAt time.Time) (string, error)
- func (j *JWT[T]) CreateToken(claims CustomClaims[T]) (string, error)
- func (j *JWT[T]) ParseToken(tokenString string) (*CustomClaims[T], error)
- func (j *JWT[T]) ParseTokenWithKeyFunc(tokenString string, ...) (*CustomClaims[T], error)
- func (j *JWT[T]) VerifyToken(tokenString string, claims CustomClaims[T]) error
- func (j *JWT[T]) VerifyTokenOnlySignInfo(tokenString string, signInfo T) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidSecretKey = errors.New("invalid secret key") ErrInvalidType = errors.New("invalid type") )
Functions ¶
This section is empty.
Types ¶
type CustomClaims ¶
type CustomClaims[T comparable] struct { SignInfo T jwt.RegisteredClaims }
type JWT ¶
type JWT[T comparable] struct { // contains filtered or unexported fields }
func NewES256JWT ¶
func NewES256JWT[T comparable](secretKey *ecdsa.PrivateKey) (*JWT[T], error)
func NewHS256JWT ¶
func NewHS256JWT[T comparable](secretKey []byte) (*JWT[T], error)
func NewJWT ¶
func NewJWT[T comparable](secretKey any, signingAlgo jwt.SigningMethod) (*JWT[T], error)
func (*JWT[T]) CreateDefaultToken ¶
func (*JWT[T]) CreateToken ¶
func (j *JWT[T]) CreateToken(claims CustomClaims[T]) (string, error)
func (*JWT[T]) ParseToken ¶
func (j *JWT[T]) ParseToken(tokenString string) (*CustomClaims[T], error)
func (*JWT[T]) ParseTokenWithKeyFunc ¶
func (*JWT[T]) VerifyToken ¶
func (j *JWT[T]) VerifyToken(tokenString string, claims CustomClaims[T]) error
func (*JWT[T]) VerifyTokenOnlySignInfo ¶
Click to show internal directories.
Click to hide internal directories.