godcrm/backend/utils/crypto.js
GOD CRM Release f89e074dd1
Some checks failed
CI / Lint / Typecheck / Test / Build (push) Has been cancelled
CI / PostgreSQL Integration Tests (push) Has been cancelled
GOD CRM — public scrubbed snapshot
Governed substrate for autonomous agents: scoped identity (passports),
audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
2026-08-10 04:01:45 +03:00

14 lines
444 B
JavaScript

import CryptoJS from 'crypto-js';
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY || 'default-key-change-me-in-production';
export function encrypt(text) {
if (!text) return null;
return CryptoJS.AES.encrypt(text, ENCRYPTION_KEY).toString();
}
export function decrypt(encryptedText) {
if (!encryptedText) return null;
const bytes = CryptoJS.AES.decrypt(encryptedText, ENCRYPTION_KEY);
return bytes.toString(CryptoJS.enc.Utf8);
}