Zwei Fixes für korrekten DB aufbau
This commit is contained in:
@@ -5,16 +5,23 @@ const createHash = (value) => {
|
||||
}
|
||||
|
||||
function encryptData(data) {
|
||||
try {
|
||||
const cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(process.env.ENCRYPTION_KEY, 'hex'), Buffer.alloc(16, 0));
|
||||
try {
|
||||
if (data === null || data === undefined) {
|
||||
data = '';
|
||||
}
|
||||
const cipher = crypto.createCipheriv(
|
||||
'aes-256-cbc',
|
||||
Buffer.from(process.env.ENCRYPTION_KEY, 'hex'),
|
||||
Buffer.alloc(16, 0)
|
||||
);
|
||||
let encrypted = cipher.update(data, 'utf8', 'hex');
|
||||
encrypted += cipher.final('hex');
|
||||
return encrypted;
|
||||
return encrypted;
|
||||
} catch (error) {
|
||||
console.log(error, data, process.env.ENCRYPTION_KEY, typeof data, process.env.ENCRYPTION_KEY.length);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function decryptData(data) {
|
||||
const decipher = crypto.createDecipheriv('aes-256-cbc', Buffer.from(process.env.ENCRYPTION_KEY, 'hex'), Buffer.alloc(16, 0));
|
||||
|
||||
Reference in New Issue
Block a user