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" 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) 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