Expand description
On-disk state for wire.
Layout:
$XDG_CONFIG_HOME/wire/ (defaults to ~/.config/wire/)
- private.key — 32-byte raw Ed25519 seed (mode 0600)
- agent-card.json — signed self-card (mode 0644, public)
- trust.json — pinned peers + tiers
- config.toml — relay URL, body cap, etc. (created lazily)
$XDG_STATE_HOME/wire/ (defaults to ~/.local/state/wire/)
- inbox/<peer>.jsonl — verified inbound events
- outbox/<peer>.jsonl — agent-appended outbound events (daemon flushes)
- spool/ — daemon-internal staging
All paths are configurable via WIRE_HOME env var (overrides both dirs to
$WIRE_HOME/{config,state}/). Used by the test harness to keep tests
isolated from the operator’s real config.
Functions§
- agent_
card_ path - append_
outbox_ record - Append a single JSONL record to the outbox for
peer, holding the per-path mutex to keep concurrent appenders from interleaving lines. - config_
dir - Root configuration directory. Honors
WIRE_HOMEfor testing. - config_
toml_ path - ensure_
dirs - Create directory tree with restrictive permissions on the config dir.
- inbox_
dir - is_
initialized - Whether
wire inithas already been run (private key + card both present). - outbox_
dir - private_
key_ path - read_
agent_ card - read_
private_ key - Read the saved private key seed (32 bytes).
- read_
relay_ state - read_
trust - relay_
state_ path - Path to
relay.json— holds our own slot binding and pinned peer slots. Contains slot-tokens, so always written mode 0600. - state_
dir - Root state directory (rotating data — inbox/outbox/spool).
- trust_
path - update_
relay_ state - Atomic read-modify-write against
relay.json. Holds an exclusivefs2::FileExt::lock_exclusivefor the whole transaction so concurrentwireprocesses (multiple daemons, CLI vs daemon, CLI vs MCP) cannot race the cursor or peer-pin entries. - write_
agent_ card - write_
private_ key - Write a private key file with mode 0600.
- write_
relay_ state - write_
trust