Rust
Verify Syncanix agent intents in Rust — Axum, Actix Web, and Tower — with a local HMAC check on every tool call.
The Rust SDK provides extractors and layers for Axum, Actix Web, and Tower over a shared verify core. The extractor verifies the header and rejects failures with 403 before your handler runs.
Install
Add the package to your project with your language's package manager.
cargo add syncanix-sdk-rustConfigure the secret
The SDK verifies intents with your tenant's intent-signing secret. Store it as an environment variable — never commit it to source control — and load it where you register the SDK.
export SYNCANIX_INTENT_SECRET="your-intent-signing-secret"Verify intents
Register the SDK on the routes that expose agent actions. It verifies the X-Syncanix-Intent header before your handler runs, rejects any invalid or replayed call with a 403, and hands your handler the verified payload — including the acting tenant and user.
use std::sync::Arc;
use axum::{Extension, Router, routing::post, Json};
use syncanix_sdk_rust::axum::{SyncanixIntent, SyncanixConfig};
async fn refund_handler(SyncanixIntent(intent): SyncanixIntent) -> Json<serde_json::Value> {
Json(serde_json::json!({ "tenantId": intent.tenant_id }))
}
let config = Arc::new(SyncanixConfig::new(std::env::var("SYNCANIX_INTENT_SECRET").unwrap()));
let app: Router<()> = Router::new()
.route("/tools/refund", post(refund_handler))
.layer(Extension(config));