diff --git a/packages/api/src/utils/auth.ts b/packages/api/src/utils/auth.ts index 12b34cce3..38ce9e345 100644 --- a/packages/api/src/utils/auth.ts +++ b/packages/api/src/utils/auth.ts @@ -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) +}