Skip to content

Commit a3d54b0

Browse files
authored
Fix #1022: Map algorithm=None to "none" (#1056)
Reverts the changes introduced in #979.
1 parent 8a65fbe commit a3d54b0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

jwt/api_jws.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def encode(
118118
self,
119119
payload: bytes,
120120
key: AllowedPrivateKeys | PyJWK | str | bytes,
121-
algorithm: str | None = None,
121+
algorithm: str | None = "HS256",
122122
headers: dict[str, Any] | None = None,
123123
json_encoder: type[json.JSONEncoder] | None = None,
124124
is_payload_detached: bool = False,
@@ -131,7 +131,7 @@ def encode(
131131
if isinstance(key, PyJWK):
132132
algorithm_ = key.algorithm_name
133133
else:
134-
algorithm_ = "HS256"
134+
algorithm_ = "none"
135135
else:
136136
algorithm_ = algorithm
137137

jwt/api_jwt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def encode(
8080
self,
8181
payload: dict[str, Any],
8282
key: AllowedPrivateKeyTypes,
83-
algorithm: str | None = None,
83+
algorithm: str | None = "HS256",
8484
headers: dict[str, Any] | None = None,
8585
json_encoder: type[json.JSONEncoder] | None = None,
8686
sort_headers: bool = True,

0 commit comments

Comments
 (0)