Expand description
DIDComm v2.1 transport binding for the Trust Tasks framework.
Wraps affinidi-messaging-didcomm so Trust Task documents can ride
inside a DIDComm Message, get authcrypt’d or anoncrypt’d in a JWE,
and survive any DIDComm-aware transport (mediator pickup, raw HTTPS
POST, message queue, paper handoff for that matter).
§Binding URI
https://trusttasks.org/binding/didcomm/0.1
§Wire shape
Each Trust Task document is packed into a DIDComm v2.1 Message
whose type is the framework-reserved URI:
https://trusttasks.org/binding/didcomm/0.1/envelopeThe body of that DIDComm message is the full TrustTask<P> JSON.
The outer envelope is then authcrypt’d (sender-authenticated +
encrypted to the recipient) or anoncrypt’d (encrypted-only) before
transmission. The authcrypt’d UnpackResult::Encrypted carries a
verified sender_kid (a DID URL with a key fragment); the binding
strips the fragment and uses the DID as the framework’s
transport-authenticated issuer for SPEC.md §4.8.1 precedence.
§Sketch
use affinidi_messaging_didcomm::{DIDCommAgent, identity::PrivateIdentity};
use trust_tasks_didcomm::{pack_trust_task, unpack_trust_task};
// alice (producer):
let mut agent = DIDCommAgent::new();
agent.add_identity(alice.clone());
agent.add_peer(bob.to_resolved());
let wire = pack_trust_task(&doc, &agent, &alice.did, &bob.did)?;
// bob (consumer):
let mut agent = DIDCommAgent::new();
agent.add_identity(bob.clone());
agent.add_peer(alice.to_resolved());
let (doc, handler) = unpack_trust_task::<MyPayload>(&wire, &agent)?;Structs§
- Didcomm
Handler - A
TransportHandlerfor one DIDComm v2.1 exchange.
Enums§
- Didcomm
Error - Failure modes the DIDComm binding can produce. Most variants map
cleanly onto a SPEC.md §8.3
StandardCodewhen surfaced as anunpackfailure on the consumer side; theSelf::into_reject_reasonconvenience does the mapping for callers that want to fold this straight into the framework’sRejectReason.
Constants§
- BINDING_
URI - Stable identifier for the DIDComm binding, per SPEC.md §9.2.
- ENVELOPE_
TYPE - DIDComm
typeURI for Trust Tasks envelopes.
Functions§
- pack_
trust_ task - Wrap a Trust Task document in a DIDComm v2.1 envelope and authcrypt
it for
recipient_did. - unpack_
trust_ task - Unwrap a DIDComm v2.1 envelope produced by
pack_trust_taskinto a typedTrustTask<P>plus aDidcommHandlerpopulated with the verified peer DID.