1.9 KiB
1.9 KiB
Decision: FOLD into network-discovery-gundb (not split)
- Date: 2026-05-12
- Decided by: autonomous Wave 3.5 implementation
- Parent:
network-transport-familyproposal, §"Split vs. fold" for discovery-bundled transports
Outcome
@suaveplan/network-transport-gundb is NOT shipped as a separate package. Its functionality lives at @suaveplan/network-discovery-gundb/transport (subpath export of the existing discovery package).
Rationale
- Upstream code bundles transport + discovery as one integrated unit; the existing gossip rendezvous already moves messages between peers — the transport adapter exposes that as a
Transportcontract. - Security uplift sharing: Folding lets the transport adapter reuse the existing
signEnvelope/verifyEnvelopeSignaturepath AND the same defensive inbound handler that silently drops unsigned/tampered/malformed messages. Everytransport.send()flows throughsignEnvelope(Ed25519 over canonical bytes); every inbound payload is Zod-parsed → verified → senderPeerId-matched → recipient-matched BEFORE any caller handler is invoked. Splitting would risk the transport bypassing this defensive layer. - Same
gundb.invalid_messages_total{reason}andgundb.signature_rejected_total{reason}security counters cover both tiers.
What to import
- Discovery:
import { GunDBDiscovery } from "@suaveplan/network-discovery-gundb" - Transport:
import { GunDBTransport, GunDBPlugin } from "@suaveplan/network-discovery-gundb/transport"(or/plugin) - Envelope signing: imported via the transport package; the existing
./signingsubpath for discovery announces stays unchanged.
Security guarantee
Tests explicitly verify that unsigned envelopes, single-bit-flipped signatures, mismatched senderPeerId, wrong recipientPeerId, and malformed wire payloads are ALL dropped at the receiver without invoking the caller handler. The transport adapter is a facade, not a bypass.