Skip to main content

Crate trust_tasks_https

Crate trust_tasks_https 

Source
Expand description

HTTPS transport binding for the Trust Tasks framework.

Implements SPEC.md §9 over HTTP/1.1 using axum on the server side and reqwest on the client side. The binding authenticates parties via an Authorization: Bearer <token> header that an Auth implementation maps to a Verifiable Identifier.

The server and client are secure by default — attribution required, the §7.2 item 11 duplicate-execution record and the consequential freshness bound on, response binding checked by the client — and those defaults are what a production deployment runs. What is demo-grade is one implementation of Auth: BearerAuth, a static token map. A deployment plugs in its own Auth (or JwtBearerAuth, behind the jwt feature) and terminates TLS in front of the server.

§Binding URI

https://trusttasks.org/binding/https/0.2

§On the wire

POST /trust-tasks HTTP/1.1
Host: example.com
Content-Type: application/json
Authorization: Bearer <token>

{
  "id": "...",
  "type": "https://trusttasks.org/spec/acl/grant/0.1",
  "issuer": "did:web:org.example",
  "recipient": "did:web:maintainer.example",
  "issuedAt": "2026-05-17T10:00:00Z",
  "payload": { ... }
}

The server maps the bearer token to a VID, runs the §7.2 / §4.8.1 consumer-side validation pipeline (cross-checking the in-band issuer against the authenticated sender), and dispatches the document to the handler registered for its type URI.

§Cargo features

  • server (default) — pulls in axum + tokio + tower; exposes HttpsServer.
  • client (default) — pulls in reqwest; exposes HttpsClient.

Disable one or the other if your binary only acts as a producer or only as a consumer.

§Versioning

This crate exposes trust-tasks-rs types in its own public API, so a breaking change there breaks this crate’s callers even when nothing here changes. cargo-semver-checks cannot catch that: it compares each crate’s rustdoc against that crate’s own published baseline, and does not track type identity across dependency versions. The crates that share trust-tasks-rs in their public API are therefore released as one compatibility unit with a single shared version — see version_group in release-plz.toml.

Structs§

BearerAuth
Static HashMap-backed Auth implementation. Constructed from a list of (token, vid) pairs.
HttpsClientclient
HTTPS Trust Tasks client.
HttpsClientBuilderclient
Builder for HttpsClient.
HttpsHandler
A TransportHandler for a single HTTPS exchange.
HttpsServerserver
An HTTPS Trust Tasks server.
HttpsServerBuilderserver
Builder for HttpsServer.
RequestContextserver
Context handed to every spec handler — the transport-authenticated peer (when present), convenience accessors for the inbound document’s metadata, and the SPEC §4.8.1-resolved party identities.

Enums§

ClientErrorclient
Errors raised by HttpsClient::send.
TransportError
Transport-level failures: I/O, broken HTTP framing, body that doesn’t even parse as JSON. Distinct from trust-task-error documents, which a well-behaved peer returns inside an HTTP response body and which this crate surfaces as typed values via crate::ClientError.

Constants§

BINDING_URI
Stable identifier for the HTTPS binding, per SPEC.md §9.2.
DEFAULT_ALLOWED_DID_METHODSserver
The DID methods a server with a verifier accepts in proof.verificationMethod when neither HttpsServerBuilder::allowed_did_methods nor HttpsServerBuilder::allow_any_did_method was called: did:key, whose key is in the identifier, so verifying it never leaves the process.
DEFAULT_CONNECT_TIMEOUTclient
Default connection-establishment timeout.
DEFAULT_MAX_CONCURRENT_REQUESTSserver
Default ceiling on concurrently-executing requests, applied by HttpsServer::into_router. Bounds the memory a flood of slow senders can pin. Override with HttpsServerBuilder::max_concurrent_requests.
DEFAULT_MAX_RESPONSE_BYTESclient
Default cap on a response body: 256 KiB, the request cap the bundled server applies. A trust-task response is one small JSON document.
DEFAULT_REQUEST_TIMEOUTserver
Default per-request wall-clock budget applied by HttpsServer::into_router. A Trust Task exchange is one small JSON round trip; a request still in flight after this is wedged, and holding the connection open is exactly what a slowloris wants. Override with HttpsServerBuilder::request_timeout.
DEFAULT_TIMEOUTclient
Default end-to-end request timeout. A trust-task exchange is one small JSON round trip; a peer that takes longer than this is down or wedged.
MAX_BODY_BYTESserver
Maximum accepted request-body size (SPEC §12.2), applied by HttpsServer::into_router. Trust Task payloads are small; 256 KiB is generous headroom while bounding pre-auth memory use. Callers needing a different bound can rebuild the router with their own DefaultBodyLimit layer — which is why the value is public: a caller replacing the layer wants to know what it is replacing.

Traits§

Auth
Resolves bearer tokens to Verifiable Identifiers.

Functions§

status_for_code
Map a TrustTaskCode to a numeric HTTP status code.