From ec304f8bd1ffef69a85b75da033fbccbe6bfc72f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 5 Feb 2026 09:34:30 -0800 Subject: fix ark payment notifications --- src/components/Account.svelte | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/components/Account.svelte') diff --git a/src/components/Account.svelte b/src/components/Account.svelte index 04ff97ae..aaef428b 100644 --- a/src/components/Account.svelte +++ b/src/components/Account.svelte @@ -6,6 +6,10 @@ import { goto } from "$app/navigation"; import Balance from "$comp/Balance.svelte"; import { t } from "$lib/translations"; import { arkkey } from "$lib/ark"; + import { + getRememberedWalletPassword, + forgetWalletPassword, + } from "$lib/passwordCache"; let { user, rate, account } = $props(); let { @@ -27,14 +31,32 @@ pendingUrl = undefined; }); - let setAccount = (event, url) => { + let tryUnlockArk = async () => { + const cached = getRememberedWalletPassword(); + if (!cached) return false; + try { + const { decrypt } = await import("nostr-tools/nip49"); + $arkkey = hex.encode(decrypt(seed, cached)); + return true; + } catch (e) { + forgetWalletPassword(); + return false; + } + }; + + let setAccount = async (event, url) => { event.preventDefault(); event.stopPropagation(); document.cookie = `aid=${id}; path=/; max-age=86400`; if (isArk) { pendingUrl = url; - if ($arkkey) goto(pendingUrl); - else passwordPrompt = true; + if ($arkkey) { + goto(pendingUrl); + } else if (await tryUnlockArk()) { + goto(pendingUrl); + } else { + passwordPrompt = true; + } } else { $arkkey = undefined; goto(url); -- cgit v1.2.3