Skip to main content

The ultimate Python library for JOSE RFCs, including JWS, JWE, JWK, JWA, JWT

Project description

·joserfc· is a Python library that provides a comprehensive implementation of several essential JSON Object Signing and Encryption (JOSE) standards.

This package contains implementation of:

  • RFC7515: JSON Web Signature

  • RFC7516: JSON Web Encryption

  • RFC7517: JSON Web Key

  • RFC7518: JSON Web Algorithms

  • RFC7519: JSON Web Token

  • RFC7520: Examples of Protecting Content Using JSON Object Signing and Encryption

  • RFC7638: thumbprint for JWK

  • RFC8037: OKP Key and EdDSA algorithm

  • RFC8812: ES256K algorithm

And draft RFCs implementation of:

  • C20P and XC20P

  • ECDH-1PU algorithms

Usage

A quick and simple JWT encoding and decoding would look something like this:

>>> from joserfc import jwt
>>> from joserfc.jwk import OctKey
>>> key = OctKey.import_key("secret")
>>> encoded = jwt.encode({"alg": "HS256"}, {"k": "value"}, key)
>>> encoded
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrIjoidmFsdWUifQ.ni-MJXnZHpFB_8L9P9yllj3RNDfzmD4yBKAyefSctMY'
>>> token = jwt.decode(encoded, key)
>>> token.header
{'alg': 'HS256', 'typ': 'JWT'}
>>> token.claims
{'k': 'value'}
>>> claims_requests = jwt.JWTClaimsRegistry()
>>> claims_requests.validate(token.claims)

License

Licensed under BSD. Please see LICENSE for licensing details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

joserfc-1.0.4.tar.gz (172.1 kB view details)

Uploaded Source

Built Distribution

joserfc-1.0.4-py3-none-any.whl (61.1 kB view details)

Uploaded Python 3

File details

Details for the file joserfc-1.0.4.tar.gz.

File metadata

  • Download URL: joserfc-1.0.4.tar.gz
  • Upload date:
  • Size: 172.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for joserfc-1.0.4.tar.gz
Algorithm Hash digest
SHA256 dc3fc216cfcfc952d4c0d4b06c759a04711af0b667e5973adc47dbb1ba784127
MD5 4d876971c2f8cc504fcf6f39e66d45d9
BLAKE2b-256 6ae44c649e364bafa7cd2dd44ab5c301a721d3ff4942c43feb562deded60b414

See more details on using hashes here.

Provenance

The following attestation bundles were made for joserfc-1.0.4.tar.gz:

Publisher: pypi.yml on authlib/joserfc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file joserfc-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: joserfc-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 61.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for joserfc-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ecf3a5999f89d3a663485ab7c4f633541586d6f44e664ee760197299f39ed51b
MD5 1d2b9d3e17139c39350f19e446920a9c
BLAKE2b-256 5781a61b8942d94ca222c9df901d2704d2746f49174727e64eb5cd0a21450f1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for joserfc-1.0.4-py3-none-any.whl:

Publisher: pypi.yml on authlib/joserfc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page