add verification token generation

This commit is contained in:
Hongbo Wu
2022-07-19 21:59:06 +08:00
committed by Jackson Harper
parent 1346140a20
commit bd5b289168

View File

@ -79,3 +79,12 @@ export const getClaimsByToken = async (
return claims
}
export const generateVerificationToken = (userId: string) => {
const iat = Math.floor(Date.now() / 1000)
const exp = Math.floor(
new Date(Date.now() + 1000 * 60 * 60 * 24).getTime() / 1000
)
return jwt.sign({ uid: userId, iat, exp }, env.server.jwtSecret)
}