aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Account.svelte
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-05 09:34:30 -0800
committerAdam Soltys <[email protected]>2026-02-11 15:34:32 -0800
commitec304f8bd1ffef69a85b75da033fbccbe6bfc72f (patch)
tree664e765f3d7e9c4f26463760ed155dabca76486b /src/components/Account.svelte
parent59fbd17aad12acfa19eb730c4ede67d50962ba9b (diff)
downloadcoinos-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.svelte28
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);