| Crates.io | truthlinked-sdk |
| lib.rs | truthlinked-sdk |
| version | 0.1.4 |
| created_at | 2026-01-17 05:13:15.075481+00 |
| updated_at | 2026-01-18 15:41:20.016281+00 |
| description | Official Rust SDK for Truthlinked Authority Fabric - Zero-trust authorization system |
| homepage | https://truthlinked.org |
| repository | https://github.com/truth-linked/truthlinked-sdk |
| max_upload_size | |
| id | 2049985 |
| size | 186,880 |
Official Rust SDK for Truthlinked Authority Fabric - Zero-Trust Authorization System
Add to your Cargo.toml:
[dependencies]
truthlinked-sdk = "0.1"
tokio = { version = "1.0", features = ["full"] }
use truthlinked_sdk::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create client
let client = Client::new(
"https://api.truthlinked.org",
"tl_free_..." // Your license key
)?;
// Check health
let health = client.health().await?;
println!("Status: {}", health.status);
// Get shadow decisions (breach detections)
let decisions = client.get_shadow_decisions().await?;
let breaches = decisions.iter()
.filter(|d| d.breach_prevented)
.count();
println!("Breaches prevented: {}", breaches);
// Get compliance report
let sox = client.get_sox_report().await?;
println!("SOX: {} events", sox.total_events);
Ok(())
}
Run examples with your license key:
export TRUTHLINKED_LICENSE_KEY="tl_free_..."
# Health check
cargo run --example health_check
# Shadow mode (breach detection)
cargo run --example shadow_report
# Compliance reports
cargo run --example compliance_report
# Usage statistics
cargo run --example usage_stats
let client = Client::new(base_url, license_key)?;
Security:
let health = client.health().await?;
No authentication required.
// Get breach detections
let decisions = client.get_shadow_decisions().await?;
// Replay IAM logs
let result = client.replay_iam_logs(logs, "aws-cloudtrail").await?;
Supported adapters:
aws-cloudtrail - AWS CloudTrail logsazure-ad - Azure AD logsgcp-audit - GCP Audit logsokta - Okta System Logauth0 - Auth0 logsuse rand::Rng;
// Generate nonce and channel binding
let nonce: [u8; 32] = rand::thread_rng().gen();
let channel_binding: [u8; 32] = rand::thread_rng().gen();
// Exchange SSO token for AF token
let response = client.exchange_token(
sso_token,
vec!["read:users".to_string()],
nonce,
channel_binding,
).await?;
println!("AF Token: {}", response.af_token);
Requires: Professional tier or higher
let result = client.validate_token(token_id).await?;
if result.valid {
println!("Subject: {:?}", result.subject);
println!("Scope: {:?}", result.scope);
}
// SOX compliance
let sox = client.get_sox_report().await?;
println!("Period: {}", sox.period);
println!("Events: {}", sox.total_events);
println!("Complete: {}", sox.audit_trail_complete);
// PCI-DSS compliance
let pci = client.get_pci_report().await?;
println!("Access controls: {}", pci.access_controls_enforced);
println!("Encryption: {}", pci.encryption_verified);
let logs = client.get_audit_logs().await?;
for log in logs {
println!("{}: {} by {}", log.timestamp, log.action, log.subject);
}
let usage = client.get_usage().await?;
println!("Tier: {}", usage.tier);
println!("Usage: {} / {}", usage.usage, usage.limit);
println!("Days remaining: {}", usage.days_remaining);
use truthlinked_sdk::TruthlinkedError;
match client.get_shadow_decisions().await {
Ok(decisions) => println!("Got {} decisions", decisions.len()),
Err(TruthlinkedError::Unauthorized) => {
eprintln!("Invalid license key");
}
Err(TruthlinkedError::Forbidden) => {
eprintln!("Tier doesn't allow this operation");
}
Err(TruthlinkedError::RateLimitExceeded(msg)) => {
eprintln!("Rate limit: {}", msg);
}
Err(e) => eprintln!("Error: {}", e),
}
✅ T1: Credential Leakage
✅ T2: Man-in-the-Middle
✅ T3: Replay Attacks
✅ T4: Dependency Vulnerabilities
✅ T5: Memory Safety
✅ T6: Information Disclosure
// ✅ DO: Store license key in environment
let key = std::env::var("TRUTHLINKED_LICENSE_KEY")?;
// ❌ DON'T: Hardcode license key
let key = "tl_free_..."; // Never do this!
// ✅ DO: Use HTTPS
Client::new("https://api.truthlinked.org", key)?;
// ❌ DON'T: Use HTTP
Client::new("http://api.truthlinked.org", key)?; // Rejected!
// ✅ DO: Handle errors properly
match client.health().await {
Ok(health) => println!("OK: {}", health.status),
Err(e) => eprintln!("Error: {}", e),
}
// ❌ DON'T: Unwrap in production
let health = client.health().await.unwrap(); // Can panic!
| 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 |
Licensed under either of:
at your option.
Contributions welcome! Please read CONTRIBUTING.md first.
Built with ❤️ by Truthlinked