shellphone.app/app/utils/token.server.ts
2022-05-14 12:22:06 +02:00

11 lines
230 B
TypeScript

import { nanoid } from "nanoid";
import crypto from "crypto";
export function generateToken() {
return nanoid(32);
}
export function hashToken(token: string) {
return crypto.createHash("sha256").update(token).digest("hex");
}