A Rust workspace for building secure, privacy-preserving applications using decentralised identity technologies. The TDK provides libraries and tools for DID resolution, DIDComm messaging, data integrity proofs, cryptographic primitives, and more.
Disclaimer: This project is provided "as is" without warranties or guarantees. By using this framework, users agree to assume all risks associated with its deployment and use, including implementing security and privacy measures in their applications. Affinidi assumes no liability for any issues arising from the use or modification of the project.
graph TD
TDK["affinidi-tdk<br/><i>Unified entry point</i>"]
subgraph Messaging["Affinidi Messaging"]
SDK["messaging-sdk"]
DIDCOMM["messaging-didcomm"]
CORE["messaging-core"]
TSP["affinidi-tsp"]
MEDIATOR["messaging-mediator"]
HELPERS["messaging-helpers"]
TEXTCLIENT["messaging-text-client"]
end
subgraph Resolver["Affinidi DID Resolver"]
CACHESDK["resolver-cache-sdk"]
CACHESERVER["resolver-cache-server"]
COMMON["did-common"]
TRAITS["resolver-traits"]
DIDSCID["did-scid"]
DIDEXAMPLE["did-example"]
end
subgraph Common["TDK Common Libraries"]
CRYPTO["affinidi-crypto"]
ENCODING["affinidi-encoding"]
SECRETS["secrets-resolver"]
AUTH["did-authentication"]
TDKCOMMON["tdk-common"]
DI["data-integrity"]
RDF["rdf-encoding"]
end
MP["affinidi-meeting-place"]
TDK --> SDK
TDK --> MP
TDK --> DI
TDK --> CACHESDK
TDK --> DIDCOMM
TDK --> AUTH
TDK --> SECRETS
TDK --> CRYPTO
TDK --> TDKCOMMON
TDK --> COMMON
SDK --> DIDCOMM
SDK --> CACHESDK
DIDCOMM --> CORE
TSP --> CORE
MEDIATOR --> SDK
MEDIATOR --> TSP
HELPERS --> SDK
HELPERS --> TSP
TEXTCLIENT --> SDK
MP --> AUTH
MP --> TDKCOMMON
CACHESDK --> COMMON
CACHESDK --> TRAITS
CACHESERVER --> CACHESDK
DI --> CRYPTO
DI --> RDF
SECRETS --> CRYPTO
SECRETS --> ENCODING
AUTH --> SECRETS
TDKCOMMON --> AUTH
TDKCOMMON --> DI
affinidi-tdk — Unified Entry Point
A single crate that re-exports the core TDK libraries with feature flags so you can depend on one crate and enable only what you need.
Secure, private messaging built on DIDComm v2 and TSP.
| Crate | Description |
|---|---|
affinidi-messaging-sdk |
SDK for integrating Affinidi Messaging into your application |
affinidi-messaging-didcomm |
DIDComm v2.1 protocol implementation for Rust |
affinidi-messaging-core |
Protocol-agnostic messaging traits |
affinidi-messaging-mediator |
Mediator & relay service (DIDComm and TSP via feature flags) |
affinidi-messaging-helpers |
Setup tools, environment config, and examples |
affinidi-messaging-text-client |
Terminal-based DIDComm chat client |
| Crate | Description |
|---|---|
affinidi-tsp |
TSP implementation with HPKE-Auth encryption and CESR encoding |
affinidi-cesr |
CESR codec for binary message encoding |
High-performance DID resolution with local and network caching (250k+ resolutions/sec cached).
| Crate | Description |
|---|---|
affinidi-did-resolver-cache-sdk |
SDK for local and network DID resolution with caching |
affinidi-did-resolver-cache-server |
Standalone network DID resolution server |
affinidi-did-common |
DID Document types, builders, and common utilities |
affinidi-did-resolver-traits |
Pluggable resolver traits for custom DID methods |
did-scid |
Self-Certifying Identifier DID method |
did-example |
Example DID method for testing |
Shared building blocks used across the workspace.
| Crate | Description |
|---|---|
affinidi-crypto |
Cryptographic primitives — key generation, JWK, Ed25519, P-256, secp256k1 |
affinidi-encoding |
Multibase and multicodec encoding utilities |
affinidi-secrets-resolver |
DID secret management and key resolution |
affinidi-did-authentication |
Authentication via DID ownership proofs |
affinidi-tdk-common |
Shared structs, TLS config, and cross-crate utilities |
affinidi-data-integrity |
W3C Data Integrity proofs (eddsa-jcs-2022, eddsa-rdfc-2022) |
affinidi-rdf-encoding |
RDFC-1.0 canonicalization and JSON-LD expansion |
Discover and connect with others using DIDs and DIDComm in a secure and private way.
- Rust 1.90.0+ (2024 Edition)
- Redis 8.0+ (required for the messaging mediator)
- Docker (recommended for running Redis)
Add the unified TDK crate to your project:
[dependencies]
affinidi-tdk = "0.5"Or depend on individual crates for finer control:
[dependencies]
affinidi-did-resolver-cache-sdk = "0.8"
affinidi-messaging-sdk = "0.15"
affinidi-data-integrity = "0.4"use affinidi_did_resolver_cache_sdk::{config::ClientConfigBuilder, DIDCacheClient};
let config = ClientConfigBuilder::default().build();
let resolver = DIDCacheClient::new(config).await?;
let result = resolver.resolve("did:key:z6Mkr...").await?;
println!("DID Document: {:#?}", result.doc);use affinidi_messaging_sdk::{ATM, config::Config};
let config = Config::builder()
.with_my_did("did:peer:2...")
.with_atm_did("did:peer:2...")
.build()?;
let mut atm = ATM::new(config, vec![]).await?;
atm.send_ping("did:peer:2...", true, true).await?;If you face any issues or have suggestions, please don't hesitate to contact us using this link.
If you have a technical issue, you can open an issue directly in GitHub. Please include a title and clear description, as much relevant information as possible, and a code sample or executable test case demonstrating the expected behaviour.
Want to contribute? Head over to our CONTRIBUTING guidelines.
This project is licensed under the Apache-2.0 license.