MCPcopy Create free account
hub / github.com/QuantiaAI/helm-agents / encrypt

Method encrypt

apps/api/src/lib/key-cipher.ts:24–33  ·  view source on GitHub ↗
(plaintext: string)

Source from the content-addressed store, hash-verified

22 }
23
24 encrypt(plaintext: string): string {
25 const iv = randomBytes(12);
26 const cipher = createCipheriv("aes-256-gcm", this.key, iv);
27 const ct = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
28 return JSON.stringify({
29 iv: iv.toString("base64"),
30 tag: cipher.getAuthTag().toString("base64"),
31 ct: ct.toString("base64"),
32 });
33 }
34
35 decrypt(blob: string): string {
36 const { iv, tag, ct } = JSON.parse(blob) as { iv: string; tag: string; ct: string };

Callers 2

runHealthChecksFunction · 0.95
setByEnvMethod · 0.80

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected