Expand description
Shared helpers for signed DHT descriptors.
A descriptor is signed by the node’s MessageSigner, so its signature is bound to the
signer’s overlay exactly like every other message, and verified under the receiver’s
overlay. The body also carries network_id as a signed field; signing refuses a body whose
stated overlay differs from the signer’s, so a verified descriptor’s stated overlay is the
overlay it was signed for, and a descriptor issued in one overlay does not verify in another.
Lease law (#918; removal-stability paper, Laws 8 and 9): a descriptor is a signed lease. Its
body signs the lease end expires_at_ms = ℓ and the freshness window fresh_for_ms = T,
and nothing that changes between heartbeats, so its bytes are fixed for the lease and a
heartbeat re-appends them, which raises their dot without writing a remove. The time a
reader last heard the descriptor, heartbeat_at_ms = τ*, is the dot of its element in the
fetched carrier: it is not signed and not encoded, so a re-append or a forged dot can raise
it, but never past the signed ℓ. A reader at t holds the descriptor live iff it verifies,
its terms are admissible, ℓ ≤ t + Λ + σ and T ≤ Λ (registry_lease), and t ≤ ℓ and
t ≤ τ* + T + σ. The terms are the signer’s choice, so the reader bounds them: a lease longer
than Λ, or a window longer than the lease, is never live, and a registrant that stops is
listed at most Λ + σ after its last write against any signer, writer or syncer.
Traits§
- Registry
Element - A descriptor as one element of its DHT registry: the element is the descriptor’s codec encoding, carried as is.
- Signed
Descriptor - A published descriptor: its body plus the signature over it.
- Signed
Descriptor Body - The signed fields of one descriptor kind.
Functions§
- heard_
descriptors - Decode every element of
entryasD, heard at its dot; elements that do not decode are skipped. - heard_
elements - The registry elements of
entry, each with the issue time of its dot,τ*: the time the newest write of those bytes was stamped, which a heartbeat’s re-append raises. - latest_
valid_ by_ did - Select the newest descriptor per DID that verifies under the receiver’s overlay.
- latest_
valid_ by_ key - Select the newest descriptor per
keythat verifies under the receiver’s overlay, and live atnow_msunlessinclude_expired: the join⊔of the descriptors underSignedDescriptor::supersedeswithin each key, a total order, so the selection does not depend on the input order. - registry_
lease - The registry lease
Λ: the data default lifetimeL, so a replayed descriptor outlives its registrant by at mostL(removal-stability paper, Def. 7), and the bound a reader puts on every signed lease and freshness window. - sign_
descriptor_ body - Sign
bodywith the node’s authority.