diff --git a/src/utils/functions.ts b/src/utils/functions.ts index f7fb615..9701095 100644 --- a/src/utils/functions.ts +++ b/src/utils/functions.ts @@ -1,5 +1,6 @@ import fs from "fs"; import { ServerSideReview, UserSideReview } from "../types"; +import * as crypto from "crypto"; export function checkFile( file: string, @@ -23,9 +24,7 @@ export function checkFile( } // Generates a unique 6-character ID -export function generateId(): string { - return Math.random().toString(36).replace("0.", "").substring(0, 6); -} +export const generateId = (): string => crypto.randomBytes(3).toString("hex"); export function appendId(userReview: UserSideReview): ServerSideReview { return {