# weboftrust/keripy architecture

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

- Interactive diagram: https://gitdiagram.com/weboftrust/keripy
- Repository: https://github.com/weboftrust/keripy

## Overview

KERIpy is a Python implementation of KERI core libraries: it provides cryptographic and serialization primitives, identifier-event processing, persistence, peer messaging, and application-level identity and credential features. A typical controller workflow creates or opens a habitat, manages its signing keys, produces and endorses events or messages, then processes them through parsers and event handlers backed by databases. The tree and index also show CLI, OOBI, witness/mailbox, multisig, and credential subsystems. Some of those branches are unsampled; their internal links are omitted rather than inferred.

Main entry points: [`src/keri/app/habbing.py`](https://github.com/weboftrust/keripy/blob/main/src/keri/app/habbing.py) (Habitats), [`src/keri/core/eventing.py`](https://github.com/weboftrust/keripy/blob/main/src/keri/core/eventing.py) (Key events), [`src/keri/db/basing.py`](https://github.com/weboftrust/keripy/blob/main/src/keri/db/basing.py) (KERI database), [`src/keri/app/agenting.py`](https://github.com/weboftrust/keripy/blob/main/src/keri/app/agenting.py) (Witness agents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Protocol Core"]
  node_crypto["Crypto primitives<br/>[coring.py]"]
  node_counter["CESR counters<br/>[counting.py]"]
  node_serialization["Serders<br/>[serdering.py]"]
  node_eventing["Key events<br/>[eventing.py]"]
  node_parser["Stream parser<br/>[parsing.py]"]
  node_router["Reply routing<br/>[routing.py]"]
  node_exchange["Peer exchange<br/>[exchanging.py]"]
  node_database[("KERI database<br/>[basing.py]")]
  node_dbengine[("LMDB engine<br/>[dbing.py]")]
end

subgraph group_identity["Identity Runtime"]
  node_habitat["Habitats<br/>[habbing.py]"]
  node_keymgmt["Key management<br/>[keeping.py]"]
  node_agent["Witness agents<br/>[agenting.py]"]
  node_multisig["Multisig<br/>[grouping.py]"]
end

subgraph group_credentials["Credentials"]
  node_acdc["ACDC messaging<br/>[messaging.py]"]
  node_ipex["IPEX exchange<br/>[ipexing.py]"]
  node_registry["Credential registry<br/>[eventing.py]"]
  node_credential["Credential proofs<br/>[proving.py]"]
end

subgraph group_services["Application Services"]
  node_oobi["OOBI resolution<br/>[oobiing.py]"]
  node_mailbox["Mailbox service<br/>[storing.py]"]
  node_http["HTTP transport<br/>[httping.py]"]
end

node_cli["KLI commands<br/>[kli.py]"]
node_controller(("Controller"))

node_controller -.->|"invokes"| node_cli
node_cli -.->|"uses"| node_habitat
node_habitat -->|"uses"| node_keymgmt
node_habitat -->|"creates events"| node_eventing
node_habitat -->|"stores state"| node_database
node_habitat -->|"routes replies"| node_router
node_habitat -->|"parses messages"| node_parser
node_agent -->|"uses transport"| node_http
node_agent -->|"processes events"| node_eventing
node_agent -->|"parses streams"| node_parser
node_agent -.->|"forwards messages"| node_exchange
node_multisig -->|"uses exchanges"| node_exchange
node_multisig -->|"uses habitats"| node_habitat
node_eventing -->|"uses serders"| node_serialization
node_eventing -->|"uses primitives"| node_crypto
node_eventing -->|"uses counters"| node_counter
node_eventing -->|"stores events"| node_database
node_serialization -->|"uses primitives"| node_crypto
node_exchange -->|"stores evidence"| node_database
node_database -.->|"uses engine"| node_dbengine
node_ipex -->|"uses exchanges"| node_exchange
node_registry -->|"uses database"| node_database
node_controller -.->|"resolves identifiers"| node_oobi
node_controller -.->|"uses mailbox"| node_mailbox
node_controller -.->|"issues credentials"| node_credential

click node_cli "https://github.com/weboftrust/keripy/blob/main/src/keri/cli/kli.py"
click node_habitat "https://github.com/weboftrust/keripy/blob/main/src/keri/app/habbing.py"
click node_keymgmt "https://github.com/weboftrust/keripy/blob/main/src/keri/app/keeping.py"
click node_agent "https://github.com/weboftrust/keripy/blob/main/src/keri/app/agenting.py"
click node_multisig "https://github.com/weboftrust/keripy/blob/main/src/keri/app/grouping.py"
click node_crypto "https://github.com/weboftrust/keripy/blob/main/src/keri/core/coring.py"
click node_counter "https://github.com/weboftrust/keripy/blob/main/src/keri/core/counting.py"
click node_serialization "https://github.com/weboftrust/keripy/blob/main/src/keri/core/serdering.py"
click node_eventing "https://github.com/weboftrust/keripy/blob/main/src/keri/core/eventing.py"
click node_parser "https://github.com/weboftrust/keripy/blob/main/src/keri/core/parsing.py"
click node_router "https://github.com/weboftrust/keripy/blob/main/src/keri/core/routing.py"
click node_exchange "https://github.com/weboftrust/keripy/blob/main/src/keri/peer/exchanging.py"
click node_database "https://github.com/weboftrust/keripy/blob/main/src/keri/db/basing.py"
click node_dbengine "https://github.com/weboftrust/keripy/blob/main/src/keri/db/dbing.py"
click node_acdc "https://github.com/weboftrust/keripy/blob/main/src/keri/acdc/messaging.py"
click node_ipex "https://github.com/weboftrust/keripy/blob/main/src/keri/acdc/ipexing.py"
click node_registry "https://github.com/weboftrust/keripy/blob/main/src/keri/vdr/eventing.py"
click node_credential "https://github.com/weboftrust/keripy/blob/main/src/keri/vc/proving.py"
click node_oobi "https://github.com/weboftrust/keripy/blob/main/src/keri/app/oobiing.py"
click node_mailbox "https://github.com/weboftrust/keripy/blob/main/src/keri/app/storing.py"
click node_http "https://github.com/weboftrust/keripy/blob/main/src/keri/app/httping.py"

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_crypto,node_counter,node_serialization,node_eventing,node_parser,node_router,node_exchange,node_database,node_dbengine toneBlue
class node_habitat,node_keymgmt,node_agent,node_multisig toneAmber
class node_acdc,node_ipex,node_registry,node_credential toneMint
class node_oobi,node_mailbox,node_http toneRose
class node_cli toneTeal
class node_controller toneIndigo
```

## Components

### Protocol Core

- [Crypto primitives](https://github.com/weboftrust/keripy/blob/main/src/keri/core/coring.py): `src/keri/core/coring.py`
- [CESR counters](https://github.com/weboftrust/keripy/blob/main/src/keri/core/counting.py): `src/keri/core/counting.py`
- [Serders](https://github.com/weboftrust/keripy/blob/main/src/keri/core/serdering.py): `src/keri/core/serdering.py`
- [Key events](https://github.com/weboftrust/keripy/blob/main/src/keri/core/eventing.py): `src/keri/core/eventing.py`
- [Stream parser](https://github.com/weboftrust/keripy/blob/main/src/keri/core/parsing.py): `src/keri/core/parsing.py`
- [Reply routing](https://github.com/weboftrust/keripy/blob/main/src/keri/core/routing.py): `src/keri/core/routing.py`
- [Peer exchange](https://github.com/weboftrust/keripy/blob/main/src/keri/peer/exchanging.py): `src/keri/peer/exchanging.py`
- [KERI database](https://github.com/weboftrust/keripy/blob/main/src/keri/db/basing.py): `src/keri/db/basing.py`
- [LMDB engine](https://github.com/weboftrust/keripy/blob/main/src/keri/db/dbing.py): `src/keri/db/dbing.py`

### Identity Runtime

- [Habitats](https://github.com/weboftrust/keripy/blob/main/src/keri/app/habbing.py): `src/keri/app/habbing.py`
- [Key management](https://github.com/weboftrust/keripy/blob/main/src/keri/app/keeping.py): `src/keri/app/keeping.py`
- [Witness agents](https://github.com/weboftrust/keripy/blob/main/src/keri/app/agenting.py): `src/keri/app/agenting.py`
- [Multisig](https://github.com/weboftrust/keripy/blob/main/src/keri/app/grouping.py): `src/keri/app/grouping.py`

### Credentials

- [ACDC messaging](https://github.com/weboftrust/keripy/blob/main/src/keri/acdc/messaging.py): `src/keri/acdc/messaging.py`
- [IPEX exchange](https://github.com/weboftrust/keripy/blob/main/src/keri/acdc/ipexing.py): `src/keri/acdc/ipexing.py`
- [Credential registry](https://github.com/weboftrust/keripy/blob/main/src/keri/vdr/eventing.py): `src/keri/vdr/eventing.py`
- [Credential proofs](https://github.com/weboftrust/keripy/blob/main/src/keri/vc/proving.py): `src/keri/vc/proving.py`

### Application Services

- [OOBI resolution](https://github.com/weboftrust/keripy/blob/main/src/keri/app/oobiing.py): `src/keri/app/oobiing.py`
- [Mailbox service](https://github.com/weboftrust/keripy/blob/main/src/keri/app/storing.py): `src/keri/app/storing.py`
- [HTTP transport](https://github.com/weboftrust/keripy/blob/main/src/keri/app/httping.py): `src/keri/app/httping.py`

### Other components

- [KLI commands](https://github.com/weboftrust/keripy/blob/main/src/keri/cli/kli.py): `src/keri/cli/kli.py`
- **Controller**

## Connections

- Controller → KLI commands: invokes
- KLI commands → Habitats: uses
- Habitats → Key management: uses (evidence: `src/keri/app/habbing.py`)
- Habitats → Key events: creates events (evidence: `src/keri/app/habbing.py`)
- Habitats → KERI database: stores state (evidence: `src/keri/app/habbing.py`)
- Habitats → Reply routing: routes replies (evidence: `src/keri/app/habbing.py`)
- Habitats → Stream parser: parses messages (evidence: `src/keri/app/habbing.py`)
- Witness agents → HTTP transport: uses transport (evidence: `src/keri/app/agenting.py`)
- Witness agents → Key events: processes events (evidence: `src/keri/app/agenting.py`)
- Witness agents → Stream parser: parses streams (evidence: `src/keri/app/agenting.py`)
- Witness agents → Peer exchange: forwards messages
- Multisig → Peer exchange: uses exchanges (evidence: `src/keri/app/grouping.py`)
- Multisig → Habitats: uses habitats (evidence: `src/keri/app/grouping.py`)
- Key events → Serders: uses serders (evidence: `src/keri/core/eventing.py`)
- Key events → Crypto primitives: uses primitives (evidence: `src/keri/core/eventing.py`)
- Key events → CESR counters: uses counters (evidence: `src/keri/core/eventing.py`)
- Key events → KERI database: stores events (evidence: `src/keri/core/eventing.py`)
- Serders → Crypto primitives: uses primitives (evidence: `src/keri/core/serdering.py`)
- Peer exchange → KERI database: stores evidence (evidence: `src/keri/peer/exchanging.py`)
- KERI database → LMDB engine: uses engine
- IPEX exchange → Peer exchange: uses exchanges (evidence: `src/keri/acdc/ipexing.py`)
- Credential registry → KERI database: uses database (evidence: `src/keri/vdr/eventing.py`)
- Controller → OOBI resolution: resolves identifiers
- Controller → Mailbox service: uses mailbox
- Controller → Credential proofs: issues credentials
