Skip to content

Commit

Permalink
Bump PyJWT to 2.7.0 (#93128)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed May 16, 2023
1 parent 99265a9 commit 32b70ea
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions homeassistant/auth/jwt_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def verify_and_decode(
# nothing slips through.
assert "exp" in payload, "exp claim is required"
assert "iat" in payload, "iat claim is required"
self._validate_claims( # type: ignore[no-untyped-call]
self._validate_claims(
payload=payload,
options=merged_options,
issuer=issuer,
Expand All @@ -102,7 +102,7 @@ def verify_and_decode(
return payload


_jwt = _PyJWTWithVerify() # type: ignore[no-untyped-call]
_jwt = _PyJWTWithVerify()
verify_and_decode = _jwt.verify_and_decode
unverified_hs256_token_decode = lru_cache(maxsize=JWT_TOKEN_CACHE_SIZE)(
partial(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/helpers/config_entry_oauth2_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,14 +542,14 @@ def _encode_jwt(hass: HomeAssistant, data: dict) -> str:


@callback
def _decode_jwt(hass: HomeAssistant, encoded: str) -> dict | None:
def _decode_jwt(hass: HomeAssistant, encoded: str) -> dict[str, Any] | None:
"""JWT encode data."""
secret: str | None = hass.data.get(DATA_JWT_SECRET)

if secret is None:
return None

try:
return jwt.decode(encoded, secret, algorithms=["HS256"])
return jwt.decode(encoded, secret, algorithms=["HS256"]) # type: ignore[no-any-return]
except jwt.InvalidTokenError:
return None
2 changes: 1 addition & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PyJWT==2.6.0
PyJWT==2.7.0
PyNaCl==1.5.0
PyTurboJPEG==1.6.7
aiodiscover==1.4.16
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies = [
"ifaddr==0.1.7",
"jinja2==3.1.2",
"lru-dict==1.1.8",
"PyJWT==2.6.0",
"PyJWT==2.7.0",
# PyJWT has loose dependency. We want the latest one.
"cryptography==40.0.2",
# pyOpenSSL 23.1.0 is required to work with cryptography 39+
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ home-assistant-bluetooth==1.10.0
ifaddr==0.1.7
jinja2==3.1.2
lru-dict==1.1.8
PyJWT==2.6.0
PyJWT==2.7.0
cryptography==40.0.2
pyOpenSSL==23.1.0
orjson==3.8.12
Expand Down

0 comments on commit 32b70ea

Please sign in to comment.