This repository has been archived on 2023-05-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
auth/lib/utils/tokens.ts
2023-05-02 01:14:23 -04:00

13 lines
309 B
TypeScript

import crypto from 'crypto';
import { sign } from "./jwt";
export const generateResetToken = (sub: string) => {
const key = crypto.randomBytes(16).toString('hex');
const token = sign({
sub,
key,
exp: (Date.now() + (24 * 60 * 60 * 1000)),
});
return { key, token };
};