shellphone.app/app/utils/token.server.ts

11 lines
230 B
TypeScript
Raw Normal View History

2022-05-14 10:22:06 +00:00
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");
}