Governed substrate for autonomous agents: scoped identity (passports), audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
14 lines
444 B
JavaScript
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);
|
|
}
|