Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump PyJWT to 2.7.0 #93128

Merged
merged 2 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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