Skip to main content

Crate nostr_bbs_mesh

Crate nostr_bbs_mesh 

Source
Expand description

Federation mesh kit for nostr-bbs deployments.

Implements ADR-073 (mesh federation): per-peer connection state, NIP-42 AUTH session management, and kind-30033 federated-broadcast event emission.

This crate provides the substrate — abstract traits + state machines — that concrete worker implementations (e.g. nostr-bbs-relay-worker mesh mode) plug into. The reference Cloudflare Worker implementation lives alongside the relay-worker; alternative deployment targets (libp2p, HTTP/3, Tailscale) implement MeshTransport themselves.

§Status

Sprint v9-v11: scaffold only. The mesh feature is gated by [mesh] mode = "federated" in the operator config (default "standalone"), and the relay-worker’s runtime continues to short-circuit when in standalone mode. Full implementation lands in Sprint v12+ per the PRD-012 Phase X3 plan.

§Architecture sketch

    [PeerRelay A]                         [Local Relay]
        │                                       │
        │ wss://A/.well-known/nostr.json#mesh   │
        │◀──────────────────────────────────────│
        │                                       │
        │   ["AUTH", <NIP-42 challenge>]        │
        │──────────────────────────────────────▶│
        │   ["AUTH", <signed challenge>]        │
        │◀──────────────────────────────────────│
        │   ["EVENT", <kind-30033 mesh anchor>] │
        │──────────────────────────────────────▶│
        │                                       │

Structs§

PeerSession
Per-peer mesh session state.

Enums§

MeshError
Errors raised by mesh transports.

Traits§

MeshTransport
Abstract transport for connecting to a peer relay.

Functions§

mesh_anchor_tags
Build a kind-30033 mesh anchor event payload (signing + serialization happens upstream via nostr-bbs-core).