ADR-006: Protocol Buffers as Single Source of Truth for Types

Status

Accepted

Context

We currently maintain type definitions in multiple places:

This duplication creates maintenance burden and risk of divergence. Every type change requires updating Go, then regenerating for other languages.

Decision

Use Protocol Buffers (.proto files) as the single source of truth for shared type definitions, starting with the Attestation type and gradually migrating others.

Approach

Gradual replacement: Migrate one type at a time, proving each works end-to-end before proceeding.

  1. Start with Attestation (most widely used)
  2. Generate language-specific types from proto
  3. Replace existing usage with proto-generated types
  4. Validate in production
  5. Repeat for next type

Consequences

Positive

Negative

Neutral

Implementation Notes

Language-Specific Approaches

Go: Maintains native structs with struct tags for internal consumption

Rust: Uses proto-generated types from qntx-proto crate (prost)

TypeScript: Uses proto-generated interfaces only (see ADR-007)

General Notes