From 82dd999fa70c94e36118955936a567e3daa6eb2c Mon Sep 17 00:00:00 2001 From: KodekaTeam Date: Fri, 17 Jul 2026 01:46:38 +0700 Subject: [PATCH] feat(crypto): remove throw error for default encryptkey --- src/server/lib/crypto.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/lib/crypto.ts b/src/server/lib/crypto.ts index 23c4d75..8aafcc0 100644 --- a/src/server/lib/crypto.ts +++ b/src/server/lib/crypto.ts @@ -1,8 +1,7 @@ import crypto from "crypto"; const ALGORITHM = "aes-256-gcm"; -export const DEVELOPMENT_ENCRYPTION_KEY = - "dev-32-char-encryption-key-here!"; +export const DEVELOPMENT_ENCRYPTION_KEY = "dev-32-char-encryption-key-here!"; const REJECTED_PRODUCTION_KEYS = new Set([ DEVELOPMENT_ENCRYPTION_KEY, "change-me", @@ -35,9 +34,9 @@ export function getEncryptionKeyOrThrow(env = process.env): string { new Set(configuredKey).size < 8 || /^(.)\1+$/.test(configuredKey)) ) { - throw new Error( - "ENCRYPTION_KEY must use a strong random value and must not use a development or placeholder value in production", - ); + // throw new Error( + // "ENCRYPTION_KEY must use a strong random value and must not use a development or placeholder value in production", + // ); } return configuredKey; @@ -79,7 +78,8 @@ export function encrypt(plaintext: string): string { */ export function decrypt(encoded: string): string { const [ivB64, tagB64, dataB64] = encoded.split(":"); - if (!ivB64 || !tagB64 || !dataB64) throw new Error("Invalid encrypted format"); + if (!ivB64 || !tagB64 || !dataB64) + throw new Error("Invalid encrypted format"); const iv = Buffer.from(ivB64, "base64"); const authTag = Buffer.from(tagB64, "base64");