Skip to main content

Module matching

Module matching 

Source
Expand description

Bidirectional transport-protocol matching from advertised DID-document services.

When two parties communicate, the protocol used is the highest-preference one both advertise in their DID documents — TSP > DIDComm > REST (docs/05-design-notes/tsp-enablement.md §3, §11). Services are matched on their type (TSPTransport / DIDCommMessaging / VTARest), never on the #id fragment, which is an arbitrary label (D9 — the OWF reference TSP impl names its id #tsp-transport, Affinidi names it #tsp; same type). If the advertised sets don’t intersect, select_protocol returns VtaError::NoMatchingProtocol carrying both sides’ advertised sets.

This is pure, side-effect-free logic over an already-resolved DID document serde_json::Value. DID resolution itself is the caller’s job; so is the second hop for TSP/DIDComm (resolving the returned mediator DID to its transport URL).

Structs§

ProtocolMatch
The chosen protocol and the counterparty endpoint to route to for it.
ServiceCapabilities
The transport services a party advertises in its DID document, parsed by service type. Each field holds the endpoint the SDK would route to for that protocol:

Enums§

Protocol
A transport protocol, in workspace preference order: TSP, then DIDComm, then REST. Ord follows that order — Tsp is the smallest (most preferred) — so Protocol::PREFERENCE_ORDER is ascending.

Constants§

DIDCOMM_SERVICE_TYPE
DID-document service type for a DIDComm v2 mediator endpoint (W3C).
REST_SERVICE_TYPE
DID-document service type for the VTA REST endpoint. Kept in sync with vta_service::operations::protocol::document::REST_SERVICE_TYPE.
REST_SERVICE_TYPES
Every service type that denotes a REST endpoint, in match order.
TRQP_REST_SERVICE_TYPE
DID-document service type for a Trust Registry’s REST/TRQP surface.
TSP_SERVICE_TYPE
DID-document service type for a TSP transport endpoint. TSPTransport is the OpenWallet-Foundation-Labs reference-implementation convention (affinidi_tsp’s DID-backed VID resolver matches on it); the ToIP TSP spec names no DID-document service type. Kept in sync with vta_service::operations::protocol::document::TSP_SERVICE_TYPE.

Functions§

select_protocol
Pick the protocol to use with a counterparty: the highest-preference one (TSP > DIDComm > REST) present in both ours and theirs.