diff options
| author | Adam Soltys <[email protected]> | 2026-02-05 09:34:30 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 15:34:32 -0800 |
| commit | ec304f8bd1ffef69a85b75da033fbccbe6bfc72f (patch) | |
| tree | 664e765f3d7e9c4f26463760ed155dabca76486b /src/components/Account.svelte | |
| parent | 59fbd17aad12acfa19eb730c4ede67d50962ba9b (diff) | |
| download | coinos-ui-ec304f8bd1ffef69a85b75da033fbccbe6bfc72f.tar.gz coinos-ui-ec304f8bd1ffef69a85b75da033fbccbe6bfc72f.zip | |
fix ark payment notifications
Diffstat (limited to 'src/components/Account.svelte')
| -rw-r--r-- | src/components/Account.svelte | 28 |
1 files changed, 25 insertions, 3 deletions
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); |
