Skip to content

Commit 1687d04

Browse files
committed
fix: Add leeway to JWT token verification
Using this leeway, the `now` parameter is not needed anymore, as the sub-1 second is calculated into the leeway. From the documentation, the leeway is: "Implementers MAY provide for some small leeway, usually no more than a few minutes, to account for clock skew"
1 parent 6c0f7a6 commit 1687d04

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

onekey_client/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import functools
22
import gc
33
import secrets
4-
import time
54
from importlib import resources
65
from importlib.metadata import version
76
from pathlib import Path
@@ -266,7 +265,7 @@ def _verify_token(
266265
claims_options=claims_options,
267266
claims_params={"nonce": nonce},
268267
)
269-
decoded_token.validate(now=time.time())
268+
decoded_token.validate(leeway=300)
270269
return decoded_token
271270

272271

0 commit comments

Comments
 (0)