Use window.nostr.connect, getSigner and disconnect where the extension offers them

Din's and Tenna's NIP-07 providers add three optional methods, after NIP-46's
names. Logging in through an extension now asks connect() for an account
(skipping the Welcome back preview, since the extension shows the account),
each extension login signs through getSigner(pubkey) so switching accounts
in the extension doesn't change who the app signs as, and logging out calls
disconnect(pubkey). Each is feature-detected on its own; extensions without
them work as before. The onchain-bitcoin skill's NBrowserSignerBtc now
builds on the same signer.
This commit is contained in:
Alex Gleason committed 2026-11-28 16:50:29 -06:00
1 parent 67eb5f2a1c
commit 9d43fdbcc3
10 files changed
+262 -33

No files matched your search

+1
View File
@@ -39,6 +39,7 @@ A fresh copy fails lint until it's made into a real app. The rules check for thi
## What's included
- **Login:** `LoginArea` opens a dialog for signing up, a browser extension (NIP-07), a private key or a remote signer (NIP-46), and becomes an account switcher once logged in.
Extension logins use the optional `window.nostr.connect`, `getSigner` and `disconnect` where the extension offers them (Din and Tenna do), so the app keeps signing as each login's own account when the user switches accounts in the extension.
- **Hooks:** `useCurrentUser`, `useAuthor`, `useNostrPublish`, `useUploadFile` (Blossom), `useLoggedInAccounts`, `useTheme`, `useIsMobile` and others in `src/hooks/`.
- **Relays:** a default relay pool, and the user's NIP-65 relay list loaded on login and published when it changes.
- **NIP-19 routing:** `npub`, `nprofile`, `note`, `nevent` and `naddr` identifiers are routed at the URL root to `src/pages/NIP19Page.tsx`.