<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/pyjwt.git/jwt/utils.py, branch prep-release</title>
<subtitle>github.com: progrium/pyjwt.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/'/>
<entry>
<title>Prefer ModuleNotFoundError over ImportError (#565)</title>
<updated>2020-12-21T16:05:53+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-12-21T16:05:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=541dd0dd8cafacc0aff9fa36cf04251c535f69eb'/>
<id>541dd0dd8cafacc0aff9fa36cf04251c535f69eb</id>
<content type='text'>
ModuleNotFoundError was introduced in Python 3. It is raised when the
module does not exist. On the other hand, ImportError is raised during
any import failure. For example, a syntax error or other runtime error.

Using ModuleNotFoundError means that errors unrelated to a missing
package will be propagated to the user. PyJWT doesn't know how to handle
these.

This also allows more functions to always be available for import</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ModuleNotFoundError was introduced in Python 3. It is raised when the
module does not exist. On the other hand, ImportError is raised during
any import failure. For example, a syntax error or other runtime error.

Using ModuleNotFoundError means that errors unrelated to a missing
package will be propagated to the user. PyJWT doesn't know how to handle
these.

This also allows more functions to always be available for import</pre>
</div>
</content>
</entry>
<entry>
<title>Simplify from_base64url_uint() (#570)</title>
<updated>2020-12-21T15:57:45+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-12-21T15:57:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=b0c1e60be6b3b7b555eb46d947dd859f5d0c70e2'/>
<id>b0c1e60be6b3b7b555eb46d947dd859f5d0c70e2</id>
<content type='text'>
int.from_bytes() has been available since Python 3.2. Using it avoids
string formatting.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
int.from_bytes() has been available since Python 3.2. Using it avoids
string formatting.</pre>
</div>
</content>
</entry>
<entry>
<title>Type hint jwt.utils module (#564)</title>
<updated>2020-12-20T17:26:36+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-12-20T17:26:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=5d7bdd68aec70a8a8cc4979bda93adc3c44f945f'/>
<id>5d7bdd68aec70a8a8cc4979bda93adc3c44f945f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Split PyJWT/PyJWS classes to tighten type interfaces (#559)</title>
<updated>2020-12-19T23:32:12+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-12-19T23:32:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=94d102b2e38d09f3c5ec459a8365de8a86c51fe5'/>
<id>94d102b2e38d09f3c5ec459a8365de8a86c51fe5</id>
<content type='text'>
The class PyJWT was previously a subclass of PyJWS. However, this
combination does not follow the Liskov substitution principle. That is,
using PyJWT in place of a PyJWS would not produce correct results or
follow type contracts.

While these classes look to share a common interface it doesn't go
beyond the method names "encode" and "decode" and so is merely
superficial.

The classes have been split into two. PyJWT now uses composition instead
of inheritance to achieve the desired behavior. Splitting the classes in
this way allowed for precising the type interfaces.

The complete parameter to .decode() has been removed. This argument was
used to alter the return type of .decode(). Now, there are two different
methods with more explicit return types and values. The new method name
is .decode_complete(). This fills the previous role filled by
.decode(..., complete=True).

Closes #554, #396, #394

Co-authored-by: Sam Bull &lt;git@sambull.org&gt;

Co-authored-by: Sam Bull &lt;git@sambull.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The class PyJWT was previously a subclass of PyJWS. However, this
combination does not follow the Liskov substitution principle. That is,
using PyJWT in place of a PyJWS would not produce correct results or
follow type contracts.

While these classes look to share a common interface it doesn't go
beyond the method names "encode" and "decode" and so is merely
superficial.

The classes have been split into two. PyJWT now uses composition instead
of inheritance to achieve the desired behavior. Splitting the classes in
this way allowed for precising the type interfaces.

The complete parameter to .decode() has been removed. This argument was
used to alter the return type of .decode(). Now, there are two different
methods with more explicit return types and values. The new method name
is .decode_complete(). This fills the previous role filled by
.decode(..., complete=True).

Closes #554, #396, #394

Co-authored-by: Sam Bull &lt;git@sambull.org&gt;

Co-authored-by: Sam Bull &lt;git@sambull.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Replace merge_dict() with builtin dict unpacking generalizations (#555)</title>
<updated>2020-12-18T00:38:51+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-12-18T00:38:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=523a6f2952dc64c62f3a7cac9804a29176922453'/>
<id>523a6f2952dc64c62f3a7cac9804a29176922453</id>
<content type='text'>
Merging two dict is support since Python 3.5 using the ** syntax.

See:

- https://docs.python.org/3.9/whatsnew/3.5.html#whatsnew-pep-448
- https://www.python.org/dev/peps/pep-0448/</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Merging two dict is support since Python 3.5 using the ** syntax.

See:

- https://docs.python.org/3.9/whatsnew/3.5.html#whatsnew-pep-448
- https://www.python.org/dev/peps/pep-0448/</pre>
</div>
</content>
</entry>
<entry>
<title>Tighten bytes/str boundaries and remove unnecessary coercing (#547)</title>
<updated>2020-12-17T20:09:56+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-12-17T20:09:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=97cd4031549d363fa34737635eab33491fa718fe'/>
<id>97cd4031549d363fa34737635eab33491fa718fe</id>
<content type='text'>
Now that the project is Python 3 only, the boundaries between bytes and
Unicode strings is more explicit.

This allows removing several unnecessary force_bytes() and
force_unicode() calls that handled differences between Python 2 and
Python 3. All uses of force_unicode() have been removed.

For values that are known to be bytes, use `.decode()` instead. For
values are that known to be str, use `.encode()` instead. This strategy
makes the type explicit and reduces a function call.

Key handling continues to use force_bytes() to allow callers to pass
either bytes or str.

To help enforce bytes/str handling in the future, the `-b` option is
passed to Python when testing. This option will emit a warning if bytes
and str are improperly mixed together.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that the project is Python 3 only, the boundaries between bytes and
Unicode strings is more explicit.

This allows removing several unnecessary force_bytes() and
force_unicode() calls that handled differences between Python 2 and
Python 3. All uses of force_unicode() have been removed.

For values that are known to be bytes, use `.decode()` instead. For
values are that known to be str, use `.encode()` instead. This strategy
makes the type explicit and reduces a function call.

Key handling continues to use force_bytes() to allow callers to pass
either bytes or str.

To help enforce bytes/str handling in the future, the `-b` option is
passed to Python when testing. This option will emit a warning if bytes
and str are improperly mixed together.</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unnecessary compatibility shims for Python 2 (#498)</title>
<updated>2020-06-19T05:53:17+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2020-06-19T05:53:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=dc8dc7d05d54bd5502295601c01b557caab92a76'/>
<id>dc8dc7d05d54bd5502295601c01b557caab92a76</id>
<content type='text'>
As the project is Python 3 only, can remove the compatibility shims in
compat.py.

Type checking has been simplified where it can:
  - str is iterable
  - bytes is iterable
  - use isinstance instead of issubclass

The remaining function bytes_from_int() has been moved to utils.py.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As the project is Python 3 only, can remove the compatibility shims in
compat.py.

Type checking has been simplified where it can:
  - str is iterable
  - bytes is iterable
  - use isinstance instead of issubclass

The remaining function bytes_from_int() has been moved to utils.py.</pre>
</div>
</content>
</entry>
<entry>
<title>DX Tweaks (#450)</title>
<updated>2019-10-22T02:38:34+00:00</updated>
<author>
<name>José Padilla</name>
<email>jpadilla@webapplicate.com</email>
</author>
<published>2019-10-22T02:38:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=11ac89474b1179925c76450fcc4b3d2042c45f19'/>
<id>11ac89474b1179925c76450fcc4b3d2042c45f19</id>
<content type='text'>
* Setup pre-commit hooks

* Run initial `tox -e lint`

* Fix package name

* Fix .travis.yml
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Setup pre-commit hooks

* Run initial `tox -e lint`

* Fix package name

* Fix .travis.yml
</pre>
</div>
</content>
</entry>
<entry>
<title>Require cryptography &gt;= 1.0, replace deprecated function</title>
<updated>2016-12-17T12:08:47+00:00</updated>
<author>
<name>Ran Benita</name>
<email>ran234@gmail.com</email>
</author>
<published>2016-12-17T12:08:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=aaf2ac3e0cb6f9180f1357526e37e94d22ce0dec'/>
<id>aaf2ac3e0cb6f9180f1357526e37e94d22ce0dec</id>
<content type='text'>
The functions `decode_rfc6979_signature` and `encode_rfc6979_signature`
were deprecated in cryptography 1.0:
    https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst#10---2015-08-12
and raise a DeprecationWarning now. The replacements are exactly the same.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The functions `decode_rfc6979_signature` and `encode_rfc6979_signature`
were deprecated in cryptography 1.0:
    https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst#10---2015-08-12
and raise a DeprecationWarning now. The replacements are exactly the same.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add JWK support for HMAC and RSA keys</title>
<updated>2016-08-28T23:08:55+00:00</updated>
<author>
<name>Mark Adams</name>
<email>mark@markadams.me</email>
</author>
<published>2016-05-06T04:58:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pyjwt.git/commit/?id=42b011410b28ea3e3920f40641a57c8893e2e04e'/>
<id>42b011410b28ea3e3920f40641a57c8893e2e04e</id>
<content type='text'>
- JWKs for RSA and HMAC can be encoded / decoded using the .to_jwk() and
  .from_jwk() methods on their respective jwt.algorithms instances

- Replaced tests.utils ensure_unicode and ensure_bytes with jwt.utils versions
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- JWKs for RSA and HMAC can be encoded / decoded using the .to_jwk() and
  .from_jwk() methods on their respective jwt.algorithms instances

- Replaced tests.utils ensure_unicode and ensure_bytes with jwt.utils versions
</pre>
</div>
</content>
</entry>
</feed>
