Reimplemented outdated code, added encryption keys for each room, added support for profile images, added friend requests via url/qr-code

This commit is contained in:
pascalyazid committed 2026-05-11 21:35:28 +02:00
1 parent 508f17315e
commit 32e4bf8b32
58 files changed
+3270 -362

No files matched your search

+11 -9
View File
@@ -4,12 +4,15 @@ import { generateKeyPair } from "@/utils/security/encrypt_private_key";
import { createClient } from "@/utils/supabase/server";
export async function validateIdentity(plain_pw: string) {
const supabase = createClient();
const user_id = (await (await supabase).auth.getUser()).data.user?.id;
const supabase = await createClient();
const {
data: { user },
} = await supabase.auth.getUser();
const user_id = user?.id;
if (user_id == null) {
return null;
}
const { data, error } = await (await supabase)
const { data, error } = await supabase
.from("users")
.select("has_identity")
.eq("id", user_id)
@@ -20,14 +23,13 @@ export async function validateIdentity(plain_pw: string) {
}
if (!data.has_identity) {
generateKeyPair(plain_pw, user_id);
const { error } = await (await supabase)
await generateKeyPair(plain_pw, user_id);
const { error: updateError } = await supabase
.from("users")
.update({ has_identity: true })
.eq("id", user_id)
.single();
if (error) {
throw error;
.eq("id", user_id);
if (updateError) {
throw updateError;
}
}
}