sipher/src/app/api/user/send/update/key/route.ts
Nixyi 8b27c6b140 Stable Release (I think)
Added all SQL scripts by using a python script to fetch them.

Also added a "About" page and a skeleton to the chat page.

Fixed the register function that was not setting the public_key on the database
2024-12-18 16:08:06 -03:00

23 lines
No EOL
580 B
TypeScript

import {createClient} from "@/lib/supabase/server";
import {NextResponse} from "next/server";
export async function POST(request: Request) {
try {
const {publicKey} = await request.json();
const supabase = await createClient();
const {error} = await supabase
.from('users')
.update({public_key: publicKey})
.eq('uuid', (await supabase.auth.getUser()).data.user?.id);
if (error) throw error;
return NextResponse.json({success: true});
} catch (error) {
return NextResponse.json(
{error: 'Failed to update public key'},
{status: 500}
);
}
}