Expand description
Transport-agnostic query client for the Affinidi Trust Registry.
Queries are TRQP authorization/recognition checks carried as Trust Task
documents (registry/authorization/0.1, registry/recognition/0.1 from
trust_tasks_rs::specs::registry) — the same contract the registry
serves over every transport. The document is the protocol; a transport is
only a pipe that moves one request document and returns the peer’s reply
document (see TrqlTransport).
Three bindings are provided behind features:
https(default) —HttpsTransport:POST <registry>/trust-tasks, thetrust-tasks-httpswire contract.didcomm— [DidcommTransport]: thetrust-tasks-didcommenvelope over an ATM mediator websocket.tsp— [TspTransport]: thetrust-tasks-tspenvelope sealed in a TSPDirectmessage, multiplexed on the same mediator websocket.
Every reply is correlated to its request (threadId == request id) and
a reply that cannot be parsed is surfaced as a contract error, never as a
transport failure. A registry rejection arrives as a typed
TrqlError::Rejected carrying the machine-readable trust-task-error
code.
use std::sync::Arc;
use trql_client::{HttpsTransport, HttpsTransportConfig, TrqlClient, TrqpQuery};
let transport = HttpsTransport::new(HttpsTransportConfig::new("http://localhost:3232"))?;
let client = TrqlClient::new(Arc::new(transport), "did:webvh:...registry");
let response = client
.authorization(TrqpQuery::new(
"did:webvh:...signer", // entity
"did:webvh:...authority", // authority
"git.commit.sign", // action
"openvtc", // resource
))
.await?;
if response.authorized { /* ... */ }Modules§
- payloads
- The generated request/response payload types this client speaks, re-exported
so consumers don’t need a direct
trust-tasks-rsdependency for the basics.
Structs§
- Https
Transport TrqlTransportover thetrust-tasks-httpsbinding.- Https
Transport Config - Configuration for
HttpsTransport. - Service
Capabilities - The transports a registry advertises, parsed from its DID document by
service
type. - Transport
Choice - The transport chosen for a registry, and where to send.
- Trql
Client - Transport-agnostic Trust Registry query client.
- Trqp
Query - The TRQP 4-tuple every registry query is keyed on, plus the optional evaluation context.
Enums§
- Transport
Kind - Which wire a
TrqlTransportspeaks. - Trql
Error - Errors returned by
crate::TrqlClientandcrate::TrqlTransportimplementations.
Constants§
- DIDCOMM_
SERVICE_ TYPE - DID-document service
typefor a DIDComm v2 mediator endpoint (W3C). - PREFERENCE_
ORDER - Transports in descending preference order: TSP, then DIDComm, then HTTPS.
- REST_
SERVICE_ TYPE - DID-document service
typefor a Trust Registry’s REST/TRQP surface. - REST_
SERVICE_ TYPES - Every service
typethat denotes a REST endpoint, in match order. - TSP_
SERVICE_ TYPE - DID-document service
typefor a TSP transport endpoint. - VTA_
REST_ SERVICE_ TYPE - A VTA’s REST API service
type.
Traits§
- Trql
Transport - A pipe that carries one Trust Task request and returns the peer’s reply
document — either the
#responsesuccess document or atrust-task-errordocument. Interpretation of the reply (correlation, error mapping, payload typing) belongs tocrate::TrqlClient, so bindings cannot diverge on semantics.