Skip to content

Commit 7951474

Browse files
authored
Merge pull request #127 from IdentityPython/jws-typ-typo
fix: JWS header typ according to RFC7519
2 parents ec79b98 + a1c58b0 commit 7951474

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ exclude_lines = [
2222

2323
[tool.poetry]
2424
name = "cryptojwt"
25-
version = "1.8.2"
25+
version = "1.8.3"
2626
description = "Python implementation of JWT, JWE, JWS and JWK"
2727
authors = ["Roland Hedberg <roland@catalogix.se>"]
2828
license = "Apache-2.0"

src/cryptojwt/jws/jws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def sign_compact(self, keys=None, protected=None, **kwargs):
116116
key, xargs, _alg = self.alg_keys(keys, "sig", protected)
117117

118118
if "typ" in self:
119-
xargs["type"] = self["typ"]
119+
xargs["typ"] = self["typ"]
120120

121121
_headers.update(xargs)
122122
jwt = JWSig(**_headers)

tests/test_06_jws.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,14 @@ def P256():
308308
def test_1():
309309
claimset = {"iss": "joe", "exp": 1300819380, "http://example.com/is_root": True}
310310

311-
_jws = JWS(claimset, cty="JWT", alg="none")
311+
_jws = JWS(claimset, cty="JWT", alg="none", typ="JWT")
312312
_jwt = _jws.sign_compact()
313313

314314
_jr = JWS()
315315
_msg = _jr.verify_compact(_jwt, allow_none=True)
316316
print(_jr)
317317
assert _jr.jwt.headers["alg"] == "none"
318+
assert _jr.jwt.headers["typ"] == "JWT"
318319
assert _msg == claimset
319320

320321

0 commit comments

Comments
 (0)