docs/internal/agenthub-identity.md

AgentHub identity and human checks

AgentHub has stable Hub authority, client-device, and endpoint identities. Canonical IDs are lowercase SHA-256 of validated PKIX SPKI DER. Ed25519 and P-384 are accepted; malformed, noncanonical, wrong-curve, and unsupported keys fail closed. Endpoint identity remains independent of its hosting Hub authority.

KEY CHECK and fingerprint

Human verification uses three different values:

  • five secret JOIN WORDS prove knowledge of one invitation;
  • four public KEY CHECK words plus a mandatory check byte detect identity-entry mistakes and provide a short claimant lock;
  • the full 64-character fingerprint is the exact software identity.

KEY CHECK words and the check byte are independently domain-separated from the raw fingerprint and include the identity role. The current domains are AgentHub/identity/key-check/word/v1 and AgentHub/identity/key-check/check-byte/v1. Exact rejection sampling, role and position bytes, counters, and expected blocks live in identity.json and check-keys.rb.

A short lock is not an exact-key guarantee. If both the short value and an independently supplied full fingerprint are present, they must identify the same canonical SPKI. Zero or conflicting matches stop the ceremony. Candidate-supplied fingerprints are diagnostic, not independent trust. There is no accept-anyway path.

Authority transitions

Renewing operational credentials under one authority does not change Hub identity. Replacing the stable authority key creates a new Hub unless a valid signed transition advances exactly one generation and proves both old and new keys. Conflicting successors quarantine the identity; loss of the old key cannot manufacture continuity.

Accepted transitions update saved trust through the verified lineage and display old and new KEY CHECK values, check bytes, and full fingerprints. Existing sessions may continue, but new handshakes require the new generation. Private administration consumes this transition presentation and conflict boundary.

Certificates and private keys

TLS roles are closed and non-interchangeable. Client-entry, peer, circuit, endpoint, and pairing certificates use their dedicated profiles and ALPN values. Exact profile validation is owned by internal/agenthub/identity and internal/agenthub/hoptls.

Private keys remain in protected owner-only state. Startup never regenerates a missing expected key or silently repairs an identity mismatch. Endpoint renewal keeps the stable endpoint key and ID; store.RenewEndpoint is the private administration foundation named in the contract inventory.

Fixtures and authority

  • Canonical keys, IDs, word/check streams, and malformed cases: identity.json.
  • Independent verification and extractor self-test: check-keys.rb and check-keys.rb --self-test.
  • Regeneration check: reproduce-identity.rb --check.
  • Certificate profiles: certificates.json, its generator, and package tests.
  • Current fixture commands and digest binding: fixture README.

Bounded public-key mathematics cache

Strict Ed25519 public-key validation caches only successful canonical, nonidentity, prime-subgroup point checks. It uses 8,192 fixed eight-way sets with exact 32-byte comparisons, about 2 MiB of process-static storage. A process-random keyed hash selects the set, so an attacker cannot choose collisions from a public key prefix. Input cannot grow the cache; a collision or eviction causes full validation again. This avoids thrashing a 256-key linear cache on the 17,729 public keys that can occur in one maximum legal catalog. It caches no role, certificate time, signature, policy or trust decision. Directory close releases all directory-owned reservations; this fixed mathematical cache is separate process overhead and retains no directory objects or private key material.

Independent evidence and presentation

identity.IndependentEvidence captures a complete four-word/check-byte tuple, a complete fingerprint, or both. MatchHubEvidence and MatchEndpointEvidence are the consumed closed role hooks around one private match implementation. Claimant locks use that same match after validating their immutable role and converting their stored word indices. Supplied short and complete values must agree. A complete fingerprint never overrides a supplied mismatching tuple.

SelectEndpointEvidence requires exactly one agreeing candidate. Zero matches, short collisions without an independent complete fingerprint, duplicate candidates and disagreement fail. The transport resolver first checks canonical SPKI and ID equality and excludes conflicted and unpublished rows. Published learned identities can resolve for display but have no direct invitation carrier.

PresentHub, PresentEndpoint and PresentDevice produce the canonical public Presentation record. It contains the role, ID, four words, mandatory check byte, complete fingerprint and separate provenance for the short and complete values. Absent independent evidence is candidate diagnostic data, never permission to approve. The frontend validates the record and independent input before rendering its shared confirmation text. Local claimant cards, authority-successor views, bootstrap output and local-control projections use the same canonical derivation. These public records contain no ceremony root, status key or approval secret.

Authenticated Hub and endpoint key presentations use PresentHubKey and PresentEndpointKey. These parse the canonical SPKI, require its ID to equal the claimed ID, clone its bytes and set evidence provenance in one constructor. ID-only presentations are diagnostics with no authenticated SPKI. Confirmation screens require the full key record and compare SPKI and both provenance fields as well as role, ID, words, byte and fingerprint. Altered records produce no output; input aliases cannot change the constructor-owned SPKI.

Device claimant cards still use PresentDevice. There is no exported device evidence matcher or authenticated device-key presentation without a production consumer. Local-control response validation derives each check from its field's actual role through DeriveRoleKeyCheck.

Typed private administration projections

Typed private administration carries canonical public identities through pkg/ezhubapi, not the removed localcontrol codec. Closed response fields select Hub-authority, endpoint or client-device derivation and compare IDs to exact effects/targets. The replacement local control.json uses derived words and bytes and valid EFF JOIN input; the checker has no historical dummy-card exception. Public identity, SPKI, inter-Hub and durable identity encodings are unchanged. See private administration.