in reviewhumanPR #367Identity

registry_snapshot: refuse a former controller whose signatures are valid

A signature proves that a key signed. It cannot tell you whether that key still speaks for the identity it claims. If an external registry moved control of an identity from key K1 to key K2, K1 still signs perfectly, and only the…

Author

FilipBl4gojevic avatar

@FilipBl4gojevic

github profile →
Status
In review
Opened on
Nov 12
Branch
registry-snapshot-profile

Description

The pitch.

## Summary

A signature proves that a key signed. It cannot tell you whether that key still speaks for the identity it claims. If an external registry moved control of an identity from key K1 to key K2, K1 still signs perfectly, and only the registry's record knows the authority lapsed. #303 ended with "Bind listings to the deployed NANDA Index's identity records instead of a town-local key, so ownership survives outside one run, and add key rotation". This PR adds the rotation half as an out-of-tree Lab profile under `examples/registry_snapshot/`:

- **`identity: claims.v1`.** Seeded Ed25519 town keys. An agent may carry a configured **registry claim**: a statement that an identity's controller key signed once, outside any run, naming the agent that speaks for it.
- **`auth: ed25519.v1`.** Every call is judged under the sender's own town key, whatever the payload looks like. An agent whose own claim was refused can no longer sign anything that verifies.
- **`registry: snapshot.mock.v1`.** Extends `index.owned.v1`, so #303's ownership rule is unchanged. When an agent publishes its own card with a claim, the registry checks the claim against a pinned `registry-snapshot/v1` file, and refuses a key the record moved away from before any traffic.
- **The control, `registry: snapshot.mock.sigonly.v1`.** It checks every signature but does not compare the record.
- **The validator, `registry_rotation` (version `registry-rotation-0.2`), and the role `former_controller`.** Two scenarios, a verify wrapper, a claim signer, a mock-data generator and a README.
- **`tests/test_registry_snapshot_profile.py`.** 80 tests.

No core module changes. `MANIFEST.in` gains `*.yaml *.md *.json` for `examples/`, so an sdist ships the profile with its data.

## The gap, on `main` (`6f9a7c0`)

Two providers claim one identity, and the registry record says control moved from K1 to K2. The K1 provider prices below K2 and delivers honestly. Under a check that verifies every town signature and every claim signature but has no record, K1 is listed (ev-12, `card_registered` verified), contacted, picked and paid 1200 cents (ev-37, `escrow_released`). A valid signature under the presented key cannot see a transfer.

## How it works

**The fault:** an identity's controller changed outside the run. The former controller's card, claim and signatures are all valid.

**The invariant:** a claim resolves only to the controller the record holds now. A former controller that presents its claim is refused before any message, and gets no listing, no traffic and no money.

The registry evaluates a claim only on a card signed by its name's own town key, so whose claim it is never comes from the `publisher` argument. Then, in order:

1. The claim is the one configured for that agent.
2. The snapshot is available. It loads only if its fingerprint equals the pin, and every identity's history replays to its recorded controller, in order and at or before the tip.
3. The claim statement verifies under the presented controller key.
4. The identity exists and is active.
5. blake2b-224 of that key equals the recorded controller.

The `.sigonly` control skips only step 5. No private controller key enters a run.

## Stages, judged only from events and recomputed

Claim events record the card, its town signature, the town key, the claim, the controller key and its hash. The snapshot event records the whole snapshot, the validator version and the profile's sha256.

- **`snapshot_loaded`:** one snapshot, rebuilt from the event, must hash to the recorded fingerprint and to the pin, and its histories must replay. Rebuild or replay failure is `error`. No snapshot, another validator version, or an identity the record does not hold is `not_enough_evidence` for every stage.
- **`former_controller_refused`:** for every former controller, a `controller_mismatch` refusal of its configured identity before its first traffic in either direction. The refusal must recompute:
  - the card and the town ke

…

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/367/head:pr-367
git checkout pr-367