Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Change namespace to python_jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
davedoesdev committed Oct 26, 2016
1 parent cc72cab commit c0c959a
Show file tree
Hide file tree
Showing 35 changed files with 92 additions and 793 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build_docs:
pandoc -t rst README.md | sed -e '1,1s/^[^\\]*//' -e '2d' > README.rst

lint:
pylint jwt test bench
pylint python_jwt test bench

test: run_test

Expand All @@ -23,7 +23,7 @@ run_test:
coverage: run_coverage

run_coverage:
./test/run/run_pyvows.py -v --cover --cover-package jwt --cover-report coverage/coverage.xml test
./test/run/run_pyvows.py -v --cover --cover-package python_jwt --cover-report coverage/coverage.xml test

bench: run_bench

Expand All @@ -43,7 +43,7 @@ make_dist:
python setup.py bdist_wheel --universal

travis_test: lint
./test/run/run_coverage.py run --source=jwt -m test.run.run_pyvows -v test
./test/run/run_coverage.py run --source=python_jwt -m test.run.run_pyvows -v test

register:
twine register dist/$(name)-$(version).tar.gz
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Module for generating and verifying [JSON Web Tokens](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html).

- **Note:** From version 2.0.0 the namespace has changed from `jwt` to `python_jwt`, in order to avoid conflict with [PyJWT](https://github.com/jpadilla/pyjwt).
- **Note:** Versions 1.0.0 and later fix [a vulnerability](https://www.timmclean.net/2015/02/25/jwt-alg-none.html) in JSON Web Token verification so please upgrade if you're using this functionality. The API has changed so you will need to update your application. [verify_jwt](http://rawgit.davedoesdev.com/davedoesdev/python-jwt/master/docs/_build/html/index.html#jwt.verify_jwt) now requires you to specify which signature algorithms are allowed.
- Uses [python-jws](https://github.com/brianloveswords/python-jws) to do the heavy lifting.
- Supports [__RS256__, __RS384__, __RS512__](http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-14#section-3.3), [__PS256__, __PS384__, __PS512__](http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-14#section-3.5), [__HS256__, __HS384__, __HS512__](http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-14#section-3.2) and [__none__](http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-14#section-3.6) signature algorithms.
Expand All @@ -11,7 +12,7 @@ Module for generating and verifying [JSON Web Tokens](http://self-issued.info/do
Example:

```python
import jwt, Crypto.PublicKey.RSA as RSA, datetime
import python_jwt as jwt, Crypto.PublicKey.RSA as RSA, datetime
key = RSA.generate(2048)
payload = { 'foo': 'bar', 'wup': 90 };
token = jwt.generate_jwt(payload, key, 'PS256', datetime.timedelta(minutes=5))
Expand All @@ -33,7 +34,7 @@ pip install python_jwt
You can read and write keys from and to [PEM-format](http://www.openssl.org/docs/crypto/pem.html) strings:

```python
import jwt, Crypto.PublicKey.RSA as RSA, datetime
import python_jwt as jwt, Crypto.PublicKey.RSA as RSA, datetime
key = RSA.generate(2048)
priv_pem = key.exportKey()
pub_pem = key.publickey().exportKey()
Expand Down
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Module for generating and verifying `JSON Web
Tokens <http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html>`__.

- **Note:** From version 2.0.0 the namespace has changed from ``jwt``
to ``python_jwt``, in order to avoid conflict with
`PyJWT <https://github.com/jpadilla/pyjwt>`__.
- **Note:** Versions 1.0.0 and later fix `a
vulnerability <https://www.timmclean.net/2015/02/25/jwt-alg-none.html>`__
in JSON Web Token verification so please upgrade if you're using this
Expand Down Expand Up @@ -31,7 +34,7 @@ Example:

.. code:: python
import jwt, Crypto.PublicKey.RSA as RSA, datetime
import python_jwt as jwt, Crypto.PublicKey.RSA as RSA, datetime
key = RSA.generate(2048)
payload = { 'foo': 'bar', 'wup': 90 };
token = jwt.generate_jwt(payload, key, 'PS256', datetime.timedelta(minutes=5))
Expand All @@ -56,7 +59,7 @@ You can read and write keys from and to

.. code:: python
import jwt, Crypto.PublicKey.RSA as RSA, datetime
import python_jwt as jwt, Crypto.PublicKey.RSA as RSA, datetime
key = RSA.generate(2048)
priv_pem = key.exportKey()
pub_pem = key.publickey().exportKey()
Expand Down
2 changes: 1 addition & 1 deletion bench/generate_token_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from unitbench import Benchmark
from test.fixtures import payload, priv_keys, priv_key, algs
from bench.reporter import Reporter
import jwt
import python_jwt as jwt

class GenerateTokenBenchmark(Benchmark):
""" Generate JWT benchmark """
Expand Down
2 changes: 1 addition & 1 deletion bench/verify_token_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from unitbench import Benchmark
from test.fixtures import payload, priv_keys, priv_key, pub_keys, pub_key, algs
from bench.reporter import Reporter
import jwt
import python_jwt as jwt

class VerifyTokenBenchmark(Benchmark):
""" Verify JWT benchmark """
Expand Down
8 changes: 4 additions & 4 deletions coverage/coverage.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" ?>
<coverage branch-rate="0.76" line-rate="0.9059" timestamp="1468534183013" version="4.0.3">
<coverage branch-rate="0.76" line-rate="0.9059" timestamp="1477516190359" version="4.0.3">
<!-- Generated by coverage.py: https://coverage.readthedocs.org -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/f0366e5e2cf18f111cbd61fc34ef720a6584ba02/htdocs/xml/coverage-03.dtd -->
<sources>
<source>/home/david/python-jwt</source>
<source>/home/david/python-jwt/jwt</source>
<source>/home/david/python-jwt/python_jwt</source>
</sources>
<packages>
<package branch-rate="0.76" complexity="0" line-rate="0.9059" name="jwt">
<package branch-rate="0.76" complexity="0" line-rate="0.9059" name="python_jwt">
<classes>
<class branch-rate="0.76" complexity="0" filename="jwt/__init__.py" line-rate="0.9059" name="__init__.py">
<class branch-rate="0.76" complexity="0" filename="python_jwt/__init__.py" line-rate="0.9059" name="__init__.py">
<methods/>
<lines>
<line hits="1" number="5"/>
Expand Down
4 changes: 2 additions & 2 deletions coverage/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h1>Coverage report:
<tbody>

<tr class="file">
<td class="name left"><a href="jwt___init___py.html">jwt/__init__.py</a></td>
<td class="name left"><a href="python_jwt___init___py.html">python_jwt/__init__.py</a></td>
<td>85</td>
<td>8</td>
<td>0</td>
Expand All @@ -107,7 +107,7 @@ <h1>Coverage report:
<div class="content">
<p>
<a class="nav" href="https://coverage.readthedocs.org">coverage.py v4.0.3</a>,
created at 2016-07-14 23:09
created at 2016-10-26 22:09
</p>
</div>
</div>
Expand Down
Loading

0 comments on commit c0c959a

Please sign in to comment.