From 9accb254e386f29a441100fb193d9b6867447910 Mon Sep 17 00:00:00 2001 From: akdeb Date: Fri, 18 Apr 2025 15:56:51 +0100 Subject: [PATCH] works now --- frontend-nextjs/app/api/session/route.ts | 28 ------------------- .../Realtime/components/BottomToolbar.tsx | 4 +-- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/frontend-nextjs/app/api/session/route.ts b/frontend-nextjs/app/api/session/route.ts index 9335c4e..f38c8e8 100644 --- a/frontend-nextjs/app/api/session/route.ts +++ b/frontend-nextjs/app/api/session/route.ts @@ -1,7 +1,6 @@ import { createClient } from "@/utils/supabase/server"; import { SupabaseClient } from "@supabase/supabase-js"; import { NextRequest, NextResponse } from "next/server"; -import crypto from "crypto"; import { getUserById } from "@/db/users"; interface IPayload { @@ -132,33 +131,6 @@ const createSystemPrompt = async ( return systemPrompt + commonPrompt; }; -/** - * Decrypts an encrypted secret with the same master encryption key. - * @param encryptedData - base64 string from the database - * @param iv - base64 IV from the database - * @param masterKey - 32-byte string or buffer - * @returns the original plaintext secret - */ -function decryptSecret(encryptedData: string, iv: string, masterKey: string) { - // Decode the base64 master key - const decodedKey = Buffer.from(masterKey, "base64"); - if (decodedKey.length !== 32) { - throw new Error( - "ENCRYPTION_KEY must be 32 bytes when decoded from base64.", - ); - } - - const decipher = crypto.createDecipheriv( - "aes-256-cbc" as any, - Buffer.from(masterKey, "base64") as any, - Buffer.from(iv, "base64") as any, - ); - - let decrypted = decipher.update(encryptedData, "base64", "utf8"); - decrypted += decipher.final("utf8"); - return decrypted; -} - export async function GET(request: NextRequest) { const supabase = createClient(); diff --git a/frontend-nextjs/app/components/Realtime/components/BottomToolbar.tsx b/frontend-nextjs/app/components/Realtime/components/BottomToolbar.tsx index c69232f..9402359 100644 --- a/frontend-nextjs/app/components/Realtime/components/BottomToolbar.tsx +++ b/frontend-nextjs/app/components/Realtime/components/BottomToolbar.tsx @@ -61,9 +61,7 @@ function BottomToolbar({