Files
domi-pki/CLAUDE.md
T

2.5 KiB

CLAUDE.md — domi-pki

The Domi CA as one pure Rust crate: the root's certificate, intermediates, server, device and agent certificates, and the checks on them. Moved out of Ianitor core (T3a of Fabrica's docs/32_coherence.md) so Fabrica can issue Legatus agent certificates without Ianitor. MPL-2.0. Read docs/01_domi_pki.md first.

Layout

src/signer.rs the Signer trait (the root lives in Custos and signs through it) and the local KeyPair src/ca.rs root certificate, intermediate CSR and signing, Intermediate, issuing server/device/agent leaves src/inspect.rs reading certificates and CSRs: CertInfo, issued_by, intermediate_problem, match codes src/verify.rs chain checks (rustls-webpki) and verify_agent: who an agent certificate names, or why it is refused src/testing.rs certificates the CA itself never makes, for tests (doc-hidden) tests/ chains, expiry, wrong issuer, foreign agents, hostile input

Commands

cargo test # quote the test count; an exit code alone is not green cargo clippy --all-targets -- -D warnings On Mark's PC: CARGO_HOME=F:\C-Drive-Migration\future-caches\cargo, CARGO_TARGET_DIR=D:\cargo-target\domi-pki. One-time per clone: git config core.hooksPath .githooks (self-test: bash .githooks/test-pre-commit.sh)

Rules

  • Pure: no file, network or clock access. The caller passes now (unix seconds) and does every read and write. Randomness (serials, keys) comes from ring's SystemRandom.
  • The root key is never in this crate's hands in production: anything the root signs goes through Signer, which Custos implements after a match-code approval. create_root_local is for tests and the offline machine only.
  • Certificates, CSRs and chains are hostile input: typed Result, no unwrap()/expect()/panic! outside tests (clippy denies them), never a panic on garbage.
  • Tests first for anything that issues or checks a certificate.
  • Public API changes are semver: a breaking change is a major version. Ianitor and Fabrica pin a tag.
  • Commits: [pki] <Feature>: <one line>. No AI attribution, no trailers, ever.
  • Never in git: target/, binaries, private keys, files over 5 MB (the pre-commit hook enforces it).
  • $GITEA_TOKEN is never echoed or written anywhere.
  • Workflow: branch → Gitea PR via API → short adversarial self-review in the PR body → merge --no-ff → push → git rev-parse HEAD origin/main.
  • Disks on Mark's PC: nothing on C:. Build output on D:\cargo-target.