adafruit-circuitpython-jwt


Nameadafruit-circuitpython-jwt JSON
Version 1.2.18 PyPI version JSON
download
home_pageNone
SummaryJSON Web Token Authentication
upload_time2024-10-07 22:31:24
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords adafruit blinka circuitpython micropython jwt jwt json token authentication
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Introduction
============

.. image:: https://readthedocs.org/projects/adafruit-circuitpython-jwt/badge/?version=latest
    :target: https://docs.circuitpython.org/projects/jwt/en/latest/
    :alt: Documentation Status

.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
    :target: https://adafru.it/discord
    :alt: Discord

.. image:: https://github.com/adafruit/Adafruit_CircuitPython_JWT/workflows/Build%20CI/badge.svg
    :target: https://github.com/adafruit/Adafruit_CircuitPython_JWT/actions/
    :alt: Build Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Code Style: Black

JSON Web Token (JWT) Authentication module for CircuitPython. JSON Web Tokens are an open, industry standard
`RFC 7519 <https://tools.ietf.org/html/rfc7519>`_ method for representing claims securely between two parties.

This library currently supports the following signature algorithms for JWT generation and verification:
 * No encoding ("none")
 * RS256/SHA-256 (via `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_)
 * RS384/SHA-384 (via `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_)
 * RS512/SHA-512 (via `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_)

Dependencies
=============
This driver depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
* `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_
* `Adafruit_CircuitPython_binascii <https://github.com/adafruit/Adafruit_CircuitPython_binascii>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.

Installing from PyPI
=====================
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-jwt/>`_. To install for current user:

.. code-block:: shell

    pip3 install adafruit-circuitpython-jwt

To install system-wide (this may be required in some cases):

.. code-block:: shell

    sudo pip3 install adafruit-circuitpython-jwt

To install in a virtual environment in your current project:

.. code-block:: shell

    mkdir project-name && cd project-name
    python3 -m venv .venv
    source .venv/bin/activate
    pip3 install adafruit-circuitpython-jwt

Usage Example
=============

Generating encoded JWT

.. code-block:: python

        import adafruit_jwt
        # Import Private RSA key from a secrets.py file
        try:
            from secrets import secrets
        except ImportError:
            print("WiFi secrets are kept in secrets.py, please add them there!")
            raise

        # Create JWT Claims
        claims = {"iss": "joe",
                "exp": 1300819380,
                "name": "John Doe",
                "admin": True}

        # Generate JWT, sign with RSA private key and RS-256
        encoded_jwt = adafruit_jwt.JWT.generate(
            claims, secrets["private_key"], algo="RS256")
        print("Encoded JWT: ", encoded_jwt)


Validating a generated JWT, encoded_jwt.

.. code-block:: python

        import adafruit_jwt
        decoded_jwt = adafruit_jwt.JWT.validate(encoded_jwt)
        # The decoded JWT's JOSE header and claims set are returned as a tuple
        print('JOSE Header: {}\nJWT Claims: {}'.format(decoded_jwt[0], decoded_jwt[1]))

Documentation
=============

API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/jwt/en/latest/>`_.

For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

Contributing
============

Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_JWT/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "adafruit-circuitpython-jwt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "adafruit, blinka, circuitpython, micropython, jwt, jwt, , json, , token, , authentication",
    "author": null,
    "author_email": "Adafruit Industries <circuitpython@adafruit.com>",
    "download_url": "https://files.pythonhosted.org/packages/b9/0f/b7a31392a8f6faf81f37970f0ebd0743688b854b8c465c8fb36cbd1373f5/adafruit_circuitpython_jwt-1.2.18.tar.gz",
    "platform": null,
    "description": "Introduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-jwt/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/jwt/en/latest/\n    :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_JWT/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_JWT/actions/\n    :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nJSON Web Token (JWT) Authentication module for CircuitPython. JSON Web Tokens are an open, industry standard\n`RFC 7519 <https://tools.ietf.org/html/rfc7519>`_ method for representing claims securely between two parties.\n\nThis library currently supports the following signature algorithms for JWT generation and verification:\n * No encoding (\"none\")\n * RS256/SHA-256 (via `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_)\n * RS384/SHA-384 (via `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_)\n * RS512/SHA-512 (via `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_)\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n* `Adafruit_CircuitPython_RSA <https://github.com/adafruit/Adafruit_CircuitPython_RSA>`_\n* `Adafruit_CircuitPython_binascii <https://github.com/adafruit/Adafruit_CircuitPython_binascii>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.\n\nInstalling from PyPI\n=====================\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI <https://pypi.org/project/adafruit-circuitpython-jwt/>`_. To install for current user:\n\n.. code-block:: shell\n\n    pip3 install adafruit-circuitpython-jwt\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n    sudo pip3 install adafruit-circuitpython-jwt\n\nTo install in a virtual environment in your current project:\n\n.. code-block:: shell\n\n    mkdir project-name && cd project-name\n    python3 -m venv .venv\n    source .venv/bin/activate\n    pip3 install adafruit-circuitpython-jwt\n\nUsage Example\n=============\n\nGenerating encoded JWT\n\n.. code-block:: python\n\n        import adafruit_jwt\n        # Import Private RSA key from a secrets.py file\n        try:\n            from secrets import secrets\n        except ImportError:\n            print(\"WiFi secrets are kept in secrets.py, please add them there!\")\n            raise\n\n        # Create JWT Claims\n        claims = {\"iss\": \"joe\",\n                \"exp\": 1300819380,\n                \"name\": \"John Doe\",\n                \"admin\": True}\n\n        # Generate JWT, sign with RSA private key and RS-256\n        encoded_jwt = adafruit_jwt.JWT.generate(\n            claims, secrets[\"private_key\"], algo=\"RS256\")\n        print(\"Encoded JWT: \", encoded_jwt)\n\n\nValidating a generated JWT, encoded_jwt.\n\n.. code-block:: python\n\n        import adafruit_jwt\n        decoded_jwt = adafruit_jwt.JWT.validate(encoded_jwt)\n        # The decoded JWT's JOSE header and claims set are returned as a tuple\n        print('JOSE Header: {}\\nJWT Claims: {}'.format(decoded_jwt[0], decoded_jwt[1]))\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/jwt/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_JWT/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "JSON Web Token Authentication",
    "version": "1.2.18",
    "project_urls": {
        "Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_JWT"
    },
    "split_keywords": [
        "adafruit",
        " blinka",
        " circuitpython",
        " micropython",
        " jwt",
        " jwt",
        " ",
        " json",
        " ",
        " token",
        " ",
        " authentication"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c89f6a06a79d98069488050d8ae2f09ed4ed0fc6a95cedc2246b9f33cad3c7e4",
                "md5": "e7d693791e2b36d0a1fbeb30ede0615a",
                "sha256": "cc35cc96c0918aef2b84036dc2ef4b1cd55dbc07b6b587dc8861f35b24c0fcaa"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_jwt-1.2.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e7d693791e2b36d0a1fbeb30ede0615a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6660,
            "upload_time": "2024-10-07T22:31:22",
            "upload_time_iso_8601": "2024-10-07T22:31:22.958020Z",
            "url": "https://files.pythonhosted.org/packages/c8/9f/6a06a79d98069488050d8ae2f09ed4ed0fc6a95cedc2246b9f33cad3c7e4/adafruit_circuitpython_jwt-1.2.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b90fb7a31392a8f6faf81f37970f0ebd0743688b854b8c465c8fb36cbd1373f5",
                "md5": "f503d45222a3ce527943a107ce371bae",
                "sha256": "2b00698b738875d12bc72fcbffb3ccabcfbdd414bcea39649d7ba2ea967284a2"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_jwt-1.2.18.tar.gz",
            "has_sig": false,
            "md5_digest": "f503d45222a3ce527943a107ce371bae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 32009,
            "upload_time": "2024-10-07T22:31:24",
            "upload_time_iso_8601": "2024-10-07T22:31:24.375596Z",
            "url": "https://files.pythonhosted.org/packages/b9/0f/b7a31392a8f6faf81f37970f0ebd0743688b854b8c465c8fb36cbd1373f5/adafruit_circuitpython_jwt-1.2.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 22:31:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adafruit",
    "github_project": "Adafruit_CircuitPython_JWT",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "adafruit-circuitpython-jwt"
}
        
Elapsed time: 0.45670s