UNPKG

ts-logs

Version:

This package provide a skd for audit and manager logs in nodejs and express

21 lines 834 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EncryptStepValue = void 0; const node_crypto_1 = require("node:crypto"); const EncryptStepValue = async (value, secret) => { const algorithm = 'aes-256-gcm'; const iv = Buffer.alloc(16, 0); return new Promise((resolve, reject) => { (0, node_crypto_1.scrypt)(secret, secret, 32, (err, key) => { if (err) reject(err.message); const cipher = (0, node_crypto_1.createCipheriv)(algorithm, key, iv); let encrypted = cipher.update(value, 'utf8', 'hex'); encrypted += cipher.final('hex'); resolve(encrypted); }); }); }; exports.EncryptStepValue = EncryptStepValue; exports.default = exports.EncryptStepValue; //# sourceMappingURL=encrypt.util.js.map