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/lib/utils.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib/utils.ts') diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 4bf96d6e..eee6903e 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -164,6 +164,7 @@ export const login = async ( token?: string; challenge?: string; recaptcha?: string; + authPubkey?: string; }, cookies, ip: string, @@ -509,6 +510,17 @@ export const register = async ( }; if (ip) headers["cf-connecting-ip"] = ip; + // Derive authPubkey if password provided + if (user.password && user.username) { + try { + const { deriveAuthKeypair } = await import("$lib/deriveAuthKey"); + const { pubkey: authPubkey } = await deriveAuthKeypair(user.username, user.password); + user.authPubkey = authPubkey; + } catch (e) { + console.log("Failed to derive authPubkey during registration", e); + } + } + let sk, token; try { ({ sk, token } = await post("/register", { user }, headers)); -- cgit v1.2.3