Skip to content

Commit 428689a

Browse files
committed
use utc_time_sans_frac
1 parent b9a0c0f commit 428689a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/cryptojwt/jwt.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Basic JSON Web Token implementation."""
22
import json
33
import logging
4-
import time
54
import uuid
65
from datetime import datetime
76
from datetime import timezone
@@ -383,7 +382,7 @@ def unpack(self, token, timestamp=None):
383382
except KeyError:
384383
_msg_cls = None
385384

386-
timestamp = timestamp or time.time()
385+
timestamp = timestamp or utc_time_sans_frac()
387386

388387
if "nbf" in _info:
389388
nbf = int(_info["nbf"])

tests/test_09_jwt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
from cryptojwt.exception import IssuerNotFound
66
from cryptojwt.jws.exception import NoSuitableSigningKeys
77
from cryptojwt.jwt import JWT
8-
from cryptojwt.jwt import VerificationError, utc_time_sans_frac
8+
from cryptojwt.jwt import VerificationError
99
from cryptojwt.jwt import pick_key
10+
from cryptojwt.jwt import utc_time_sans_frac
1011
from cryptojwt.key_bundle import KeyBundle
1112
from cryptojwt.key_jar import KeyJar
1213
from cryptojwt.key_jar import init_key_jar

0 commit comments

Comments
 (0)