Skip to main content

Module wan_identity

Module wan_identity 

Source
Expand description

The channel-wide WAN identity store, <channel dir>/wan-identity/wan.db (SPEC_WAN_JEKT_VERIFICATION_2026_09_24.md §2.2, step D1).

Everything WAN verification needs to survive an upgrade lives here rather than in objects.db, which is per version for installed builds (channels/<ch>/versions/<v>/data/): with the agent keys in objects.db, every upgrade re-minted every agent’s WAN key. This file holds:

  • the instance keypair — the install’s long-lived identity. Its id (jekt_sign::wan_instance_id) is the source_host srv signs WAN jekts under, and its key certifies each agent key;
  • the agent WAN keys, imported once from the version’s db_agent_wan_keys (or minted fresh) and kept here from then on;
  • (D1b/D2) published fingerprints, the peer cache, replay and known-instance tables.

Concurrency. Two versions of one channel may run at once (data_paths.rs), so this file is shared between processes: WAL, a 5 s busy timeout, and every mint is INSERT OR IGNORE then re-read, so two processes minting at once converge on one row.

Schema is additive only. wan_meta.schema_version records the newest schema any binary has written; an older binary opening a newer file uses explicit column lists and ignores what it doesn’t know. A binary that cannot open the file gets no store at all — WAN signing and verification are then off for that process (every message None), and nothing is ever minted into a fallback location.

Lock order. The spawn path reads an agent’s old objects.db key before calling in here, and the agent-delete purge calls in here while holding the objects.db lock. So the order is always objects.db → wan.db; nothing here ever takes the objects.db lock.

Modules§

pins
Which install may speak for an agent name over WAN.
revocations
Retired agent WAN keys, both ways round.

Structs§

KnownInstance
What this install knows about another instance (§2.6).
WanAgentKey
An agent’s WAN keypair, both halves standard base64 — the same encoding agent_wan_keys::AgentWanKeypair uses, so an import is a straight copy (no agent holds it: srv signs, SPEC_WAN_JEKT_SIGNED_BY_SRV_2026_10_14.md).
WanIdentityStore
WanInstance
This install’s instance identity. The private key never leaves this process except as a certificate signature.

Functions§

global
install_global
Register the process’s wan.db for code that has no channel object store in hand — the cloud subscriber runs against id_store. Set once, at bootstrap, alongside Store::set_wan_identity.
resolve_wan_identity_path
<channel dir>/wan-identity/wan.db, from the launcher-provided paths. None outside a launcher-started srv (tests, odd envs): WAN identity is then off, never redirected somewhere else.
sanitize_host_hint
A hostname as a host hint: lowercased, anything outside [a-z0-9.-] replaced by -, cut to 48 chars; unknown if nothing is left. The receiver validates the same alphabet (jekt_sign::is_valid_wan_host_hint) and renders anything else as ?.