Fix timestamp check
This commit is contained in:
4
index.js
4
index.js
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user