Files
mrp-qrcode/lib/qr.ts
T
2026-04-21 08:56:51 -05:00

15 lines
396 B
TypeScript

import { randomBytes } from "node:crypto";
/**
* Operation QR tokens are opaque, URL-safe, high-entropy identifiers
* printed on traveler cards. 24 bytes = 192 bits of entropy, encoded
* as base64url -> 32 characters.
*/
export function generateQrToken(): string {
return randomBytes(24)
.toString("base64")
.replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=+$/, "");
}