adafruit-circuitpython-jwt


Nameadafruit-circuitpython-jwt JSON
Version 1.2.17 PyPI version JSON
download
home_page
SummaryJSON Web Token Authentication
upload_time2023-12-09 17:45:18
maintainer
docs_urlNone
author
requires_python
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": "",
    "name": "adafruit-circuitpython-jwt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "adafruit,blinka,circuitpython,micropython,jwt,jwt,,json,,token,,authentication",
    "author": "",
    "author_email": "Adafruit Industries <circuitpython@adafruit.com>",
    "download_url": "https://files.pythonhosted.org/packages/20/84/725ebb8e93e3905cb2555e189dc7dc20a140b92a6fc5b34aea09a02fd9d2/adafruit-circuitpython-jwt-1.2.17.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.17",
    "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": "5fcfd5f4fa4270eca8af34661473342cb9163167c880741a848c6e7440c56669",
                "md5": "8e2e1349b7e292f037b0ef765ac7ede5",
                "sha256": "1bed26cef1b8bcb6b7b8cb111cd1633df38f9e7ba322f25a3adcf8bebe2add49"
            },
            "downloads": -1,
            "filename": "adafruit_circuitpython_jwt-1.2.17-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8e2e1349b7e292f037b0ef765ac7ede5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6659,
            "upload_time": "2023-12-09T17:45:15",
            "upload_time_iso_8601": "2023-12-09T17:45:15.546263Z",
            "url": "https://files.pythonhosted.org/packages/5f/cf/d5f4fa4270eca8af34661473342cb9163167c880741a848c6e7440c56669/adafruit_circuitpython_jwt-1.2.17-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2084725ebb8e93e3905cb2555e189dc7dc20a140b92a6fc5b34aea09a02fd9d2",
                "md5": "2d684f1e0c3cc15f04dd93adb9af311a",
                "sha256": "153a09ce0949266101d7277eecb68e0296b75bd9fbede922bb61296ecf95d01e"
            },
            "downloads": -1,
            "filename": "adafruit-circuitpython-jwt-1.2.17.tar.gz",
            "has_sig": false,
            "md5_digest": "2d684f1e0c3cc15f04dd93adb9af311a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 32023,
            "upload_time": "2023-12-09T17:45:18",
            "upload_time_iso_8601": "2023-12-09T17:45:18.367088Z",
            "url": "https://files.pythonhosted.org/packages/20/84/725ebb8e93e3905cb2555e189dc7dc20a140b92a6fc5b34aea09a02fd9d2/adafruit-circuitpython-jwt-1.2.17.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-09 17:45:18",
    "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.14901s