Files
SponsorBlockServer/test/utils/getRandom.ts
Michael C 7364499f11 lockCategoriesHTTP
- highLoad
- compact getUserID
- add genRandomValue method
2023-09-27 23:19:25 -04:00

5 lines
243 B
TypeScript

import crypto from "crypto";
export const genRandom = (bytes=8) => crypto.pseudoRandomBytes(bytes).toString("hex");
export const genRandomValue = (prefix: string, identifier: string, bytes=8) => `${prefix}-${identifier}-${genRandom(bytes)}`;