# zahanturel/adtp architecture

> Architecture diagram of the GitHub repository zahanturel/adtp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zahanturel/adtp
- Repository: https://github.com/zahanturel/adtp

## Overview

ADTP is a Go daemon and protocol for issuing scoped, signed agent credentials, delegating them through attributable chains, verifying invocations, and revoking credentials and descendants. The main flow runs from an API client through the HTTP API to credential storage and delegation, then through chain reconstruction and verification to an authorization result; revocation state is checked during verification. The graph also includes agent identity, lifecycle, audit, OIDC, and optional SIEM export. Some subsystem links are documented or interface-based because their wiring was not fully shown in the excerpts.

Main entry points: [`api/v1/handlers.go`](https://github.com/zahanturel/adtp/blob/main/api/v1/handlers.go) (HTTP API), [`cmd/adtpd/main.go`](https://github.com/zahanturel/adtp/blob/main/cmd/adtpd/main.go) (Daemon), [`internal/verify/verifier.go`](https://github.com/zahanturel/adtp/blob/main/internal/verify/verifier.go) (Verification Engine), [`internal/verify/steps.go`](https://github.com/zahanturel/adtp/blob/main/internal/verify/steps.go) (Verification Steps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Daemon and API"]
  node_daemon["Daemon<br/>[main.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_httpapi["HTTP API<br/>[handlers.go]"]
  node_oidc["OIDC Auth<br/>[oidc.go]"]
  node_lifecycle["Agent Lifecycle<br/>[lifecycle.go]"]
end

subgraph group_credentials["Credential Chain"]
  node_credential["Credential Format<br/>[ucan.go]"]
  node_delegation["Chain Builder<br/>[chain.go]"]
  node_delegate["Delegation Issuer<br/>[delegate.go]"]
end

subgraph group_authorization["Verification and Revocation"]
  node_verifier["Verification Engine<br/>[verifier.go]"]
  node_verifysteps["Verification Steps<br/>[steps.go]"]
  node_revocation["Revocation State"]
end

subgraph group_persistence["Persistence and Audit"]
  node_memory[("Memory Store<br/>[store.go]")]
  node_postgres[("PostgreSQL Store<br/>[store.go]")]
  node_audit[("Audit Log<br/>[audit.go]")]
end

subgraph group_integrations["Identity and Export"]
  node_identity["Agent Identity<br/>[keystore.go]"]
  node_signing["Signing<br/>[sign.go]"]
  node_siem["SIEM Exporter<br/>[siem.go]"]
end

node_client(("API Client"))
node_webhook(("SIEM Webhook"))

node_client -->|"calls"| node_httpapi
node_daemon -->|"loads"| node_config
node_daemon -->|"serves"| node_httpapi
node_daemon -->|"selects backend"| node_memory
node_daemon -->|"selects backend"| node_postgres
node_daemon -->|"initializes"| node_identity
node_daemon -.->|"starts optionally"| node_siem
node_httpapi -.->|"authenticates"| node_oidc
node_httpapi -->|"issues"| node_credential
node_httpapi -->|"delegates"| node_delegate
node_httpapi -->|"reads and writes"| node_memory
node_httpapi -->|"reads and writes"| node_postgres
node_httpapi -->|"verifies"| node_verifier
node_httpapi -->|"revokes and queries"| node_revocation
node_httpapi -->|"uses keys"| node_identity
node_httpapi -->|"manages agents"| node_lifecycle
node_httpapi -->|"records events"| node_audit
node_delegate -->|"builds blocks"| node_credential
node_delegation -->|"parses proofs"| node_credential
node_verifier -->|"builds chain"| node_delegation
node_verifier -->|"runs checks"| node_verifysteps
node_verifysteps -->|"checks status"| node_revocation
node_verifysteps -->|"resolves issuer"| node_identity
node_verifysteps -->|"checks capabilities"| node_credential
node_verifier -->|"records denials"| node_audit
node_memory -->|"stores state"| node_revocation
node_postgres -->|"stores state"| node_revocation
node_postgres -->|"persists log"| node_audit
node_audit -->|"uses canonicalization"| node_signing
node_siem -->|"posts batches"| node_webhook
node_httpapi -.->|"exports audit"| node_siem

click node_daemon "https://github.com/zahanturel/adtp/blob/main/cmd/adtpd/main.go"
click node_config "https://github.com/zahanturel/adtp/blob/main/config/config.go"
click node_httpapi "https://github.com/zahanturel/adtp/blob/main/api/v1/handlers.go"
click node_oidc "https://github.com/zahanturel/adtp/blob/main/api/v1/oidc.go"
click node_lifecycle "https://github.com/zahanturel/adtp/blob/main/internal/lifecycle/lifecycle.go"
click node_credential "https://github.com/zahanturel/adtp/blob/main/internal/credential/ucan.go"
click node_delegation "https://github.com/zahanturel/adtp/blob/main/internal/delegation/chain.go"
click node_delegate "https://github.com/zahanturel/adtp/blob/main/internal/delegation/delegate.go"
click node_verifier "https://github.com/zahanturel/adtp/blob/main/internal/verify/verifier.go"
click node_verifysteps "https://github.com/zahanturel/adtp/blob/main/internal/verify/steps.go"
click node_revocation "https://github.com/zahanturel/adtp/tree/main/internal/revocation"
click node_memory "https://github.com/zahanturel/adtp/blob/main/store/memory/store.go"
click node_postgres "https://github.com/zahanturel/adtp/blob/main/store/postgres/store.go"
click node_audit "https://github.com/zahanturel/adtp/blob/main/internal/audit/audit.go"
click node_identity "https://github.com/zahanturel/adtp/blob/main/internal/identity/keystore.go"
click node_signing "https://github.com/zahanturel/adtp/blob/main/internal/signing/sign.go"
click node_siem "https://github.com/zahanturel/adtp/blob/main/internal/siem/siem.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_daemon,node_config,node_httpapi,node_oidc,node_lifecycle,node_client toneBlue
class node_credential,node_delegation,node_delegate toneAmber
class node_verifier,node_verifysteps,node_revocation,node_webhook toneMint
class node_memory,node_postgres,node_audit toneRose
class node_identity,node_signing,node_siem toneIndigo
```

## Components

### Daemon and API

- [Daemon](https://github.com/zahanturel/adtp/blob/main/cmd/adtpd/main.go): `cmd/adtpd/main.go`
- [Configuration](https://github.com/zahanturel/adtp/blob/main/config/config.go): `config/config.go`
- [HTTP API](https://github.com/zahanturel/adtp/blob/main/api/v1/handlers.go): `api/v1/handlers.go`
- [OIDC Auth](https://github.com/zahanturel/adtp/blob/main/api/v1/oidc.go): `api/v1/oidc.go`
- [Agent Lifecycle](https://github.com/zahanturel/adtp/blob/main/internal/lifecycle/lifecycle.go): `internal/lifecycle/lifecycle.go`

### Credential Chain

- [Credential Format](https://github.com/zahanturel/adtp/blob/main/internal/credential/ucan.go): `internal/credential/ucan.go`
- [Chain Builder](https://github.com/zahanturel/adtp/blob/main/internal/delegation/chain.go): `internal/delegation/chain.go`
- [Delegation Issuer](https://github.com/zahanturel/adtp/blob/main/internal/delegation/delegate.go): `internal/delegation/delegate.go`

### Verification and Revocation

- [Verification Engine](https://github.com/zahanturel/adtp/blob/main/internal/verify/verifier.go): `internal/verify/verifier.go`
- [Verification Steps](https://github.com/zahanturel/adtp/blob/main/internal/verify/steps.go): `internal/verify/steps.go`
- [Revocation State](https://github.com/zahanturel/adtp/tree/main/internal/revocation): `internal/revocation`

### Persistence and Audit

- [Memory Store](https://github.com/zahanturel/adtp/blob/main/store/memory/store.go): `store/memory/store.go`
- [PostgreSQL Store](https://github.com/zahanturel/adtp/blob/main/store/postgres/store.go): `store/postgres/store.go`
- [Audit Log](https://github.com/zahanturel/adtp/blob/main/internal/audit/audit.go): `internal/audit/audit.go`

### Identity and Export

- [Agent Identity](https://github.com/zahanturel/adtp/blob/main/internal/identity/keystore.go): `internal/identity/keystore.go`
- [Signing](https://github.com/zahanturel/adtp/blob/main/internal/signing/sign.go): `internal/signing/sign.go`
- [SIEM Exporter](https://github.com/zahanturel/adtp/blob/main/internal/siem/siem.go): `internal/siem/siem.go`

### Other components

- **API Client**
- **SIEM Webhook**

## Connections

- API Client → HTTP API: calls (evidence: `README.md`)
- Daemon → Configuration: loads (evidence: `cmd/adtpd/main.go`)
- Daemon → HTTP API: serves (evidence: `cmd/adtpd/main.go`)
- Daemon → Memory Store: selects backend (evidence: `cmd/adtpd/main.go`)
- Daemon → PostgreSQL Store: selects backend (evidence: `cmd/adtpd/main.go`)
- Daemon → Agent Identity: initializes (evidence: `cmd/adtpd/main.go`)
- Daemon → SIEM Exporter: starts optionally (evidence: `cmd/adtpd/main.go`)
- HTTP API → OIDC Auth: authenticates (evidence: `api/v1/oidc.go`)
- HTTP API → Credential Format: issues (evidence: `api/v1/handlers.go`)
- HTTP API → Delegation Issuer: delegates (evidence: `api/v1/handlers.go`)
- HTTP API → Memory Store: reads and writes (evidence: `api/v1/handlers.go`)
- HTTP API → PostgreSQL Store: reads and writes (evidence: `api/v1/handlers.go`)
- HTTP API → Verification Engine: verifies (evidence: `api/v1/handlers.go`)
- HTTP API → Revocation State: revokes and queries (evidence: `api/v1/handlers.go`)
- HTTP API → Agent Identity: uses keys (evidence: `api/v1/handlers.go`)
- HTTP API → Agent Lifecycle: manages agents (evidence: `api/v1/handlers.go`)
- HTTP API → Audit Log: records events (evidence: `api/v1/handlers.go`)
- Delegation Issuer → Credential Format: builds blocks (evidence: `internal/delegation/delegate.go`)
- Chain Builder → Credential Format: parses proofs (evidence: `internal/delegation/chain.go`)
- Verification Engine → Chain Builder: builds chain (evidence: `internal/verify/verifier.go`)
- Verification Engine → Verification Steps: runs checks (evidence: `internal/verify/verifier.go`)
- Verification Steps → Revocation State: checks status (evidence: `internal/verify/steps.go`)
- Verification Steps → Agent Identity: resolves issuer (evidence: `internal/verify/steps.go`)
- Verification Steps → Credential Format: checks capabilities (evidence: `internal/verify/steps.go`)
- Verification Engine → Audit Log: records denials (evidence: `internal/verify/verifier.go`)
- Memory Store → Revocation State: stores state (evidence: `store/memory/store.go`)
- PostgreSQL Store → Revocation State: stores state (evidence: `store/postgres/store.go`)
- PostgreSQL Store → Audit Log: persists log (evidence: `store/postgres/store.go`)
- Audit Log → Signing: uses canonicalization (evidence: `internal/audit/audit.go`)
- SIEM Exporter → SIEM Webhook: posts batches (evidence: `internal/siem/siem.go`)
- HTTP API → SIEM Exporter: exports audit
