Initial auth library commmit
This commit is contained in:
13
lib/utils/tokens.ts
Normal file
13
lib/utils/tokens.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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 };
|
||||
};
|
||||
Reference in New Issue
Block a user