Skip to main content

Module lan_continuity

Module lan_continuity 

Source
Expand description

LAN key continuity (docs/specs/SPEC_LAN_KEY_CONTINUITY_2026_10_29.md): a pinned name whose agent now shows a different key moves to it with no person in the loop, but only when the install that hosts the agent vouches for the key with a certificate, and this machine already trusts that install. Anything else stays refused.

The same certificate is what makes a name’s FIRST pin: a name with no pin is pinned only when a trusted install vouches for the key it shows (on_first_contact); an unvouched first key is never pinned by itself and its messages stay unproven until the person accepts it.

The sending half is issue_cert: the lookup answer for an agent carries lan_cert, a WanKeyRecord (channel lan) signed by the install’s own key. The receiving half is move_if_vouched, called when the name pin and the key just shown disagree, and by the agent route of pins.adopt.

Enums§

Path 🔒
What made the issuing install trusted.

Constants§

CERT_CHANNEL 🔒
The channel a LAN key’s certificate names.
CERT_MAX_AGE_SECS 🔒
How far from now a certificate’s time may be: it is signed when the answer is given, so an old copy is a replay.
DIRECTORY_WAIT 🔒
How long a check of a message from another machine waits on the account’s directory: the sign-in token (which can sit behind a refresh that hangs) and the lookups. The sender gives up on its forward after 10 s, so a longer wait only ends in a lost message (task #2512).
MAX_UNVOUCHED 🔒
At most this many unvouched keys are remembered at once; past it a key is simply looked into again.
RECHECK_AFTER_SECS 🔒
An unvouched key is not looked into again for this long, so a peer that keeps showing one cannot make this machine ask the directory every time.
REVOKED 🔒
The refusal instance_trust gives for an install known to be revoked: the only one that says the install itself is no longer trusted, as against a directory that could not be asked.

Statics§

UNVOUCHED 🔒

Functions§

add_cert 🔒
Put this install’s certificate for public_key_b64 into a lookup answer as lan_cert.
agent_says_hosted_by 🔒
Whether the agent itself, under the key key_b64, says the install behind cert hosts it: the statement the host adds to its lookup answer. A certificate alone proves only that some trusted install wrapped the key in one, which any of the account’s installs can do for a public key it merely saw.
ask_directory 🔒
instance_trust’s asks of the account’s directory: the token, the revocation of a pinned install, the listing of an unpinned one.
audit 🔒
One line to logs/pin-changes.log, best effort. Fingerprints and labels only: never a key.
bind_after_verified 🔒
A message just verified under agent’s pinned key (key). If the pin is bound to no install yet, bind it to the install behind the certificate the peer shows for exactly that key, when this machine trusts that install. Binding on a verified message keeps it as strong as the pin: a certificate alone proves nothing, since anyone can wrap a public key in a certificate of an install of their own.
bind_to 🔒
Record that the install behind cert vouched for the key agent is pinned to. Best effort: a pin left unbound is bound by the next message that verifies under it (bind_after_verified) and moves by hand until then.
bound_install_allows 🔒
A pin moves only on the say of the install that vouched for it, or one that install handed over to (it signed a revocation naming the new one as its successor). A pin bound to no install yet does not move on its own: it binds on the next verified message, and until then a person accepts the key.
check_cert 🔒
The certificate’s own checks, none of which need the network: it is a chain-valid certificate by some install, for this agent and channel lan and exactly the key shown, issued close to now and after the pin it would replace. Whether the install is trusted is instance_trust’s.
fingerprint 🔒
A short fingerprint of a base64 key: enough to tell two keys apart on a screen, never the key. (Not a prefix of the key: it is a hash of it.)
handed_over 🔒
Whether the account’s directory holds a revocation from signed that names to as its successor.
handed_over_asking 🔒
instance_trust 🔒
Whether this machine trusts the install instance_id: pinned here for some agent already, else live in the account’s directory. An install this machine knows to be revoked is trusted by neither way, and a pin does not outlive a revocation the directory holds.
issue_cert 🔒
The certificate for agent’s LAN key (public_key_b64), signed by this install now. None when this install has no WAN identity or the key is not a key.
move_if_vouched 🔒
Move agent’s name pin to observed_key if cert vouches for it; for a name with no pin, make its first pin the same way. The UID pins beside the name pin go with the old key and are set again by the next message that verifies under the new one (lan_peer_pubkey_pin_replace). Returns what vouched, or why nothing did. by is who asked, for the audit line: "automatic" for a message that arrived, an agent’s id for the route.
moved_off 🔒
Whether the agent named agent was moved to another computer from this one (its record carries the moved mark).
on_first_contact 🔒
A name has no pin and shows observed_key: pin it only if a trusted install vouches for it. true means carry on verifying under the (new) pin. false leaves the name unpinned and the message unproven, and keeps the key for the pin screen, which asks the person once to accept it.
on_mismatch 🔒
The pin and the key just shown disagree: move the pin if the hosting install vouches for the key, else record why it stays refused. true means carry on verifying under the (moved) pin.
pin_first 🔒
First contact: pinned only now that a trusted install vouched, and bound to that install. get_or_set keeps whichever key got there first, so a concurrent first contact cannot be overwritten from an older check.
remember_revoked 🔒
Keep a revocation learned from the directory, so it still stands when the directory cannot be asked. The install may have no known-install row yet (a pin the user adopted never went through WAN verification), and recording a check updates a row only, so make the row first.
retire 🔒
Remember that agent moved off old_b64, so a message signed with it later is refused as retired.
retired_reason 🔒
Why observed_key is refused when agent once moved off it, in a sentence; None if it never did.
unvouched 🔒
vouch 🔒
with_sender_cert 🔒
A machine’s sender-key lookup answer with this install’s certificate for the key, as an agent’s key is answered, so a peer that trusts the install pins it at first contact (a Swarm broadcast, a quiet note) instead of waiting for the person.
within 🔒
asking, within wait. Past it the answer is exactly what it is when the directory cannot be asked at all (no sign-in): a pinned install is trusted as pinned (Path::PinnedInstance), claiming nothing from a lookup that did not happen, and an unpinned one is not trusted, with the reason. An install already known locally to be revoked was refused before this was asked.
write_audit 🔒
Append one line for entry to pin-changes.log in dir.