affinidi-tdk-common 0.6.7

Common utilities for Affinidi Trust Development Kit.
docs.rs failed to build affinidi-tdk-common-0.6.7
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: affinidi-tdk-common-0.5.2

affinidi-tdk-common

Crates.io Documentation Rust License

Shared building blocks for Affinidi Trust Development Kit (TDK) crates.

Overview

The crate is organised around four core concepts:

Module Purpose
[config] TDKConfig + TDKConfigBuilder — typed configuration, owns optional DID resolver / secrets resolver / environment-file path / custom auth handlers.
[TDKSharedState] (lib.rs) Runtime container exposing the DID resolver, secrets resolver, HTTPS client, and AuthenticationCache via accessor methods. Cheap to clone.
[profiles] + [environments] Serialisable identity profiles + on-disk grouping (environments.json).
[secrets] KeyringStore — handle into the OS native credential store (macOS Keychain, Windows Credential Manager, freedesktop Secret Service).
[tasks::authentication] AuthenticationCache — shared, channel-driven cache for DID Auth tokens.

[TDKError] is the single error funnel; consumers convert it to their own error types via From<TDKError> impls.

Installation

[dependencies]
affinidi-tdk-common = "0.6"

Usage

use affinidi_tdk_common::{TDKSharedState, config::TDKConfig};

# async fn run() -> Result<(), affinidi_tdk_common::errors::TDKError> {
let config = TDKConfig::builder().build()?;
let state = TDKSharedState::new(config).await?;

// ...use state.client(), state.did_resolver(), etc...

// Graceful shutdown:
state.shutdown().await;
# Ok(())
# }

Storing profile secrets in the OS keyring

use affinidi_tdk_common::secrets::KeyringStore;

# fn run(secrets: &[affinidi_secrets_resolver::secrets::Secret]) -> Result<(), affinidi_tdk_common::errors::TDKError> {
let store = KeyringStore::new("my-app");
store.save("did:example:alice", secrets)?;
let loaded = store.read("did:example:alice")?;
store.delete("did:example:alice")?;
# Ok(())
# }

Platform support

The keyring backend is selected at compile time:

Target Backend
macOS apple-native-keyring-store (Keychain)
iOS apple-native-keyring-store (Protected Data)
Windows windows-native-keyring-store (Credential Manager)
Linux / FreeBSD / OpenBSD dbus-secret-service-keyring-store (Secret Service over D-Bus)

Migrating from 0.5.x

See CHANGELOG.md for the full breaking-change list and side-by-side migration snippets.

Key dependencies

This crate aggregates several TDK libraries:

Related crates

License

Apache-2.0