Expand description
Official Rust SDK for the Invoance compliance API — cryptographic proof, document anchoring, and AI attestation.
The SDK is async (built on tokio + reqwest). Construct a client, then
reach each product surface through a resource accessor:
use invoance::InvoanceClient;
use invoance::models::IngestEventParams;
use serde_json::json;
let client = InvoanceClient::new()?; // reads INVOANCE_API_KEY from env
let event = client
.events()
.ingest(IngestEventParams {
event_type: "policy.approval".into(),
payload: json!({ "policy_id": "pol_001", "decision": "approved" })
.as_object()
.unwrap()
.clone(),
..Default::default()
})
.await?;
println!("{}", event.event_id);§Error handling
Every fallible call returns Result<T, Error>. Classify with the
boolean predicates (is_authentication(), is_quota_exceeded(), …) or by
matching the Error variants.
§Offline crypto helpers
audit_verify::verify_audit_event— verify an audit event’s Ed25519 signature without trusting the server.audit_canonical— theinvoance.audit/1canonicalizer.resources::content_idempotency_key— derive a content-stable idempotency key from a request body.
Re-exports§
pub use audit_canonical::canonical_audit_bytes;pub use audit_canonical::normalize_ts;pub use audit_canonical::payload_hash_hex;pub use audit_canonical::AUDIT_SCHEMA_ID;pub use audit_verify::verify_audit_event;pub use audit_verify::AuditVerifyResult;pub use audit_verify::KeySource;pub use resources::content_idempotency_key;
Modules§
- audit_
canonical invoance.audit/1canonical serializer (client-side).- audit_
verify - Offline, client-side signature verification for audit events.
- models
- Wire model structs. Field names match the API JSON keys exactly.
- resources
- Resource handles reachable from
InvoanceClient.
Structs§
- Client
Builder - Fluent builder for
InvoanceClient. - Client
Config - Client configuration passed to
InvoanceClient::from_configor built viaInvoanceClient::builder. - Invoance
Client - The top-level Invoance API client.
- Request
Context - Request context attached to an
Error(HTTP method + path). - Validation
Result - Outcome of
InvoanceClient::validate.
Enums§
- ApiError
Kind - The kind of an API-level error, derived from the HTTP status code.
- Error
- The unified error type for every fallible SDK operation.
Constants§
- SDK_
VERSION - The published version of this SDK. Kept in sync with
Cargo.toml.