Authora Rust SDK
Official Rust client library for the Authora agent authorization platform.
Requirements
- Rust 2021 edition (MSRV 1.70)
- Async runtime: Tokio
Installation
Add to your Cargo.toml:
[]
= "0.2"
= { = "1", = ["rt-multi-thread", "macros"] }
Find your credentials
Several SDK methods require identifiers that are generated when you sign up:
| Value | Format | Where to find it |
|---|---|---|
| API Key | authora_live_... |
Account page > API Keys tab |
| Workspace ID | ws_... |
Account page > Profile tab > SDK Quick Start |
| User ID | usr_... |
Account page > Profile tab > User ID |
| Organization ID | org_... |
Account page > Profile tab > Organization ID |
The created_by parameter used when creating agents or API keys is your User ID (usr_...).
Quick start
use ;
async
Custom configuration
use Duration;
use AuthoraClient;
let client = builder
.base_url
.timeout
.build?;
Edge Endpoints
For high-availability scenarios, Authora provides an edge proxy at https://edge.authora.dev powered by Cloudflare Workers. Agent identity verification, JWT validation, and public key lookups are served from globally distributed edge caches with 24-hour survivability if the origin is unreachable. The edge proxy runs in parallel with the primary API -- no client changes required.
Resource modules
The client exposes one method per resource area. Each returns a lightweight handle that borrows the underlying HTTP client:
| Method | Resource | Endpoints |
|---|---|---|
client.agents() |
Agents | 8 |
client.roles() |
Roles + Assignments | 8 |
client.permissions() |
Permission Checks | 3 |
client.delegations() |
Delegations | 6 |
client.policies() |
Policies | 12 |
client.mcp() |
MCP Servers / Tools | 7 |
client.audit() |
Audit Events | 4 |
client.notifications() |
Notifications | 4 |
client.webhooks() |
Webhooks | 4 |
client.alerts() |
Alerts | 4 |
client.api_keys() |
API Keys | 3 |
client.organizations() |
Organizations | 3 |
client.workspaces() |
Workspaces | 3 |
client.approvals() |
Approval Challenges | 13 |
client.credits() |
Credit Balance | 3 |
client.user_delegations() |
User Delegation Grants | 11 |
Total: 90 endpoints
Examples
Check a permission
use CheckPermissionInput;
let result = client.permissions.check.await?;
if result.allowed == Some
List agents
use ListAgentsInput;
let page = client.agents.list.await?;
for agent in &page.data
Create a delegation
use ;
let delegation = client.delegations.create.await?;
Manage policies
use CreatePolicyInput;
let policy = client.policies.create.await?;
Error handling
All methods return Result<T, AuthoraError>. The error enum covers:
AuthoraError::Api-- Non-success HTTP status with message and optional error codeAuthoraError::Authentication-- 401 / 403 responsesAuthoraError::NotFound-- 404 responsesAuthoraError::RateLimit-- 429 responsesAuthoraError::Timeout-- Request timeoutAuthoraError::Network-- Connection / transport errors (wrapsreqwest::Error)AuthoraError::Serialization-- JSON serialization / deserialization failures
JSON field mapping
Rust structs use snake_case fields. Serde automatically maps them to/from camelCase
for the Authora API via #[serde(rename_all = "camelCase")].
Agent Runtime
The AgentRuntime provides a full async agent runtime with Ed25519 signed requests, tokio RwLock-protected permission caching, delegation, and MCP tool calls.
use ;
use ;
async
Cryptography
Ed25519 key generation, signing, and verification via ed25519_dalek.
use ;
use ;
// Generate Ed25519 keypair (base64url encoded)
let key_pair = generate_key_pair;
// Sign and verify
let signature = sign?;
let valid = verify;
// Build canonical signature payload
let payload = build_signature_payload;
License
MIT