fix: use standard UUID v4 for keys instead of custom 256-bit hex format
This commit is contained in:
@@ -3,9 +3,7 @@ import { randomBytes, createHash } from "crypto";
|
||||
import sql from "../db";
|
||||
|
||||
function generateKey(): string {
|
||||
const hex = randomBytes(32).toString("hex"); // 64 hex chars
|
||||
// Format as 8 groups of 8: XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX
|
||||
return (hex.match(/.{8}/g) as string[]).join("-").toUpperCase();
|
||||
return crypto.randomUUID(); // standard UUID v4, 128-bit, familiar format
|
||||
}
|
||||
|
||||
function normalizeKey(raw: string): string {
|
||||
|
||||
Reference in New Issue
Block a user