Browser extensions
Unlike a static site, a browser extension can safely store a client credential, so it can send payments and read payment history, not only receive. Today the only way to do so is through a hosted sidecar. However, the following two paths are planned for better browser support:
- Nostr Wallet Connect (NIP-47): connect with a standard NWC string from clients such as the Alby extension, Primal, or any site using Bitcoin Connect.
- WASM SDK: the Rust SDK compiled to WebAssembly.
Hosted sidecar
The sidecar accepts credentials per request, so the extension can keep the user's credential and send it along with each request, without configuring any credentials on the sidecar itself:
- Run the sidecar with no default credentials. It then serves only requests
that carry an
Authorization: Bearer <client credentials>header. - Put a reverse proxy such as nginx or Caddy in front of it with TLS, since the sidecar listens on localhost over plain HTTP.
- In the extension, store the user's client credential and send it in the
Authorizationheader of every request.
Alternatively, the user can run the sidecar on their own machine and point
the extension at http://localhost:5393, with no server of yours involved.
Note that the sidecar sees every credential it relays, so whoever hosts it
can control those wallets while it runs. The sidecar does not save per-request
credentials to disk unless webhooks are enabled,
in which case it stores them in its data directory so that payment tracking
can resume after a restart, and deletes them once the tracked payments have
finalized.
On a hosted sidecar, leave LEXE_WEBHOOK_URL unset and poll for payment
status instead.