Skip to content

Latest commit

 

History

History
104 lines (77 loc) · 2.72 KB

File metadata and controls

104 lines (77 loc) · 2.72 KB

JOSE RFC

joserfc is a Python library that provides a comprehensive implementation of several essential JSON Object Signing and Encryption (JOSE) standards, including JWS (JSON Web Signature), JWE (JSON Web Encryption), JWK (JSON Web Key), JWA (JSON Web Algorithms), and JWT (JSON Web Tokens).

It is derived from Authlib, but features a redesigned API specific to JOSE functionality.

Usage

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

>>> from joserfc import jwt, jwk
>>> key = jwk.import_key("your-secret-key", "oct")
>>> encoded = jwt.encode({"alg": "HS256"}, {"k": "value"}, key)
>>> encoded
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJrIjoidmFsdWUifQ._M8ViO_GK6TnZ9G9eqdlS7IpNWzhoGwaYYDQ3hEwwmA'
>>> token = jwt.decode(encoded, key)
>>> token.header
{'alg': 'HS256', 'typ': 'JWT'}
>>> token.claims
{'k': 'value'}

You would find more details and advanced usage in :ref:`jwt` section.

Important

The string "your-secret-key" employed in the above example is solely intended for demonstration purposes. In a production environment, it is crucial to use a highly secure secret key to ensure robust security measures.

RFCs

It follows RFCs with extensible API. The module has implementations of:

And draft RFCs implementation of:

Hint

RFC7520 is implemented as test cases.

Next

Explore the following sections to discover more about joserfc and its features.

.. toctree::
   :caption: Getting started
   :hidden:

   guide/introduction
   install

.. toctree::
   :caption: Essentials
   :hidden:

   guide/index
   guide/algorithms
   guide/registry
   guide/errors
   migrations/index

.. toctree::
   :caption: Recipes
   :hidden:

   recipes/cheatsheet
   recipes/azure
   recipes/openssl


.. toctree::
   :caption: Development
   :hidden:

   api/index
   rfc/index
   security
   stability
   contributing/index
   changelog