From 18df062a099811355cafc2024e30a7c2b68c7984 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 26 Feb 2026 16:07:52 -0800 Subject: client side password auth --- src/routes/(app)/settings/+layout.svelte | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/settings/+layout.svelte b/src/routes/(app)/settings/+layout.svelte index 2090bd3a..ce45f915 100644 --- a/src/routes/(app)/settings/+layout.svelte +++ b/src/routes/(app)/settings/+layout.svelte @@ -201,6 +201,19 @@ } } + // If password is changing, derive new authPubkey + const pw = body.get("password") as string; + const un = (body.get("username") as string) || user.username; + if (pw && pw === body.get("confirm")) { + try { + const { deriveAuthKeypair } = await import("$lib/deriveAuthKey"); + const { pubkey: authPubkey } = await deriveAuthKeypair(un, pw); + body.set("authPubkey", authPubkey); + } catch (e) { + console.log("Failed to derive authPubkey for password change", e); + } + } + const response = await fetch(formElement!.action, { method: "POST", body, @@ -210,7 +223,7 @@ if (result.type === "success") { await invalidateAll(); - if (body.get("password")) $password = body.get("password") as string; + if (pw) $password = pw; } applyAction(result); -- cgit v1.2.3