Skip to main content

Crate trql_client

Crate trql_client 

Source
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, the trust-tasks-https wire contract.
  • didcomm — [DidcommTransport]: the trust-tasks-didcomm envelope over an ATM mediator websocket.
  • tsp — [TspTransport]: the trust-tasks-tsp envelope sealed in a TSP Direct message, 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-rs dependency for the basics.

Structs§

HttpsTransport
TrqlTransport over the trust-tasks-https binding.
HttpsTransportConfig
Configuration for HttpsTransport.
ServiceCapabilities
The transports a registry advertises, parsed from its DID document by service type.
TransportChoice
The transport chosen for a registry, and where to send.
TrqlClient
Transport-agnostic Trust Registry query client.
TrqpQuery
The TRQP 4-tuple every registry query is keyed on, plus the optional evaluation context.

Enums§

TransportKind
Which wire a TrqlTransport speaks.
TrqlError
Errors returned by crate::TrqlClient and crate::TrqlTransport implementations.

Constants§

DIDCOMM_SERVICE_TYPE
DID-document service type for a DIDComm v2 mediator endpoint (W3C).
PREFERENCE_ORDER
Transports in descending preference order: TSP, then DIDComm, then HTTPS.
REST_SERVICE_TYPE
DID-document service type for a Trust Registry’s REST/TRQP surface.
REST_SERVICE_TYPES
Every service type that denotes a REST endpoint, in match order.
TRUST_REGISTRY_SERVICE_TYPE
DID-document service type for a Trust Registry, per the ToIP Trust Registry Service Profile.
TSP_SERVICE_TYPE
DID-document service type for a TSP transport endpoint.
VTA_REST_SERVICE_TYPE
A VTA’s REST API service type.

Traits§

TrqlTransport
A pipe that carries one Trust Task request and returns the peer’s reply document — either the #response success document or a trust-task-error document. Interpretation of the reply (correlation, error mapping, payload typing) belongs to crate::TrqlClient, so bindings cannot diverge on semantics.

Functions§

registry_referral
The DID this document refers a TRQP query on to, if it refers at all.