mySQL
This commit is contained in:
14
shared/utils/crypto.js
Normal file
14
shared/utils/crypto.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const CryptoJS = require('crypto-js');
|
||||
|
||||
// Generate a session ID hash
|
||||
const generateUniqueId = () => {
|
||||
const uuid = uuidv4();
|
||||
const hash = CryptoJS.SHA256(uuid).toString();
|
||||
// Use the first 28 characters of the hash
|
||||
return hash.substring(0, 28);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
generateUniqueId,
|
||||
};
|
||||
Reference in New Issue
Block a user