Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-lines-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nostream": minor
---

Add Alby NWC (NIP-47) as a payments processor for admission invoices, including configurable invoice expiry and reply timeout handling, compatibility for legacy NWC URI schemes, and docs/env updates.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ WORKER_COUNT=2 # Defaults to CPU count. Use 1 or 2 for local testing.
# NODELESS_WEBHOOK_SECRET=
# OPENNODE_API_KEY=
# LNBITS_API_KEY=
# ALBY_NWC_URL=nostr+walletconnect://<wallet-service-pubkey>?relay=<wss-relay-url>&secret=<secret>

# --- READ REPLICAS (Optional) ---
# READ_REPLICA_ENABLED=false
Expand Down
3 changes: 2 additions & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The following environment variables can be set:
| NOSTR_CONFIG_DIR | Configuration directory | <project_root>/.nostr/ |
| DEBUG | Debugging filter | |
| ZEBEDEE_API_KEY | Zebedee Project API Key | |
| ALBY_NWC_URL | Alby NWC connection URL (`nostr+walletconnect://...`) | |

## I2P

Expand Down Expand Up @@ -219,5 +220,5 @@ The settings below are listed in alphabetical order by name. Please keep this ta
| payments.feeSchedules.admission[].enabled | Enables admission fee. Defaults to false. |
| payments.feeSchedules.admission[].whitelists.event_kinds | List of event kinds to waive admission fee. Use `[min, max]` for ranges. |
| payments.feeSchedules.admission[].whitelists.pubkeys | List of pubkeys to waive admission fee. |
| payments.processor | Either `zebedee`, `lnbits`, `lnurl`. |
| payments.processor | Either `zebedee`, `lnbits`, `lnurl`, `nodeless`, `opennode`, `alby`. |
| workers.count | Number of workers to spin up to handle incoming connections. Spin workers as many CPUs are available when set to zero. Defaults to zero. |
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Install Docker from their [official guide](https://docs.docker.com/engine/instal
- Set `payments.enabled` to `true`
- Set `payments.feeSchedules.admission.enabled` to `true`
- Set `limits.event.pubkey.minBalance` to the minimum balance in msats required to accept events (i.e. `1000000` to require a balance of `1000` sats)
- Choose one of the following payment processors: `zebedee`, `nodeless`, `opennode`, `lnbits`, `lnurl`
- Choose one of the following payment processors: `zebedee`, `nodeless`, `opennode`, `lnbits`, `lnurl`, `alby`

2. [ZEBEDEE](https://zebedee.io)
- Complete the step "Before you begin"
Expand Down Expand Up @@ -172,7 +172,20 @@ Install Docker from their [official guide](https://docs.docker.com/engine/instal
- Set `lnurl.invoiceURL` to your LNURL (e.g. `https://getalby.com/lnurlp/your-username`)
- Restart Nostream (`./scripts/stop` followed by `./scripts/start`)

7. Ensure payments are required for your public key
7. [Alby Wallet API (NIP-47 / NWC)](https://getalby.com/)
- Complete the step "Before you begin"
- Create an app connection in your wallet and copy the generated NWC URL
- Set `ALBY_NWC_URL` environment variable on your `.env` file

```
ALBY_NWC_URL={NOSTR_WALLET_CONNECT_URL}
```

- On your `.nostr/settings.yaml` file make the following changes:
- Set `payments.processor` to `alby`
- Restart Nostream (`./scripts/stop` followed by `./scripts/start`)

8. Ensure payments are required for your public key
- Visit https://{YOUR-DOMAIN}/
- You should be presented with a form requesting an admission fee to be paid
- Fill out the form and take the necessary steps to pay the invoice
Expand Down
173 changes: 170 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"node": ">=24.14.1"
},
"dependencies": {
"@getalby/sdk": "^5.0.0",
"@noble/secp256k1": "1.7.1",
"accepts": "^1.3.8",
"axios": "^1.15.0",
Expand Down
3 changes: 3 additions & 0 deletions resources/default-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ paymentsProcessors:
opennode:
baseURL: api.opennode.com
callbackBaseURL: https://nostream.your-domain.com/callbacks/opennode
alby:
invoiceExpirySeconds: 900
replyTimeoutMs: 10000
nip05:
# NIP-05 verification of event authors as a spam reduction measure.
# mode: 'enabled' requires NIP-05 for publishing (except kind 0),
Expand Down
7 changes: 4 additions & 3 deletions src/@types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ export interface OpenNodePaymentsProcessor {
callbackBaseURL: string
}

export interface NodelessPaymentsProcessor {
baseURL: string
storeId: string
export interface AlbyPaymentsProcessor {
invoiceExpirySeconds: number
replyTimeoutMs: number
}

export interface PaymentsProcessors {
Expand All @@ -210,6 +210,7 @@ export interface PaymentsProcessors {
lnbits?: LNbitsPaymentsProcessor
nodeless?: NodelessPaymentsProcessor
opennode?: OpenNodePaymentsProcessor
alby?: AlbyPaymentsProcessor
}

export interface Local {
Expand Down
Loading
Loading