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/routes/(app)/account/[id]/+page.svelte | 38 ++++++++++++++++++++++++++---- src/routes/(app)/account/ark/+page.svelte | 28 ++++++++++++++++++++++ src/routes/(app)/account/pass/+page.svelte | 28 ++++++++++++++++++++++ 3 files changed, 89 insertions(+), 5 deletions(-) (limited to 'src/routes/(app)/account') diff --git a/src/routes/(app)/account/[id]/+page.svelte b/src/routes/(app)/account/[id]/+page.svelte index a8970ca7..db93a04d 100644 --- a/src/routes/(app)/account/[id]/+page.svelte +++ b/src/routes/(app)/account/[id]/+page.svelte @@ -8,6 +8,10 @@ import { t } from "$lib/translations"; import { entropyToMnemonic, mnemonicToSeed } from "@scure/bip39"; import { wordlist } from "@scure/bip39/wordlists/english.js"; + import { + getRememberedWalletPassword, + forgetWalletPassword, + } from "$lib/passwordCache"; let { data } = $props(); let { account, user } = data; @@ -26,12 +30,36 @@ let cancel = $state(() => (passwordPrompt = false)); let toggle = () => (passwordPrompt = !passwordPrompt); + let revealWithCachedPassword = async () => { + const cached = getRememberedWalletPassword(); + if (!cached) return false; + try { + const { decrypt } = await import("nostr-tools/nip49"); + let entropy = await decrypt(seed, cached); + mnemonic = entropyToMnemonic(entropy, wordlist); + password = cached; + return true; + } catch (e) { + forgetWalletPassword(); + return false; + } + }; - let submit = $state(async () => { + let requestMnemonic = async () => { + if (await revealWithCachedPassword()) return; toggle(); - const { decrypt } = await import("nostr-tools/nip49"); - let entropy = await decrypt(seed, password); - mnemonic = entropyToMnemonic(entropy, wordlist); + }; + + let submit = $state(async () => { + passwordPrompt = false; + try { + const { decrypt } = await import("nostr-tools/nip49"); + let entropy = await decrypt(seed, password); + mnemonic = entropyToMnemonic(entropy, wordlist); + } catch (e) { + fail("Invalid password, try again"); + passwordPrompt = true; + } }); let del = async () => { @@ -71,7 +99,7 @@
{$t("accounts.copy")}
{:else if seed} - +
+ + +
+