Skip to main content

claim_uid

Function claim_uid 

Source
pub(super) async fn claim_uid(
    state: &AppState,
    req: &mut InjectionRequest,
    claimed: &str,
    name_key: &[u8],
)
Expand description

Record source_uid as claimed by this LAN path when the answering peer gave that UID’s key for claimed, the (name, uid) pin matches, and the v2 signature verifies under it. Only once the v1 check passed, so the name pin already matched: the UID pin is set only beside it.

A request that carries both a UID and a v2 signature but fails any of those checks (the peer gave another UID for the name, the pin holds a different key, the signature does not verify, the pin store cannot be read) is no longer verified: lan_verified becomes Some(false). A request with no v2 at all is left as v1 decided it, and so is one whose peer gave no UID key for a name that never gave one: there is nothing to contradict. Once a UID is pinned under the name, the peer owes its key again: a cache that no longer holds it is asked afresh (name_key must come back unchanged), and an answer without it fails the jekt rather than fall back to v1.