diff options
| author | Adam Soltys <[email protected]> | 2026-10-10 08:35:36 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-10 08:35:36 -0700 |
| commit | 2338345063b0f1c816469401264b0cd0d7b7636b (patch) | |
| tree | a5a35e4bd7a78e5803e68cd49c44692389691961 /src | |
| parent | 42c0ef9c6391285d76825bdf0d29371cd6ebf500 (diff) | |
| download | coinosv3-2338345063b0f1c816469401264b0cd0d7b7636b.tar.gz coinosv3-2338345063b0f1c816469401264b0cd0d7b7636b.zip | |
Messages: the Amber notice no longer waits for Amber to wake. "Messages sent to you can't be opened here · Connect Amber" showed only once the Amber signer had resumed, and the DM drain is what resumes it — on a phone whose every wrap the old code had already logged as opened, nothing is pending, so nothing might ever ask. nostrLoginIdentity now says how the account came in (`via`), and an Amber account counts as one whether or not its signer is live yet (the notice, and the flag that re-opens written-off wraps once a decrypting signer takes over). tools/amber-dm-upgrade-test.js runs that case with ALL_LOGGED=1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vps2H27rhbG9ZqseGfMrc3
Diffstat (limited to 'src')
| -rw-r--r-- | src/features/messages.js | 8 | ||||
| -rw-r--r-- | src/features/nostrlogin.js | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 28e20f1..be5f785 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -2950,7 +2950,13 @@ export function messagesFeature(ctx) { const login = hook('nostrLoginIdentity'); return !login || !!(login.signer && !login.signer.interactive && login.signer.decryptFrom); } - const interactiveLogin = () => { const l = hook('nostrLoginIdentity'); return !!(l && l.signer && l.signer.interactive); }; + // an Amber-by-intent account, whether or not its signer has woken yet: + // a wallet whose every wrap was already logged never wakes it, and then + // never said why its messages were missing + const interactiveLogin = () => { + const l = hook('nostrLoginIdentity'); + return !!l && (l.signer ? !!l.signer.interactive : l.via === 'amber'); + }; // Wraps logged while an interactive signer stood in for the login npub // may be messages no key here ever tried. Once a signer that can decrypt // takes over (Amber reconnected over NIP-46), the heal pass re-opens diff --git a/src/features/nostrlogin.js b/src/features/nostrlogin.js index 2023931..4f1f0de 100644 --- a/src/features/nostrlogin.js +++ b/src/features/nostrlogin.js @@ -763,10 +763,12 @@ export function nostrLoginFeature(ctx) { // A just-connected signer counts immediately — the persisted link lands // only after the wallet opens, and the header avatar shouldn't show the // wallet key's face in the gap. - if (liveSigner()) return { pubkey: live.pubkey, npub: npubOf(live.pubkey), signer: live }; + // `via`: how the account came in, known before its signer wakes (an + // Amber account is one whether or not Amber has been asked anything yet) const st = load(); + if (liveSigner()) return { pubkey: live.pubkey, npub: npubOf(live.pubkey), signer: live, via: st.pubkey === live.pubkey ? reconnectViaOf(st) : viaOf(live) }; if (!st.pubkey) return null; - return { pubkey: st.pubkey, npub: npubOf(st.pubkey), signer: live }; + return { pubkey: st.pubkey, npub: npubOf(st.pubkey), signer: live, via: reconnectViaOf(st) }; }, // A page reload loses the signer. A stored passkey key or an installed // extension reattaches without prompting, which is what lets the payment |
