pyjwt

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeRS256

func EncodeRS256(payload *pyjson.Object, pemKey string) (string, error)

Compact RS256 token as PyJWT jwt.encode builds it with sorted header keys and a compact payload

func UnverifiedClaims

func UnverifiedClaims(token string) (*pyjson.Object, error)

Payload of a compact token decoded with signature and expiry verification off

func UnverifiedHeader

func UnverifiedHeader(token string) (*pyjson.Object, error)

Header of a compact token read without verifying its signature

Types

type Error

type Error struct {
	Class string
	Msg   string
}

Error is a PyJWT exception with its class name and message

func (*Error) Error

func (e *Error) Error() string

type JWK

type JWK struct {
	KeyID string
	Use   *string
	Key   any
}

JWK is one usable key of a JWK set with its key id, use and public key material

type JWKClient

type JWKClient struct {
	URL      string
	Headers  map[string]string
	Timeout  time.Duration
	Lifespan time.Duration
	HTTP     *http.Client
	Now      func() time.Time
	// contains filtered or unexported fields
}

JWKClient fetches and caches a JWKS endpoint like PyJWKClient with the JWK set cache on

func NewJWKClient

func NewJWKClient(url string, headers map[string]string) *JWKClient

Client with the PyJWKClient defaults of a 30 second timeout and a 300 second set lifespan

func (*JWKClient) SigningKey

func (c *JWKClient) SigningKey(kid string) (*JWK, error)

Key whose id matches kid, refetching the set once when the cached one has no match

func (*JWKClient) SigningKeyFromJWT

func (c *JWKClient) SigningKeyFromJWT(token string) (*JWK, error)

Key named by the unverified kid header of token

func (*JWKClient) SigningKeys

func (c *JWKClient) SigningKeys(refresh bool) ([]JWK, error)

Signing keys of the set, the cached set unless refresh is asked or the lifespan passed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL