# Durable credential controls

Source: https://usecns.dev/hippocampus-topic-durable-credential-controls/

[Start here](https://usecns.dev/manual-hippocampus/)
[CLI commands](https://usecns.dev/commands-hippocampus/)
[Configuration & integration](https://usecns.dev/hippocampus-topics/)

These trusted-local receiver callables are available with `synthetic-receiver`; no HTTP administration route exists. `Credential { leaf_sha256, origin, valid_from_ms, valid_until_ms, revoked }` binds the exact TLS leaf DER SHA-256 to a pre-existing grant. `CredentialPolicy { revision, lifecycle_sequence, credentials }` returns rows in digest order. Validity is start-inclusive/end-exclusive.

| Callable | Contract |
| --- | --- |
| `credential_policy()` | `Result<Option<CredentialPolicy>>`; `None` means uninitialized, not permission to enroll network peers. |
| `initialize_credentials(credentials, trusted_now_ms)` | Atomic explicit initialization, revision 1. Credentials must be current, non-revoked and in authorized grants. Identical initialized state is a no-op; cannot replace it. |
| `rotate_credential(expected_revision, old_digest, replacement, overlap_until_ms, trusted_now_ms)` | Compare-and-set. Same origin, distinct new digest, current old/new credentials; positive overlap at most 600,000 ms, replacement finite expiry beyond overlap. Shortens old end to min(existing end, overlap); never extends/unrevokes/remaps a pin. |
| `revoke_credential(expected_revision, digest)` | Irreversible CAS revocation; current identical revoked state is a no-op. Works after origin revocation or payload saturation. |
| `authorize_credential(digest, trusted_now_ms)` | Read-only current credential and origin check → `(Identity, Grant)`. Missing policy, expiry, revocation or unauthorized scope denies; does not replace archive admission. |

Policy holds at most 64 lifetime rows including expired/revoked history, with two non-revoked slots per origin. Explicitly revoke an expired slot before reuse. No history eviction. Every successful change increments policy revision and receiver lifecycle sequence atomically; stale revision denies even a replay of a formerly successful update. After an uncertain write, read current policy before deciding what to do. Current identical-state controls do not advance counters.

Retain the returned lifecycle sequence independently and supply it to `open`; a lower restored catalog fails closed. Losing both independent floor and catalog is not recoverable rollback detection. Receiver schema 0/1 upgrades transactionally to version 2: schema 0 gains **no TLS credentials enrolled**, schema 1 preserves its credential policy, and both gain legacy receipt policy revision 1. Unknown/partial/malformed state fails closed. Local receiver/sender operations need no TLS policy, but HTTPS does. Neither server construction nor serving enrolls peers implicitly. Receipt-policy rollback requires the additional floor described below.