lomavuokraus/lib/tokens.ts
Tero Halla-aho 0bb709d9c5
Some checks failed
CI / checks (push) Has been cancelled
chore: fix audit alerts and formatting
2026-02-04 12:43:03 +02:00

11 lines
263 B
TypeScript

import crypto from "crypto";
export function randomToken(bytes = 32): string {
return crypto.randomBytes(bytes).toString("base64url");
}
export function addHours(hours: number): Date {
const d = new Date();
d.setHours(d.getHours() + hours);
return d;
}