From b22c813f9fb3b4d69dade75d22e90e6779919f07 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 16 Feb 2026 20:56:39 -0800 Subject: nostr key derivation --- src/components/Account.svelte | 48 +++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'src/components') diff --git a/src/components/Account.svelte b/src/components/Account.svelte index 953e44ab..70bded13 100644 --- a/src/components/Account.svelte +++ b/src/components/Account.svelte @@ -50,6 +50,31 @@ } } + // Try silent Nostr derivation + if (!prfKey) { + const { getWalletEntropy } = await import("$lib/walletEntropy"); + const nostrKey = await getWalletEntropy(); + if (nostrKey) { + try { + const [{ HDKey }, { entropyToMnemonic, mnemonicToSeed }, { wordlist }] = await Promise.all([ + import("@scure/bip32"), + import("@scure/bip39"), + import("@scure/bip39/wordlists/english.js"), + ]); + const entropy = new Uint8Array(nostrKey); + const mnemonic = entropyToMnemonic(entropy, wordlist); + const s = await mnemonicToSeed(mnemonic); + const master = HDKey.fromMasterSeed(s, versions); + const arkChild = master.derive("m/86'/0'/0'/0/0"); + $arkkey = bytesToHex(arkChild.privateKey!); + $arkaid = id; + return true; + } catch (e) { + console.log("Nostr entropy unlock failed", e); + } + } + } + // Then try cached wallet password const cached = getRememberedWalletPassword(); if (!cached) return false; @@ -131,7 +156,7 @@ ? $t("accounts.ark") : seed || fingerprint ? $t("accounts.bitcoin") - : $t("accounts.custodial"), + : $t("accounts.spending"), ); let displayName = $derived(name || displayType); let isArk = $derived(accountType === "ark"); @@ -165,20 +190,11 @@ {#if pending}
- +{$fiat && rate ? f(toFiat(pending, rate), currency, loc(user)) : s(pending)} pending + +{$fiat && rate ? f(toFiat(pending, rate), currency, loc(user)) : s(pending)} {$t("accounts.pending")}
{/if}
-
- {#if isArk} - Ark - {:else if seed || fingerprint} - - {:else} - Coinos - {/if} -
- + {#if isArk} + Ark + {:else if seed || fingerprint} + + {:else} + Coinos + {/if}
-- cgit v1.2.3