fix: insecure randomness

This commit is contained in:
Levente Orban authored and GitHub committed 2025-10-28 07:48:17 +01:00
commit 7275084ab9
1 file changed
+4 -1
+4 -1
View File
@@ -1,5 +1,8 @@
import { randomBytes } from 'crypto';
export const generateUserId = () => {
const userId = 'user_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
const secureRandomString = randomBytes(8).toString('base36').substr(0, 9);
const userId = 'user_' + Date.now() + '_' + secureRandomString;
return userId;
};