{ "info": { "author": "Mark C\u00f4t\u00e9", "author_email": "mcote@mozilla.com", "bugtrack_url": null, "classifiers": [], "description": "jot\n===\n\njot is a Python implementation of the *draft* [JSON Web Token (JWT)](http://tools.ietf.org/html/draft-jones-json-web-token-07) specification.\n\nIt supports signing through the *draft* [JWS](http://tools.ietf.org/html/draft-jones-json-web-signature-04) specification. Only HMAC SHA-256/384/512 are\nsupported as of yet.\n\nIt will eventually support encryption through JWE, following a similar API.\n\n\nPlaintext JWT\n-------------\n\nPlaintext JWTs are neither signed nor encrypted and take a JSON-compatible\nobject as the sole argument.\n\n >>> from jot import jwt\n >>> msg = jwt.encode({'status': 'ready'})\n >>> msg\n 'eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdGF0dXMiOiJyZWFkeSJ9.'\n >>> jwt.decode(msg)\n {'headers': {u'alg': u'none', u'typ': u'JWT'}, 'valid': True, 'payload':\n {u'status': u'ready'}}\n\n\nSigned JWT (JWS)\n----------------\n\nFor encoding, you need to provide an object representing your desired\nalgorithm along with a key and, optionally, a key id for the header.\n\n >>> from jot import jwt, jws\n >>> msg = jwt.encode({'status': 'ready'}, signer=jws.HmacSha(\n bits=256, key='verysecret', key_id='client1'))\n >>> msg\n 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNsaWVudDEifQ.eyJzdGF0dXM\n iOiJyZWFkeSJ9.DcKKQXXUjGP7pape8BgQ3AcQSPH8toWFLY2woIVUZ-w'\n\nTo decode and verify, you must pass a signer object for every possible\nexpected algorithm. This may only be one. You can pass a key directly to\nthe signer object if you expect only a particular one:\n\n >>> jwt.decode(msg, signers=[jws.HmacSha(bits=256, key='verysecret')])\n {'headers': {u'alg': u'HS256', u'typ': u'JWT', u'kid': u'client1'},\n 'valid': True, 'payload': {u'status': u'ready'}}\n\nIf you expect any of several keys, you can pass a dictionary of key_id -> key\nmappings. decode() will use the 'kid' (key id) header to choose the correct\none.\n\n >>> jwt.decode(msg, signers=[jws.HmacSha(bits=256, keydict={'client1':\n 'verysecret', 'client2': 'evensecreter'})])\n {'headers': {u'alg': u'HS256', u'typ': u'JWT', u'kid': u'client1'},\n 'valid': True, 'payload': {u'status': u'ready'}}\n\nAn invalid key, or a key id not being found in the key dictionary, will flip\nthe 'valid' attribute to False:\n\n >>> jwt.decode(msg, signers=[jws.HmacSha(bits=256, keydict={'client1':\n 'notverysecret', 'client2': 'evensecreter'})])\n {'headers': {u'alg': u'HS256', u'typ': u'JWT', u'kid': u'client1'},\n 'valid': False, 'payload': {u'status': u'ready'}}\n >>> jwt.decode(msg, signers=[jws.HmacSha(bits=256, keydict={'client10':\n 'verysecret', 'client2': 'evensecreter'})])\n {'headers': {u'alg': u'HS256', u'typ': u'JWT', u'kid': u'client1'},\n 'valid': False, 'payload': {u'status': u'ready'}}\n\nThe headers and payload should not be trusted if valid is False, but they are\nprovided for informational purposes.\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/markrcote/jot", "keywords": "", "license": "MPL 2.0", "maintainer": null, "maintainer_email": null, "name": "jot", "package_url": "https://pypi.org/project/jot/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/jot/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/markrcote/jot" }, "release_url": "https://pypi.org/project/jot/0.2/", "requires_dist": null, "requires_python": null, "summary": "JSON Web Tokens", "version": "0.2" }, "last_serial": 1210362, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "a5588cfa296ba5c2d6714432e74c29c1", "sha256": "e8160284f1b978f19119926e8693004263209e96dd5807b87ac1f85aecfd2203" }, "downloads": -1, "filename": "jot-0.1.tar.gz", "has_sig": false, "md5_digest": "a5588cfa296ba5c2d6714432e74c29c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3882, "upload_time": "2014-08-26T00:11:42", "url": "https://files.pythonhosted.org/packages/81/a2/dec0d114ec5fcab2dae514be7b3229ae504f5d9ea22d8698a3336ed35e4c/jot-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "2b471d61915d01388f2a055081edec20", "sha256": "6a433c5d9337c47967df441db4b54d3cec6f1a0456887d2258572fcf86e7136c" }, "downloads": -1, "filename": "jot-0.2.tar.gz", "has_sig": false, "md5_digest": "2b471d61915d01388f2a055081edec20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5177, "upload_time": "2014-09-02T13:43:13", "url": "https://files.pythonhosted.org/packages/a6/f3/e514043df7898ce60dcf3b35c2a4bbf7b53b40673cf3910701a950e3ff86/jot-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2b471d61915d01388f2a055081edec20", "sha256": "6a433c5d9337c47967df441db4b54d3cec6f1a0456887d2258572fcf86e7136c" }, "downloads": -1, "filename": "jot-0.2.tar.gz", "has_sig": false, "md5_digest": "2b471d61915d01388f2a055081edec20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5177, "upload_time": "2014-09-02T13:43:13", "url": "https://files.pythonhosted.org/packages/a6/f3/e514043df7898ce60dcf3b35c2a4bbf7b53b40673cf3910701a950e3ff86/jot-0.2.tar.gz" } ] }