Add NIP-46 remote signer support #275

Merged
raucao merged 45 commits from feature/nostr-remote_signing into master 2026-11-28 17:22:22 +00:00
Owner

This branch brings NIP-46 remote signing to Akkounts alongside the existing NIP-07 browser-extension flow.

Highlights:

  • Server-side NIP-44 v2 encryption plus NIP-46 services and jobs, on an async relay transport.
  • Signer sessions and signing requests, with a settings connect flow (QR code and bunker:// URI).
  • Passwordless login with a remembered-session continue-as flow, including logout revocation.
  • Server-side signing for profile, relay list, media server list and Blossom auth, used when no extension is available.
  • Dedicated Solid Queue workers for connect and RPC traffic.

Settings UX:

  • Connecting a key for the first time offers the browser extension and Nostr Connect side by side, with the same copy as the login modal.
  • When the account already has a key, the Nostr Connect section collapses into a foldout, marked with a dot while a signer is connected.
  • The bunker:// URI option now lives in the connect modal instead of the settings page.

Follow-up fixes included:

  • Never silently overwrite or orphan an account's Nostr key; key changes now go through a single authorization seam, and removing a key disconnects the signer.
  • Keep Nostr Connect listeners alive only while the browser is polling.
  • Add the Nostr login chooser modal, and fix the browser-extension login regression it introduced.

Already running in production on live.

This branch brings NIP-46 remote signing to Akkounts alongside the existing NIP-07 browser-extension flow. Highlights: - Server-side NIP-44 v2 encryption plus NIP-46 services and jobs, on an async relay transport. - Signer sessions and signing requests, with a settings connect flow (QR code and `bunker://` URI). - Passwordless login with a remembered-session continue-as flow, including logout revocation. - Server-side signing for profile, relay list, media server list and Blossom auth, used when no extension is available. - Dedicated Solid Queue workers for connect and RPC traffic. Settings UX: - Connecting a key for the first time offers the browser extension and Nostr Connect side by side, with the same copy as the login modal. - When the account already has a key, the Nostr Connect section collapses into a foldout, marked with a dot while a signer is connected. - The `bunker://` URI option now lives in the connect modal instead of the settings page. Follow-up fixes included: - Never silently overwrite or orphan an account's Nostr key; key changes now go through a single authorization seam, and removing a key disconnects the signer. - Keep Nostr Connect listeners alive only while the browser is polling. - Add the Nostr login chooser modal, and fix the browser-extension login regression it introduced. Already running in production on `live`.
raucao added 37 commits 2026-11-27 16:10:54 +00:00
Stop abandoned listeners after 60s without polling, re-enqueue from status polls with a throttle, and add a Start over action for stuck sessions.
Connecting a remote signer while a different account key already exists now asks for explicit confirmation instead of overwriting it, and every key change goes through a single LdapManager::SetNostrKey seam so step-up auth can be added in one place later. Removing the account key also disconnects the remote signer, since a signer session is bound to that key; disconnecting a signer still leaves the key intact.
NostrConnectListenerJob holds a worker thread for up to CONNECT_TTL (5 min)
waiting on relay websockets, and it shared one 4-thread worker group with
NostrSignEventJob/NostrLogoutJob (nostr_rpc). A handful of concurrent signer
logins could therefore starve signing behind the listeners.

Split the two queues into separate worker groups and make their thread counts
env-tunable (NOSTR_CONNECT_THREADS, default 24; NOSTR_RPC_THREADS, default 4).
The listeners are IO-blocked (async fibers, GVL-free waits), so threads rather
than processes are the cheap way to add capacity.

Production must size DB_POOL to at least NOSTR_CONNECT_THREADS, since each
worker thread holds a database connection for the duration of its job.
Too unreliable
The nostr-login controller still referenced a loginButton target that was dropped when the login options moved into a modal, so connect() and login() raised "Missing target element" and the extension login did nothing. Target the extension option button instead, and cover the wiring with a component spec.
Give each option's description a clearer gap from its title, and describe the Nostr Connect option as using a mobile or desktop signer app like Amber or Regent.
When no NIP-07 extension is detected, keep the option visible, greyed out and disabled, and let its description explain why. Drop the private-key line from the modal and say that Nostr login needs a key already linked to the account.
raucao added the
integration
nostr
featurekredits-3securityui/ux
labels 2026-11-27 16:16:39 +00:00
raucao marked the pull request as work in progress 2026-11-27 16:16:47 +00:00
raucao added 3 commits 2026-11-28 08:29:37 +00:00
On the Nostr settings page, fold the Nostr Connect section into a closed details/summary, marked with a green dot while a signer is connected. Without a linked key the section stays expanded so connecting stays prominent.
Replace the hidden 'No browser extension found' alert with a 50:50 two-column chooser on the Nostr settings page: the browser extension option (same copy as the login modal, enabled and swapped in when a NIP-07 extension is detected) next to Nostr Connect.
Move the bunker option into the connect modal
CI / Test (pull_request) Successful in 1m21s
af70167ced
Show the bunker URI field in the remote signer connect modal instead of the settings page, and drop its waiting-for-signer placeholder text to keep the modal compact.
raucao added 1 commit 2026-11-28 08:55:53 +00:00
Center the Remove label in the pubkey settings button
CI / Test (pull_request) Successful in 1m17s
6a14da2400
The button stretches to the input's height in the flex row, which left its label sitting high; center it vertically.
raucao added 2 commits 2026-11-28 10:54:19 +00:00
Disconnecting, cancelling and (when a key already exists) connecting now swap the Nostr Connect section via Turbo Streams, so the page's relay/profile/media lookups are not re-fetched. A replace still reloads because it changes the key, and a first-time connect reloads to reveal the pubkey and metadata.
Replace the empty placeholder in the Nostr settings loading state with the relay constellation illustration, cropped to trim its own top/bottom whitespace.
raucao added 1 commit 2026-11-28 11:14:58 +00:00
When no relay list exists, all recommended relays are now marked as added, not just the site relay, with a short note explaining the default list. The profile editor likewise marks the display name as added when it is filled in from the account display name.
raucao added 1 commit 2026-11-28 11:25:14 +00:00
Explain the recommended media server list when setting one up
CI / Test (pull_request) Successful in 1m19s
Release Drafter / Update release notes draft (pull_request) Successful in 2s
a350c52026
Show a short hint above the media server list on first-time setup, mirroring the relay list hint.
raucao marked the pull request as ready for review 2026-11-28 16:47:36 +00:00
raucao merged commit 6575727028 into master 2026-11-28 17:22:22 +00:00
raucao deleted branch feature/nostr-remote_signing 2026-11-28 17:22:22 +00:00
Sign in to join this conversation.