option to set iat
This commit is contained in:
@@ -196,6 +196,7 @@ export async function sign(payload: JwtPayload, secret: string, options: JwtSign
|
|||||||
if (!algorithm)
|
if (!algorithm)
|
||||||
throw new Error('algorithm not found')
|
throw new Error('algorithm not found')
|
||||||
|
|
||||||
|
if (!payload.iat)
|
||||||
payload.iat = Math.floor(Date.now() / 1000)
|
payload.iat = Math.floor(Date.now() / 1000)
|
||||||
|
|
||||||
const payloadAsJSON = JSON.stringify(payload)
|
const payloadAsJSON = JSON.stringify(payload)
|
||||||
|
|||||||
Reference in New Issue
Block a user