feat: optionally include encryption key in web server backups

This commit is contained in:
Mauricio Siu
2026-07-10 03:05:28 -06:00
parent e87a245cdc
commit 2e867c5be1
8 changed files with 8652 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import {
decryptValue,
encryptValue,
exportEncryptionKey,
isEncrypted,
} from "@dokploy/server/lib/encryption";
import { afterEach, describe, expect, it, vi } from "vitest";
@@ -42,6 +43,10 @@ describe("encryptValue / decryptValue", () => {
const tampered = `${encrypted.slice(0, -4)}AAAA`;
expect(() => decryptValue(tampered)).toThrow(/BETTER_AUTH_SECRET/);
});
it("exports the primary key as 32-byte hex for backups", () => {
expect(exportEncryptionKey()).toMatch(/^[0-9a-f]{64}$/);
});
});
describe("dedicated ENCRYPTION_KEY", () => {