Files
amethyst/quartz-relay/config.example.toml
T
Claude 9ebdfc0b81 feat(relay): drop max_event_bytes + rate-limit configs; verify on by default
Removes config keys + policies that don't earn their complexity:
  - [limits].max_event_bytes / MaxEventBytesPolicy — duplicates
    [limits].max_ws_frame_bytes which is the right layer (Ktor frame
    cap at the wire), and the policy-level check ran AFTER the event
    was already parsed and bound for the store.
  - [limits].messages_per_sec, [limits].subscriptions_per_min /
    RateLimitPolicy — per-session token buckets without the matching
    per-IP / global-EPS infrastructure are mostly cosmetic; an
    operator who needs real rate limits will use a reverse proxy.

Also flips [options].verify_signatures default from `false` to `true`.
A relay accepting traffic from real clients should verify Schnorr
signatures, and verify-by-default closes the footgun of forgetting
the flag. The CLI gains `--no-verify` for explicit opt-out
(test fixtures, mirror replays); the old `--verify` is dropped (a
no-op now anyway).

Removed:
  - quartz-relay/.../policies/MaxEventBytesPolicy.kt
  - quartz-relay/.../policies/RateLimitPolicy.kt
  - 7 obsolete tests in PoliciesTest + 1 in PoliciesIntegrationTest
  - The matching config fields in LimitsSection
  - Sample config entries in config.example.toml
  - Wiring in Main.composePolicy

Added:
  - Test verifySignaturesCanBeExplicitlyDisabled covering the
    new explicit-opt-out path.

Total :quartz-relay tests: 59, 0 failures.
2026-05-07 02:36:18 +00:00

63 lines
2.2 KiB
TOML

# Example config for quartz-relay. Section layout mirrors
# nostr-rs-relay's config.toml so existing operators can port across.
#
# Run with:
# ./gradlew :quartz-relay:run --args="--config /etc/quartz-relay.toml"
#
# CLI flags override individual values: e.g. `--port 8888` wins over
# `[network].port`.
[info]
# The wss:// URL clients use to reach this relay (mandatory for NIP-42
# AUTH challenges). If not set, the relay synthesises one from the
# [network] section.
relay_url = "wss://relay.example.com/"
name = "Example Quartz Relay"
description = "A quartz-relay deployment."
contact = "admin@example.com"
# Operator pubkey (NIP-11). Optional.
# pubkey = "..."
# Override the supported NIPs advertised on the NIP-11 endpoint. If
# omitted, the relay advertises the NIPs it actually implements.
# supported_nips = [1, 9, 11, 40, 42, 45, 50, 62]
[network]
host = "0.0.0.0"
port = 7447
path = "/"
[database]
# True keeps an in-memory SQLite db (events vanish on restart). Useful
# for tests; set false + `file = "..."` for persistent storage.
in_memory = false
file = "/var/lib/quartz-relay/events.db"
[options]
# Drop events whose Schnorr signature does not verify. Strongly
# recommended for any relay accepting traffic from real clients.
# Verify Schnorr signatures on every EVENT. Default: true. Disable
# only for trusted-input scenarios (test fixtures, mirror replays).
# verify_signatures = true
# Require clients to NIP-42 AUTH before REQ/EVENT/COUNT.
require_auth = false
# Reject events whose `created_at` is more than this many seconds in
# the future. Enforced by RejectFutureEventsPolicy.
# reject_future_seconds = 1800
[limits]
# Maximum WebSocket frame size. Frames larger than this are dropped at
# the WS layer. (max_ws_message_bytes maps to the same setting since
# Ktor's WebSockets plugin only exposes per-frame caps.)
# max_ws_message_bytes = 1048576
# max_ws_frame_bytes = 1048576
[authorization]
# Allow / deny lists. Allow is a permissive ceiling; deny still
# removes specific entries inside it. Enforced by Pubkey/KindAllowDenyPolicy.
# pubkey_whitelist = ["abcdef...64hex..."]
# pubkey_blacklist = []
# kind_whitelist = [0, 1, 3, 7, 1059, 30023]
# kind_blacklist = [4]