10 lines
249 B
TypeScript
10 lines
249 B
TypeScript
// lib/auth/tokens.ts
|
|
import crypto from "crypto";
|
|
|
|
export function generateToken() {
|
|
return crypto.randomBytes(32).toString("hex");
|
|
}
|
|
|
|
export function hashToken(token: string) {
|
|
return crypto.createHash("sha256").update(token).digest("hex");
|
|
}
|