From 2327b4688e97e979425741664e10b55b0d2cdfe6 Mon Sep 17 00:00:00 2001 From: Giuseppe De Marco Date: Mon, 20 Jun 2022 17:45:50 +0200 Subject: [PATCH 1/3] fix: JWS header typ according to RFC7519 --- src/cryptojwt/jws/jws.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptojwt/jws/jws.py b/src/cryptojwt/jws/jws.py index fa417e12..c9b334ee 100644 --- a/src/cryptojwt/jws/jws.py +++ b/src/cryptojwt/jws/jws.py @@ -116,7 +116,7 @@ def sign_compact(self, keys=None, protected=None, **kwargs): key, xargs, _alg = self.alg_keys(keys, "sig", protected) if "typ" in self: - xargs["type"] = self["typ"] + xargs["typ"] = self["typ"] _headers.update(xargs) jwt = JWSig(**_headers) From 7655d9c60f8fe8bada66bcfb69038b1642735126 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Tue, 21 Jun 2022 08:36:26 +0200 Subject: [PATCH 2/3] feat: added test for typ in JWS header --- tests/test_06_jws.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_06_jws.py b/tests/test_06_jws.py index 219c0ce7..6045c4cb 100644 --- a/tests/test_06_jws.py +++ b/tests/test_06_jws.py @@ -308,13 +308,14 @@ def P256(): def test_1(): claimset = {"iss": "joe", "exp": 1300819380, "http://example.com/is_root": True} - _jws = JWS(claimset, cty="JWT", alg="none") + _jws = JWS(claimset, cty="JWT", alg="none", typ="JWT") _jwt = _jws.sign_compact() _jr = JWS() _msg = _jr.verify_compact(_jwt, allow_none=True) print(_jr) assert _jr.jwt.headers["alg"] == "none" + assert _jr.jwt.headers["typ"] == "JWT" assert _msg == claimset From a1c58b0abecda27540d443f8910565145649da4d Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Tue, 21 Jun 2022 08:40:19 +0200 Subject: [PATCH 3/3] v1.8.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a1c6d34c..e283fd5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ exclude_lines = [ [tool.poetry] name = "cryptojwt" -version = "1.8.2" +version = "1.8.3" description = "Python implementation of JWT, JWE, JWS and JWK" authors = ["Roland Hedberg "] license = "Apache-2.0"