Skip to main content

Installation

From 8.0.0, VerificationResponse has a public attestation field (Option<String>). It holds the server’s ES256 attestation on a VERIFIED answer. If you build a VerificationResponse with a struct literal, for example in tests, add attestation: None. See Upgrading to 8.0.0.

Quick start

Configuration

Use QWEDClient::with_options to point the client at your self-hosted QWED server or change the timeout. There is no hosted QWED API, so set the base URL to the server you run.

Reading a result

Every verification method returns a VerificationResponse that models the server’s DiagnosticResult envelope.

Gate on is_admitted()

Use is_admitted() to decide whether to act on a result. Don’t gate on status alone. Verified means the engine reached a deterministic answer, not that the claim holds. 2 + 2 = 5 returns Verified with admission Blocked because it’s proven false. Unsafe code returns Verified with admission Blocked because it’s proven unsafe. is_admitted() returns true only when all of these hold:
  • admission is Some(Admit)
  • status is Verified
  • proof_ref is set
A missing or Unknown admission is never admitted. Endpoints that make no admission decision (/verify/logic, /verify/fact, /verify/rag, /verify/process, and batch logic and fact items) are therefore never admitted. The verified field that /verify/rag and /verify/process send is their guard’s own result, not an admission. It stays in extra["verified"] and developer_fields.
qwed::is_verified() is deprecated and returns is_admitted(). A response body that doesn’t match the envelope returns Error::Serialization.

Methods

verify

verify_math

verify_logic

verify_code

verify_fact

verify_sql

verify_batch

verify_batch returns a BatchResponse that mirrors the server’s batch job. Each item’s verification answer is in item.result. Call is_admitted() on each BatchResult item. There is no aggregate summary. Math, code, and SQL items carry their route’s admission, so a proven item can be admitted. Natural-language items always carry BLOCKED. Logic and fact items make no decision, so they’re never admitted.
A batch SQL item needs params.schema_ddl. The server fails an item without it with Missing 'schema_ddl'. The SDK’s batch items send only a query and a type, so verify SQL with verify_sql instead of in a batch.

Types

Error handling