diff --git a/backend/src/utils/crypto.ts b/backend/src/utils/crypto.ts new file mode 100644 index 0000000..43acf5e --- /dev/null +++ b/backend/src/utils/crypto.ts @@ -0,0 +1,14 @@ +import { createHash, randomBytes, randomUUID } from 'node:crypto'; + +export function randomId(bytes = 6) { + return randomBytes(bytes).toString('base64url'); +} + +export function newUuid() { + return randomUUID(); +} + +export function sha256(value: string) { + return createHash('sha256').update(value).digest('hex'); +} +