Enhance encryption security with additional safeguards.

This commit is contained in:
glay 2024-12-10 11:35:26 +08:00
parent 12d38aa4b2
commit 19437c7aa1

View File

@ -10,7 +10,7 @@ type ParsedEvent = Record<string, any>;
type EventResult = ParsedEvent[]; type EventResult = ParsedEvent[];
// Using a dot as separator since it's not used in Base64 // Using a dot as separator since it's not used in Base64
const SEPARATOR = "."; const SEPARATOR = "~";
// Unified crypto utilities for both frontend and backend // Unified crypto utilities for both frontend and backend
async function generateKey( async function generateKey(
@ -121,7 +121,6 @@ export async function decrypt(
const dec = new TextDecoder(); const dec = new TextDecoder();
return dec.decode(decrypted); return dec.decode(decrypted);
} catch (error) { } catch (error) {
console.error("[Decryption Error]:", error);
throw new Error("Failed to decrypt AWS credentials"); throw new Error("Failed to decrypt AWS credentials");
} }
} }