Truthlinked SDK (Rust)
Official Rust SDK for Truthlinked Authority Fabric - Zero-Trust Authorization System
Features
- ✅ Type-safe API - Compile-time guarantees, no runtime surprises
- ✅ Secure by default - HTTPS-only, TLS validation, memory protection
- ✅ Production-ready - Connection pooling, timeouts, error handling
- ✅ Zero server coupling - Standalone SDK, no dependencies on server code
- ✅ Memory safe - License keys automatically zeroized
- ✅ No credential leakage - Safe error messages, redacted logging
Installation
Add to your Cargo.toml:
[]
= "0.1"
= { = "1.0", = ["full"] }
Quick Start
use Client;
async
Examples
Run examples with your license key:
# Health check
# Shadow mode (breach detection)
# Compliance reports
# Usage statistics
API Reference
Client Creation
let client = new?;
Security:
- Enforces HTTPS (rejects HTTP)
- Validates TLS certificates
- 30-second timeout
- Connection pooling
Health Check
let health = client.health.await?;
No authentication required.
Shadow Mode (Breach Detection)
// Get breach detections
let decisions = client.get_shadow_decisions.await?;
// Replay IAM logs
let result = client.replay_iam_logs.await?;
Supported adapters:
aws-cloudtrail- AWS CloudTrail logsazure-ad- Azure AD logsgcp-audit- GCP Audit logsokta- Okta System Logauth0- Auth0 logs
Token Exchange
use Rng;
// Generate nonce and channel binding
let nonce: = thread_rng.gen;
let channel_binding: = thread_rng.gen;
// Exchange SSO token for AF token
let response = client.exchange_token.await?;
println!;
Requires: Professional tier or higher
Token Validation
let result = client.validate_token.await?;
if result.valid
Compliance Reports
// SOX compliance
let sox = client.get_sox_report.await?;
println!;
println!;
println!;
// PCI-DSS compliance
let pci = client.get_pci_report.await?;
println!;
println!;
Audit Logs
let logs = client.get_audit_logs.await?;
for log in logs
Usage Statistics
let usage = client.get_usage.await?;
println!;
println!;
println!;
Error Handling
use TruthlinkedError;
match client.get_shadow_decisions.await
Security
Threat Mitigations
✅ T1: Credential Leakage
- License keys zeroized from memory
- Redacted in logs and errors
- Never serialized in full
✅ T2: Man-in-the-Middle
- HTTPS enforced (no HTTP fallback)
- TLS certificate validation
- Uses rustls (no OpenSSL)
✅ T3: Replay Attacks
- Nonce required for token exchange
- Timestamp validation server-side
✅ T4: Dependency Vulnerabilities
- Minimal dependencies (6 total)
- All dependencies audited
- No transitive vulnerabilities
✅ T5: Memory Safety
- Rust memory safety guarantees
- Zeroize for sensitive data
- No use-after-free possible
✅ T6: Information Disclosure
- Safe error messages
- No internal details leaked
- No stack traces in production
Best Practices
// ✅ DO: Store license key in environment
let key = var?;
// ❌ DON'T: Hardcode license key
let key = "tl_free_..."; // Never do this!
// ✅ DO: Use HTTPS
new?;
// ❌ DON'T: Use HTTP
new?; // Rejected!
// ✅ DO: Handle errors properly
match client.health.await
// ❌ DON'T: Unwrap in production
let health = client.health.await.unwrap; // Can panic!
License Tiers
| Tier | Price | Features |
|---|---|---|
| Free | $0/mo | Shadow mode, compliance reports, 1k requests/mo, 5 Pro features/day, 3 Enterprise features/day |
| Professional | $2,500/mo | + Token exchange, 500k requests/mo, 2 Enterprise features/day |
| Enterprise | $25,000/mo | + Full enforcement, unlimited requests |
| Government | $100,000/mo | + Air-gapped deployment, unlimited retention |
Support
- Documentation: https://docs.truthlinked.org
- API Reference: https://docs.rs/truthlinked-sdk
- Issues: https://github.com/truth-linked/truthlinked-sdk/issues
- Email: support@truthlinked.org
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
Built with ❤️ by Truthlinked