mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-08 04:21:18 -05:00
* refactor: tag snapshots with schedule short_id instead of db id * chore: formatting issues
7 lines
225 B
TypeScript
7 lines
225 B
TypeScript
import crypto from "node:crypto";
|
|
|
|
export const generateShortId = (length = 8): string => {
|
|
const bytesNeeded = Math.ceil((length * 3) / 4);
|
|
return crypto.randomBytes(bytesNeeded).toString("base64url").slice(0, length);
|
|
};
|