Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

No shit JWT implementation

Project description

https://secure.travis-ci.org/cordalace/nsjwt.svg?branch=master

No Shit JWT implementation

Advantages:

  • Damn simple: only HMAC SHA-256 (“HS256”) algorithm implemented so no header parameter needed
  • Fast: uses ultrajson and pybase64
  • No Object-Oriented shit

Installation

pip install nsjwt

Usage

>>> import nsjwt
>>> secret = 'secret'
>>> payload = {"sub": "1234567890", "name": "Robbie Basho", "admin": True}

>>> nsjwt.encode(secret, payload)
b'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlJvYmJpZSBCYXNobyIsImFkbWluIjp0cnVlfQ.MvN07jU4TCXH-lrYE2qsiY5cmxHO7ZCH8eLn6WpbWFM'

>>> nsjwt.decode(secret, b'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRmFoZXkiLCJhZG1pbiI6dHJ1ZX0.XDADzzjyGLeoLBl2BHJaytkLtGdhBb5KWsKOtZlVEo8')
{'admin': True, 'name': 'John Fahey', 'sub': '1234567890'}

License

Apache 2.0 - See the LICENSE for more information.

Project details


Release history Release notifications

This version
History Node

0.2.1

History Node

0.2.0

History Node

0.1.1

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
nsjwt-0.2.1-py3-none-any.whl (3.5 kB) Copy SHA256 hash SHA256 Wheel py3 May 16, 2018
nsjwt-0.2.1.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None May 16, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page