dsql-admin/dsql-app/.local_dist/server/chunks/5304.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-11-05 11:12:42 +00:00
"use strict";
exports.id = 5304;
exports.ids = [5304];
exports.modules = {
/***/ 5304:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const { scryptSync , createDecipheriv } = __webpack_require__(6113);
const { Buffer } = __webpack_require__(4300);
// const serverError = require("./serverError");
/**
* @param {string} encryptedString
* @returns {string | null}
*/ const decrypt = (encryptedString)=>{
// /** @type {import("crypto").CipherCCMTypes} */
const algorithm = "aes-192-cbc";
const password = process.env.DSQL_ENCRYPTION_PASSWORD || "";
const salt = process.env.DSQL_ENCRYPTION_SALT || "";
// /** @type {import("crypto").CipherKey} */
let key = scryptSync(password, salt, 24);
let iv = Buffer.alloc(16, 0);
// @ts-ignore
const decipher = createDecipheriv(algorithm, key, iv);
/** ********************* Decrypt String */ try {
let decrypted = decipher.update(encryptedString, "hex", "utf8");
decrypted += decipher.final("utf8");
return decrypted;
} catch (error) {
// serverError({
// component: "decrypt",
// message: error.message,
// user: {},
// });
return null;
}
};
module.exports = decrypt;
/***/ })
};
;