Skip to content

Commit 0b845ff

Browse files
authored
Merge branch 'main' into feat/nwc-alby
2 parents bc28b51 + a89a95e commit 0b845ff

7 files changed

Lines changed: 112 additions & 13 deletions

File tree

.changeset/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/khaki-papayas-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"nostream": patch
3+
---
4+
5+
Fix: Restore CONFIGURATION.md with proper settings and remove duplicate changesets created during recovery
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"nostream": patch
3+
---
4+
5+
Add NIP-62 integration tests for Request to Vanish

.changeset/slimy-bars-burn.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CONFIGURATION.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,40 @@ The settings below are listed in alphabetical order by name. Please keep this ta
146146
| limits.event.retention.maxDays | Maximum number of days to retain events. Purge deletes events that are expired (`expires_at`), soft-deleted (`deleted_at`), or older than this window (`created_at`). Any non-positive value disables retention purge. |
147147
| limits.event.retention.pubkey.whitelist | Public keys excluded from retention purge. |
148148
| limits.event.whitelists.ipAddresses | List of IPs (IPv4 or IPv6) to ignore rate limits. |
149+
| limits.event.whitelists.pubkeys | List of public keys to ignore rate limits. |
150+
| limits.message.ipWhitelist | List of IPs (IPv4 or IPv6) to ignore rate limits. |
151+
| limits.message.rateLimits[].period | Rate limit period in milliseconds. |
149152
| limits.client.subscription.maxSubscriptions | Maximum number of subscriptions per connected client. Defaults to 10. Disabled when set to zero. |
150153
| limits.client.subscription.maxFilters | Maximum number of filters per subscription. Defaults to 10. Disabled when set to zero. |
151154
| limits.message.rateLimits[].period | Rate limiting period in milliseconds. For `sliding_window`: the time window. For `ewma`: the half-life of the decay function. |
152155
| limits.message.rateLimits[].rate | Maximum number of messages during period. |
156+
| mirroring.static[].address | Address of mirrored relay. (e.g. ws://100.100.100.100:8008) |
157+
| mirroring.static[].filters | Subscription filters used to mirror. |
158+
| mirroring.static[].limits.event | Event limit overrides for this mirror. See configurations under limits.event. |
159+
| mirroring.static[].secret | Secret to pass to relays. Nostream relays only. Optional. |
160+
| mirroring.static[].skipAdmissionCheck | Disable the admission fee check for events coming from this mirror. |
161+
| network.maxPayloadSize | Maximum number of bytes accepted per WebSocket frame |
162+
| network.remoteIpHeader | HTTP header from proxy containing IP address from client. |
163+
| nip05.domainBlacklist | List of domains blocked from NIP-05 verification. Authors with NIP-05 at these domains will be rejected. |
164+
| nip05.domainWhitelist | List of domains allowed for NIP-05 verification. If set, only authors verified at these domains can publish. |
165+
| nip05.maxConsecutiveFailures | Number of consecutive verification failures before giving up on an author. Defaults to 20. |
166+
| nip05.mode | NIP-05 verification mode: `enabled` requires verification, `passive` verifies without blocking, `disabled` does nothing. Defaults to `disabled`. |
167+
| nip05.verifyExpiration | Time in milliseconds before a successful NIP-05 verification expires and needs re-checking. Defaults to 604800000 (1 week). |
168+
| nip05.verifyUpdateFrequency | Minimum interval in milliseconds between re-verification attempts for a given author. Defaults to 86400000 (24 hours). |
169+
| paymentProcessors.lnbits.baseURL | Base URL of your Lnbits instance. |
170+
| paymentProcessors.lnbits.callbackBaseURL | Public-facing Nostream's Lnbits Callback URL. (e.g. https://relay.your-domain.com/callbacks/lnbits) |
171+
| paymentProcessors.lnurl.invoiceURL | [LUD-06 Pay Request](https://github.com/lnurl/luds/blob/luds/06.md) provider URL. (e.g. https://getalby.com/lnurlp/your-username) |
172+
| paymentProcessors.zebedee.baseURL | Zebedee's API base URL. |
173+
| paymentProcessors.zebedee.callbackBaseURL | Public-facing Nostream's Zebedee Callback URL (e.g. https://relay.your-domain.com/callbacks/zebedee) |
174+
| paymentProcessors.zebedee.ipWhitelist | List with Zebedee's API Production IPs. See [ZBD API Documentation](https://api-reference.zebedee.io/#c7e18276-6935-4cca-89ae-ad949efe9a6a) for more info. |
175+
| payments.enabled | Enabled payments. Defaults to false. |
176+
| payments.feeSchedules.admission[].amount | Admission fee amount in msats. |
177+
| payments.feeSchedules.admission[].enabled | Enables admission fee. Defaults to false. |
178+
| payments.feeSchedules.admission[].whitelists.event_kinds | List of event kinds to waive admission fee. Use `[min, max]` for ranges. |
179+
| payments.feeSchedules.admission[].whitelists.pubkeys | List of pubkeys to waive admission fee. |
180+
| payments.processor | Either `zebedee`, `lnbits`, `lnurl`. |
181+
| workers.count | Number of workers to spin up to handle incoming connections. |
182+
| | Spin workers as many CPUs are available when set to zero. Defaults to zero. |
153183
| limits.message.ipWhitelist | List of IPs (IPv4 or IPv6) to ignore rate limits. |
154184
| limits.admissionCheck.rateLimits[].period | Rate limiting period in milliseconds. For `sliding_window`: the time window. For `ewma`: the half-life of the decay function. |
155185
| limits.admissionCheck.rateLimits[].rate | Maximum number of admission checks during period. |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Feature: NIP-62
2+
Scenario: Alice requests to vanish
3+
Given someone called Alice
4+
And someone called Bob
5+
And Alice sends a set_metadata event
6+
And Alice sends a text_note event with content "please forget this"
7+
When Alice sends a request_to_vanish event
8+
And Bob subscribes to author Alice
9+
Then Bob receives 1 request_to_vanish event from Alice and EOSE
10+
11+
Scenario: Alice cannot publish after requesting to vanish
12+
Given someone called Alice
13+
When Alice sends a request_to_vanish event
14+
And Alice drafts a text_note event with content "I should be blocked"
15+
Then Alice sends their last draft event unsuccessfully because "blocked: request to vanish active for pubkey"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { Then, When } from '@cucumber/cucumber'
2+
import { expect } from 'chai'
3+
import WebSocket from 'ws'
4+
5+
import { createEvent, sendEvent, waitForEventCount } from '../helpers'
6+
import { ALL_RELAYS, EventKinds, EventTags } from '../../../../src/constants/base'
7+
import { Event } from '../../../../src/@types/event'
8+
import { isDraft } from '../shared'
9+
10+
When(/^(\w+) sends a request_to_vanish event$/, async function (name: string) {
11+
const ws = this.parameters.clients[name] as WebSocket
12+
const { pubkey, privkey } = this.parameters.identities[name]
13+
14+
const event: Event = await createEvent(
15+
{ pubkey, kind: EventKinds.REQUEST_TO_VANISH, content: '', tags: [[EventTags.Relay, ALL_RELAYS]] },
16+
privkey,
17+
)
18+
19+
await sendEvent(ws, event)
20+
this.parameters.events[name].push(event)
21+
})
22+
23+
Then(
24+
/(\w+) receives (\d+) request_to_vanish events? from (\w+) and EOSE$/,
25+
async function (name: string, count: string, author: string) {
26+
const ws = this.parameters.clients[name] as WebSocket
27+
const subscription = this.parameters.subscriptions[name][this.parameters.subscriptions[name].length - 1]
28+
const expectedCount = Number(count)
29+
const expectedPubkey = this.parameters.identities[author].pubkey
30+
const events = await waitForEventCount(ws, subscription.name, expectedCount, true)
31+
32+
expect(events.length).to.equal(expectedCount)
33+
for (const event of events) {
34+
expect(event.kind).to.equal(EventKinds.REQUEST_TO_VANISH)
35+
expect(event.pubkey).to.equal(expectedPubkey)
36+
}
37+
},
38+
)
39+
40+
Then(
41+
/^(\w+) sends their last draft event unsuccessfully because "([^"]+)"$/,
42+
async function (name: string, reason: string) {
43+
const ws = this.parameters.clients[name] as WebSocket
44+
const event = this.parameters.events[name].findLast((event: Event) => event[isDraft])
45+
46+
if (!event) {
47+
throw new Error(`No draft event found for ${name}`)
48+
}
49+
50+
delete event[isDraft]
51+
52+
const command = await sendEvent(ws, event, false)
53+
expect(command[1]).to.equal(event.id)
54+
expect(command[2]).to.be.false
55+
expect(command[3]).to.equal(reason)
56+
},
57+
)

0 commit comments

Comments
 (0)