Skip to main content

trust_tasks_proof/
lib.rs

1//! Pluggable [`ProofVerifier`](trust_tasks_rs::ProofVerifier)
2//! implementations for the Trust Tasks framework.
3//!
4//! The framework's [`ProofVerifier`](trust_tasks_rs::ProofVerifier) trait is
5//! the seam where cryptosuite implementations plug in; this crate is the
6//! umbrella that hosts those implementations behind Cargo features so a
7//! single dependency line opts in to a specific backend without dragging
8//! in the others.
9//!
10//! ## Backends
11//!
12//! | Cargo feature | Module                    | Backed by                              |
13//! |---------------|---------------------------|----------------------------------------|
14//! | `affinidi` ✱  | [`affinidi`]              | `affinidi-data-integrity` (EdDSA suites) |
15//!
16//! ✱ = enabled by default. Disable default features and opt in to the
17//! backends you want via `default-features = false` + an explicit
18//! `features = [...]` list.
19//!
20//! ## Quickstart (`affinidi` backend)
21//!
22//! ```rust,ignore
23//! use trust_tasks_proof::affinidi::Verifier;
24//! use trust_tasks_rs::ProofVerifier;
25//!
26//! // did:key only — offline, no I/O. Good for tests and self-issued docs.
27//! let verifier = Verifier::for_did_key();
28//! verifier.verify(&inbound_doc).await?;
29//! ```
30//!
31//! Producers sign with the same backend's
32//! [`affinidi::sign_trust_task`] — defaults to `eddsa-jcs-2022` /
33//! `assertionMethod` and enforces the issuer↔verificationMethod binding
34//! at sign time, so its output verifies with the stock
35//! [`affinidi::Verifier`] by construction:
36//!
37//! ```rust,ignore
38//! use trust_tasks_proof::affinidi::{sign_trust_task, SignOptions};
39//!
40//! let signed = sign_trust_task(&doc_value, &secret, SignOptions::new()).await?;
41//! ```
42
43#![warn(missing_docs)]
44#![warn(rust_2018_idioms)]
45
46#[cfg(feature = "affinidi")]
47pub mod affinidi;