- Dev Center
- Documentation
- Getting started
- Overview
Documentation
Build on the diagnos vault
Zero-knowledge SDK, CLI and REST API for the diagnos vault: patients, exams and files encrypted in your process before they reach the network.
Pick your package
- SDK diagnos The diagnos Python SDK: zero-knowledge access to patients, exams and files, with keys held in a Rust memory enclave.
- CLI diagnos-cli The zero-knowledge diagnos vault from your terminal, built on the SDK, with JSON output and stable exit codes.
- REST API diagnos-api A FastAPI REST facade over the diagnos SDK for systems that speak HTTP, authenticated by mutual TLS only.
Note
Status: 0.1.0 preview. Every surface — enrollment, sessions, request signing, patients, exams, files and folders — speaks the vault's current protocol and is verified against it by the contract tests. Known limits, and the questions still open on the vault side, are in docs/COMPATIBILITY.md.
Note
Not on PyPI yet. Until the first release, install from source — Install has the commands, and the Rust toolchain the build needs.
Getting started
- Quickstart From a service-account token to your first encrypted patient and file in five minutes, with the Python SDK or the diagnos CLI.
- Install Install the diagnos SDK, CLI or REST API: from PyPI, from source with Rust, or as a Docker image, plus the OpenBao extra.
- Concepts Workspaces, service accounts, security groups, documents, versions, drafts and nodes: the model behind every diagnos call.
- Authentication How a diagnos process earns access: the service-account token, the enrollment link and code, and the admin approval that grants groups.
Reference
Go deeper
- Deploying diagnos-api Deploy diagnos-api with Docker or Kubernetes: environment, mTLS material, OpenBao auto-unseal and locking keys in RAM.
- Security model The diagnos threat model: what the vault can and cannot see, what the SDK protects in memory, and the trade-offs you opt into.
- PROTOCOL — the contract between the SDK and the vault The normative wire contract between the diagnos SDK and the vault: identity, clock, signatures, enrollment, envelopes and errors.
- Contributing How to contribute to diagnos integration: setup with uv and Rust, the checks CI runs, code conventions and the pull request checklist.
Quick start#
1. Get a token. A workspace admin issues a service-account token in the diagnos web app:
export DIAGNOS_API_TOKEN="apikey-…"
2. Enroll. The first run prints a link and a 6-digit code; an admin approves it in the web app and picks which security groups this process may read.
from diagnos import Diagnos
with Diagnos() as vault: # enrolls on entry: prints the approval link + code
print(vault.workspace_id)
print(vault.security_groups) # the groups the admin granted
diagnos login # the same enrollment, from the terminal
diagnos status # token, OpenBao and SDK version
3. Use it. Patients, exams and files hang off the same object — vault.patients, vault.exams,
vault.drives. The quickstart goes from here to your first encrypted patient and file.
Private keys never leave the process and nothing is written to disk, so the next process needs a new approval — that is the design, not a limitation. Authentication shows the whole enrollment, and Sessions how servers restart without a human.
What you get for free#
- 🔐 End-to-end by default — records and files are encrypted in your process; the vault sees ciphertext, signed requests and presigned URLs. Exactly what it sees.
- 🛡️ Post-quantum hybrid — enrollment uses X25519 + ML-KEM-768, so a recorded session stays safe against a future quantum adversary.
- 🧱 Keys in a Rust enclave —
mlocked memory, guard pages, excluded from core dumps, zeroed onfork()and on drop, never handed back to Python asbytes. Threat model:apps/sdk/native/README.md. - 🔁 Retries and clock skew handled — idempotent retries, clock sync with the vault, stable exceptions: Errors.
- 📐 Pinned byte formats —
docs/PROTOCOL.mdis normative, and test vectors generated from the vault's reference implementation pin every byte.
Servers without a human#
A human approval on every restart is fine for a laptop; it is not fine for a Kubernetes pod. Point the SDK at
OpenBao and it saves its unlocked session right after enrollment and restores it on every
start — a deliberate trade, explained in full before you turn it
on. Ready-made manifests live in apps/api/deploy/: Docker Compose and Kubernetes, with
OpenBao auto-unseal for AWS KMS, Azure Key Vault, GCP KMS, Transit, Shamir and static keys.
Documentation#
| Start here | Then |
|---|---|
| Quickstart · Install · Concepts | Authentication · Sessions · Configuration |
| Patients · Exams · Files | Errors · Security model |
| CLI guide · REST API guide | Deploying · Protocol · Compatibility |
The developer site publishes these same pages at /dev/docs, plus a reference generated from the code — every
command, route and class. How the docs are built and checked.
Quality gates#
Every badge above is a workflow you can run locally with one command.
| Badge | What it proves | Locally |
|---|---|---|
| Unit tests | the three packages on CPython 3.11–3.13, plus the Rust enclave | make test |
| Coverage | combined branch coverage of diagnos, diagnos-cli and diagnos-api, with a floor that only goes up |
make cov |
| Contract tests | the SDK sends and reads exactly what the committed Pact contract says (Rust pact_ffi engine) |
make contract |
| CI | lint (Python, Rust, bilingual docstrings, docs), mypy --strict, lockfile, and the docs: every example runs, the reference is fresh |
make lint types docs-check |
The contract is consumer-driven: the SDK's tests write
contracts/diagnos-sdk-diagnos-vault.json, and the vault verifies that
same file against its real code before it deploys.
flowchart LR
SDK["SDK tests<br/>(Pact mock, Rust engine)"] -->|write| C[("diagnos-sdk-diagnos-vault.json")]
C -->|replayed against| V["vault.diagnos.health<br/>provider verification"]
Repository layout#
integration/
├── apps/
│ ├── sdk/ diagnos the library — everything lives here
│ │ └── native/ diagnos._secure Rust memory enclave
│ ├── cli/ diagnos-cli `diagnos …` in your terminal
│ └── api/ diagnos-api REST facade (FastAPI), mTLS only
│ └── deploy/ compose · k8s ready-to-run manifests
├── contracts/ Pact consumer contract with the vault + its tests
├── docs/ guides/ the documentation · reference/ generated from the code
│ PROTOCOL.md normative byte formats · COMPATIBILITY.md · site.json
└── scripts/ docs/ the checks behind `make lint`, `make docs-check` and CI
Contributing#
You need uv, Python 3.11–3.13 and, to build the enclave from source, Rust stable.
git clone https://github.com/diagnos-tech/integration && cd integration
make sync # installs everything and builds the Rust enclave
make check # exactly what CI runs: lint, types, unit and contract tests, docs
make # lists every other target
Read CONTRIBUTING.md before your first pull request. Coming from the imgexam packages? See
MIGRATING.md.
Security#
Found a vulnerability? Please do not open a public issue — report it privately through GitHub Security Advisories. Details in SECURITY.md.