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§
- Protocol
Match - The chosen protocol and the counterparty endpoint to route to for it.
- Service
Capabilities - 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.
Ordfollows that order —Tspis the smallest (most preferred) — soProtocol::PREFERENCE_ORDERis ascending.
Constants§
- DIDCOMM_
SERVICE_ TYPE - DID-document service
typefor a DIDComm v2 mediator endpoint (W3C). - REST_
SERVICE_ TYPE - DID-document service
typefor the VTA REST endpoint. Kept in sync withvta_service::operations::protocol::document::REST_SERVICE_TYPE. - REST_
SERVICE_ TYPES - Every service
typethat denotes a REST endpoint, in match order. - TRQP_
REST_ SERVICE_ TYPE - DID-document service
typefor a Trust Registry’s REST/TRQP surface. - TSP_
SERVICE_ TYPE - DID-document service
typefor a TSP transport endpoint.TSPTransportis 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 withvta_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
oursandtheirs.