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

⬆️ upgrade pyjwt to latest; introduce leeway to jwt.decode #2335

Merged
4 changes: 2 additions & 2 deletions aries_cloudagent/multitenant/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ async def create_auth_token(
def get_wallet_details_from_token(self, token: str) -> Tuple[str, str]:
"""Get the wallet_id and wallet_key from provided token."""
jwt_secret = self._profile.context.settings.get("multitenant.jwt_secret")
token_body = jwt.decode(token, jwt_secret, algorithms=["HS256"])
token_body = jwt.decode(token, jwt_secret, algorithms=["HS256"], leeway=1)
wallet_id = token_body.get("wallet_id")
wallet_key = token_body.get("wallet_key")
return wallet_id, wallet_key
Expand Down Expand Up @@ -360,7 +360,7 @@ async def get_profile_for_token(
jwt_secret = self._profile.context.settings.get("multitenant.jwt_secret")
extra_settings = {}

token_body = jwt.decode(token, jwt_secret, algorithms=["HS256"])
token_body = jwt.decode(token, jwt_secret, algorithms=["HS256"], leeway=1)

wallet_id = token_body.get("wallet_id")
wallet_key = token_body.get("wallet_key")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ packaging~=23.1
portalocker~=2.7.0
prompt_toolkit~=2.0.9
pydid~=0.3.6
pyjwt~=2.4.0
pyjwt~=2.8.0
pyld~=2.0.3
pynacl~=1.5.0
python-dateutil~=2.8.1
Expand Down