Skip to main content

select_protocol

Function select_protocol 

Source
pub fn select_protocol(
    ours: &ServiceCapabilities,
    theirs: &ServiceCapabilities,
    counterparty_did: &str,
) -> Result<ProtocolMatch, VtaError>
Expand description

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

Returns VtaError::NoMatchingProtocol — carrying both advertised sets — when the intersection is empty, so the CLI can show the operator what each side offers and which transport to enable. Never silently downgrades past what a peer advertises.