1
0

Compare commits

..

2 Commits

Author SHA1 Message Date
0c8f476751 Update to v1.1.7 2022-04-11 02:20:54 +02:00
3c5d178fec Fix timestamp check 2022-04-11 02:20:14 +02:00
2 changed files with 3 additions and 3 deletions

View File

@@ -95,9 +95,9 @@ class JWT {
if (!importAlgorithm) if (!importAlgorithm)
throw new Error('algorithm not found') throw new Error('algorithm not found')
const payload = this.decode(token) const payload = this.decode(token)
if (payload.nbf && payload.nbf >= Math.floor(Date.now() / 1000)) if (payload.nbf && payload.nbf > Math.floor(Date.now() / 1000))
return false return false
if (payload.exp && payload.exp < Math.floor(Date.now() / 1000)) if (payload.exp && payload.exp <= Math.floor(Date.now() / 1000))
return false return false
let keyFormat = 'raw' let keyFormat = 'raw'
let keyData let keyData

View File

@@ -1,6 +1,6 @@
{ {
"name": "@tsndr/cloudflare-worker-jwt", "name": "@tsndr/cloudflare-worker-jwt",
"version": "1.1.6", "version": "1.1.7",
"description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker", "description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker",
"main": "index.js", "main": "index.js",
"repository": { "repository": {