mirror of
https://github.com/Tony0410/quietthanks.git
synced 2026-05-25 13:51:39 +08:00
Enhance security: Rotate VAPID keys, encrypt LLM API keys, and use env vars
This commit is contained in:
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
import { db, schema } from "@/lib/db";
|
||||
import { getSession } from "@/lib/auth";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { encrypt } from "@/lib/crypto";
|
||||
|
||||
// GET /api/settings - Get current user settings
|
||||
export async function GET() {
|
||||
@@ -70,7 +71,8 @@ export async function PATCH(request: NextRequest) {
|
||||
}
|
||||
|
||||
if (typeof body.llmApiKey === "string") {
|
||||
updates.llmApiKey = body.llmApiKey || null;
|
||||
// Encrypt the API key before storing
|
||||
updates.llmApiKey = body.llmApiKey ? encrypt(body.llmApiKey) : null;
|
||||
}
|
||||
|
||||
if (typeof body.llmModel === "string") {
|
||||
|
||||
Reference in New Issue
Block a user