Skip to main content

Crate invoance

Crate invoance 

Source
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

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/1 canonical 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§

ClientBuilder
Fluent builder for InvoanceClient.
ClientConfig
Client configuration passed to InvoanceClient::from_config or built via InvoanceClient::builder.
InvoanceClient
The top-level Invoance API client.
RequestContext
Request context attached to an Error (HTTP method + path).
ValidationResult
Outcome of InvoanceClient::validate.

Enums§

ApiErrorKind
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.