Skip to content

PeerborneConfig

Defined in: packages/core/src/peerborne-config.ts:310

PeerborneConfig is a settings object for peerborne.

optional allowLocalNetworkDials?: boolean

Defined in: packages/core/src/peerborne-config.ts:467

Let the background upgrade of a relayed connection dial loopback, private, link-local and other non-public addresses the peer advertises. Otherwise the upgrade dials only public addresses. The libp2p connection gater still decides every other dial; defaultConfig and defaultNodeConfig set this field together with a gater that admits every address when called with DefaultConfigOptions.allowLocalNetworkDials.

false

optional antiEntropy?: Partial<AntiEntropyConfig>

Defined in: packages/core/src/peerborne-config.ts:421

Automatic catch-up for default (non-coordinated) documents. An open document sends the existing signed sync request when it opens, when a peer subscribed to its topic connects, when the CRDT waits for missing dependencies, when a frame names a change that cannot be fetched, when a member advertises a head it lacks, one to two seconds after a frame adds a change, and every 30-60 s. The request after a frame names the change, so its author’s deliveryFailure clears even when the frame reached members only through a relay. A gap that outlives a request is repaired with the authenticated V4 load path when the CRDT itself shows the gap, two members advertise the same head, or the connected sole writer sends a fresh signed advertisement. This requires resolveLoadSecurityCommitments and keeps every load quorum rule. Observe it with document.antiEntropyStatus and document.subscribeToAntiEntropy().

Pass { enabled: false } to disable it. Default: enabled.


optional beekemForkStore?: DurableBeeKEMForkStore

Defined in: packages/core/src/peerborne-config.ts:312

Opt-in independent durable admission for legacy BeeKEM documents.


optional compaction?: Partial<CompactionConfig>

Defined in: packages/core/src/peerborne-config.ts:401

Configuration for history compaction. When provided with enabled: true, the document will periodically create snapshot nodes to compact the Merkle-DAG change history.


optional enableNetworkStats?: boolean

Defined in: packages/core/src/peerborne-config.ts:431

Enable network statistics tracking. When true, a NetworkStats counter container is created and accessible via peerborne.networkStats. Callers must invoke record*() methods explicitly; automatic event wiring will be added in a follow-up.

Default: false.


optional enableSigning?: boolean

Defined in: packages/core/src/peerborne-config.ts:394

Enable application-level signing for ordinary sync and snapshots. Initial network loads, security advertisements, invitation catch-up, and BeeKEM membership operations are always signed and verified, regardless of this setting. Invitation creation and acceptance reject when it is false.

WARNING: With false, ordinary sync and snapshot signatures are not checked, so any peer that can decrypt document traffic can forge ordinary changes. Only use it in trusted development or testing environments.

true

optional enableTopicValidators?: boolean

Defined in: packages/core/src/peerborne-config.ts:379

Enable GossipSub topic validators for transport-level authorization enforcement and peer scoring. They are installed during activation and removed during close(). The application receiver still validates messages when this optional transport check is disabled.

Validators check writer signatures, so this setting has no effect when enableSigning is false.

A node stops forwarding every frame its validator does not accept at once, including honest frames beyond its receive budget during a burst and frames from a writer whose ACL change it has not applied yet. Keyless relays forward all frames regardless. The default configs set no GossipSub topic score parameters, so a rejection lowers no peer score unless the application adds them.

false

optional helia?: HeliaInit & object

Defined in: packages/core/src/peerborne-config.ts:341

Configuration for Helia/libp2p.

Helia 7 accepts libp2p creation options here, not an already-created libp2p node.

Unless libp2p.privateKey is set, one running instance uses the libp2p key persisted in datastore, claimed with a Web Lock for IndexedDB datastores, and every other concurrent instance, such as a second browser tab, starts with a new Ed25519 key. Stopping the Helia node releases the claim. Never set one key in two instances running at once.

optional bitswap?: BitswapOptions

optional libp2p?: CreateLibp2pOptions<ServiceMap>


optional loadQuorumAllowSinglePeer?: boolean

Defined in: packages/core/src/peerborne-config.ts:590

Allow the initial-load quorum gate to pass with a single responding peer when the effective K is 1.

Effective K can resolve to 1 because only one peer is known, or because loadQuorumK is configured as 1 even when multiple peers are known. When this flag is true, the loader may accept the sole probed peer’s negotiated advertisement and proceed with the full load. An explicit Q greater than 1 remains a hard floor and is not overridden by this flag.

Trust caveat: with K=1 there is no second opinion, so this flag selects single-peer trust semantics regardless of which advertisement protocol is negotiated. A warning is logged when this path is taken.

When false (the default), any effective-K=1 load of a document with two or more trusted writers fails with LoadQuorumFailedError. Callers that intentionally use one probe should either disable the quorum gate or enable this flag and accept the warning. A document with one trusted writer does not need this flag (see loadQuorumEnabled).

false

optional loadQuorumEnabled?: boolean

Defined in: packages/core/src/peerborne-config.ts:500

Require Q distinct trusted signing authorities to agree on one V4 security-state and response-manifest digest. Every vote and selected response must match the locally captured trust tuple and fresh request challenge. An explicit Q is a hard floor, independent of peer availability. Distinct transport identities do not create extra votes.

The digest covers the served frontier, every change CID with its kind and edges, the snapshot’s state bytes and boundary, and keychain changes. It does not cover inline payloads, which quorum-bound loads discard before fetching each CID-addressed block, or who signed the snapshot, so holders with the same state agree. On a first load, the selected response’s snapshot must still be signed by a writer that its CID-validated writer blocks establish, checked before any state is applied.

When the trusted writer set captured for the load (the existing writer ACL, or resolveTrustedDocumentWriters on a first load) has exactly one authority, a second agreeing authority cannot exist. One valid response from that authority is accepted, from any of its devices, and loadQuorumAllowSinglePeer is not needed. Devices that advertise different states are out of sync rather than equivocating: the state most of them advertise is loaded first and each other state is a fallback bound to its own digest. Live sync then merges the rest. Documents with two or more trusted writers keep the Q-of-K quorum.

Setting false permits selection of one trusted signed V4 response while retaining challenge, tuple, and frontier validation. It provides no independent corroboration and never permits unsigned bootstrap.

true

optional loadQuorumK?: number

Defined in: packages/core/src/peerborne-config.ts:516

Maximum number of peers to probe in parallel for the initial-load advertisement step. The effective K is min(loadQuorumK, knownPeers.length), so no more distinct peers are selected than are currently known.

When three peers are known, the default of 3 paired with the default Q requires two matching votes while limiting open latency and bandwidth. That numerical majority does not establish Byzantine fault tolerance without corresponding peer identity, selection, and authentication assumptions.

3

optional loadQuorumQ?: number

Defined in: packages/core/src/peerborne-config.ts:552

Minimum number of accepted votes that must agree on the same negotiated advertisement digest. Together, loadQuorumK and this value define the configured Q-of-K policy. Once at least one peer is known, an explicit Q is a hard trust floor: if fewer than Q peers can be probed, loading fails closed instead of reducing Q to the currently reachable cohort. With no known peers (effectiveK = 0), the loader retains its new-document/no-peer skip path because there is no remote state to accept.

When Q is omitted, it is the strict numerical majority Math.floor(effectiveK / 2) + 1, derived from the effective K after limiting the configured K to the known-peer count. Votes count distinct writer authorities, so a document with one trusted writer instead accepts one response from any of its devices (see loadQuorumEnabled). An explicit Q above 1 still applies to such a document and cannot be met by it.

Worked examples (effectiveK -> default Q):

  • effectiveK=1 -> Q=1 (single-peer pass-through; requires loadQuorumAllowSinglePeer: true)
  • effectiveK=2 -> Q=2 (both peers must agree)
  • effectiveK=3 -> Q=2
  • effectiveK=4 -> Q=3
  • effectiveK=5 -> Q=3
  • effectiveK=7 -> Q=4

An explicit valid Q is used as configured, even when it is not a majority of K. It is also preserved when a partition lowers the effective K, which makes the load fail closed if Q can no longer be reached. Choosing Q=1 or another non-majority threshold provides only that amount of agreement and must not be interpreted as Byzantine-majority protection.

Math.floor(effectiveK / 2) + 1

optional loadQuorumTimeoutMs?: number

Defined in: packages/core/src/peerborne-config.ts:566

Per-peer timeout (milliseconds) for the initial-load quorum advertisement probes. A peer that does not respond within this window is recorded as a non-vote (NOT a disagreement); see load-quorum.ts::decideLoadQuorum for the distinction.

Default chosen to be larger than typical RTT + protocol-negotiation latency on a wide-area mesh, but small enough that a partitioned peer does not stall document open by more than ~5 seconds.

5000

pubsubDocumentPrefix: string

Defined in: packages/core/src/peerborne-config.ts:359

Prefix to apply to document pubsub topics.

Defaults to DEFAULT_DOCUMENT_TOPIC_PREFIX to namespace document traffic on the pubsub mesh. Topic names are routing labels, not authentication; wire decoding and admission checks remain mandatory.

Set to an empty string ('') to disable prefixing; topic strings will be the bare document path. Every peer sharing a document must use the same prefix.

DEFAULT_DOCUMENT_TOPIC_PREFIX

optional resolveLoadSecurityCommitments?: (documentPath) => LoadSecurityCommitments | Promise<LoadSecurityCommitments>

Defined in: packages/core/src/peerborne-config.ts:325

Atomic, locally trusted control/group commitments for network loads. Required when serving or loading V4 state. The loader captures one tuple before probing; a missing or invalid tuple rejects the load. This callback does not derive trust from a peer’s response.

string

LoadSecurityCommitments | Promise<LoadSecurityCommitments>


optional resolveTrustedDocumentWriters?: (documentPath) => readonly unknown[] | Promise<readonly unknown[]>

Defined in: packages/core/src/peerborne-config.ts:315

Writer identities trusted out of band for a first network load.

string

readonly unknown[] | Promise<readonly unknown[]>


optional validateDocumentPath?: (documentPath, userPublicKey) => boolean | Promise<boolean>

Defined in: packages/core/src/peerborne-config.ts:614

Optional callback to validate document paths before creation.

Called when open() determines the document is new (i.e., load() returned false — no peers could provide the document). Note that load() can also return false during network partitions when peers are unavailable.

Validation runs before pubsub subscription and protocol handler registration, so rejected paths never temporarily join the topic.

  • If the callback returns false, open() throws new Error('Document path "<path>" is not allowed for the current user').
  • If the callback throws, open() rethrows the error as-is (if it is already an Error) or wraps it via new Error(String(err)).

May return a boolean or a Promise for async validation. Return true to allow creation, false to reject it. When absent, all document paths are allowed.

string

The path of the document being created.

unknown

The public key of the current user.

boolean | Promise<boolean>


optional webrtcIceServers?: readonly Readonly<IceServer>[]

Defined in: packages/core/src/peerborne-config.ts:454

Optional override for the WebRTC ICE server list used by the webRTC() and webRTCDirect() transports. When undefined, the built-in DEFAULT_WEBRTC_ICE_SERVERS list (Google + Cloudflare + Twilio public STUN endpoints) is used so peers can discover their public address mappings without depending on Circuit Relay for the data plane.

Privacy note: Using the public STUN defaults discloses each peer’s public IP/port mapping to the third-party STUN operators. For privacy-sensitive deployments, pass [] to disable STUN entirely (e.g. for fully-internal LAN deployments where mDNS is sufficient), or supply self-hosted STUN/TURN servers.

Note: this field is informational once the libp2p config has already been built by defaultConfig; to actually change the ICE configuration, pass the override into defaultConfig(bootstrap, ice) (or getDefaultConfig(ice)) so it is wired into the transports at construction time.

DEFAULT_WEBRTC_ICE_SERVERS