Getting Started
Setup guide for the buyer. From clone to first notarized certificate in under 15 minutes.
Prerequisites
| Tool | Version | Purpose |
|---|---|---|
| Rust toolchain | 1.88+ (edition 2021) | Workspace build, 31 crates, 1 binary |
| Python | 3.11+ | Control plane (FastAPI) + SDKs |
| uv | Latest | Python package management (replaces pip) |
| pnpm | 9+ | TypeScript SDK build |
| Go | 1.22+ | Go SDK (pure Go, no CGO) |
| maturin | Latest | Python wheel build (PyO3) |
Clone and Build
# Clone the repository
git clone https://github.com/SuarezPM/trai
cd trai
# Build all Rust crates (release mode)
cargo build --workspace --release
# Build the Python wheel (heavy SDK)
cd sdk/python && maturin develop --release
# Build the TypeScript SDK
cd sdk/typescript && pnpm install && pnpm run build
# Build the Go SDK
cd sdk/go && go build ./... Or use the Makefile shortcut
make build # Rust workspace + Python wheel + TypeScript SDK Run the Test Suite
# Rust tests (release) -- 1,375 pass, 0 fail
cargo test --workspace --release
# Python tests -- 1,400 pass, 8 skipped, 4 xfailed
cd sdk/python && pytest -m 'not integration' tests/
# TypeScript SDK
cd sdk/typescript && pnpm test
# Go SDK
cd sdk/go && go test ./... Test count verification: README, HONEST_STATE, and test suite all agree on
1,375 Rust + 1,400 Python = 2,775 total. Run cargo test --workspace --no-fail-fast
and pytest tests/ services/control_plane/tests/ to independently verify.
Lint Gates
# Python lint -- zero errors
ruff check
# Rust lint -- zero warnings
cargo clippy --workspace --all-targets -- -D warnings Control Plane Setup
The control plane is a Python 3.11+ FastAPI application. In dev mode, it uses ephemeral Ed25519 keys, mock TSA, and mock SCITT -- clearly labeled as "Toy Mode" with no cryptographic validity.
# Start the control plane in dev mode
cd services/control_plane
# Set dev mode
export TL_DEV_MODE=1
# Start with uvicorn
PYTHONPATH=. uv run --with pydantic --with sqlalchemy \
--with fastapi --with uvicorn --with httpx \
uvicorn app.main:app --reload --port 8000 Or use the Makefile shortcut
make demo # Boot control plane, generate + verify certificate First Notarization
The end-to-end acceptance gate boots a uvicorn subprocess, sends a notarization request, and verifies the response:
# Run the acceptance gate script
bash services/control_plane/scripts/run_first_real_cert.sh This script:
- Boots a uvicorn subprocess with dev defaults
- POSTs to
/v1/notarizewith a test disclosure - Asserts that
GET /v1/verify/{cert_id}returns the expected COSE protected header - Downloads the JSON packet and optionally the PDF
- Fails non-zero with full stack trace on any HTTP error
What Happens (The Crypto Pipeline)
When you submit a disclosure to POST /v1/notarize, here is what happens
under the hood, explained in plain terms:
- Content hashing -- The disclosure content is hashed with BLAKE3 to produce a content-addressable fingerprint.
- Signing -- The content hash is signed with Ed25519 (or ML-DSA-65 hybrid in production) inside a COSE_Sign1 envelope per RFC 9052.
- Timestamping -- An RFC 3161 timestamp request is sent to a Time-Stamp Authority (Actalis Italia in production, FreeTSA in dev). The TSA signs a token proving the content existed at that point in time.
- SCITT anchoring -- The signed envelope is anchored in a SCITT transparency log with an RFC 9162 Merkle inclusion proof. This makes the evidence tamper-evident and publicly verifiable.
- Hash chain -- The event is appended to a BLAKE3 hash chain scoped to the tenant's organization ID, ensuring sequential ordering.
- PDF rendering -- A multi-section A4 PDF certificate is generated with the cryptographic details, an embedded QR code for quick verification, and a 3-tier disclosure (L1 summary, L2 raw CWT, L3 verification steps).
- Receipt -- The Evidence Packet + Receipt are persisted to PostgreSQL
and returned to the caller. The certificate can be verified at any time via
GET /v1/verify/{cert_id}.
TRAI provides technical evidence generation capabilities. It does not constitute legal advice, regulatory certification, or a substitute for independent compliance review. Buyers and users must validate regulatory applicability in their jurisdiction.