intentrail

Crates.iointentrail
lib.rsintentrail
version0.1.0
created_at2025-12-31 15:30:30.310266+00
updated_at2025-12-31 15:30:30.310266+00
descriptionRust SDK for creating, validating, and verifying IntentRail manifests
homepage
repositoryhttps://github.com/intentrail/intentrail
max_upload_size
id2014894
size52,450
IntentRail (intentrail)

documentation

README

intentrail

Rust SDK for creating, validating, and verifying IntentRail manifests.

Installation

Add to your Cargo.toml:

[dependencies]
intentrail = "0.1"

Usage

Parsing and Validation

use intentrail::{IntentManifest, verify_intent, VerifyOptions};

// Parse from JSON
let json = r#"{"intent_version":"1.0",...}"#;
let manifest: IntentManifest = serde_json::from_str(json)?;

// Verify
let result = verify_intent(&manifest, &VerifyOptions::default())?;
if result.ok {
    println!("Intent is valid");
} else {
    for error in result.errors {
        println!("Error: {}", error.message);
    }
}

Hashing

use intentrail::{hash_manifest_hex, canonicalize_manifest};

// Get canonical form
let canonical = canonicalize_manifest(&manifest)?;

// Get SHA-256 hash
let hash = hash_manifest_hex(&manifest)?;
println!("Hash: {}", hash);

Signature Verification

use intentrail::{verify_signature, verify_intent, VerifyOptions};

// Verify a specific signature
let is_valid = verify_signature(&manifest, "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV")?;

// Verify with required signers
let options = VerifyOptions {
    required_signers: vec!["7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV".to_string()],
    ..Default::default()
};
let result = verify_intent(&manifest, &options)?;

Cross-SDK Compatibility

The canonicalization and hashing in this crate produce identical output to the TypeScript and Python SDKs. This is verified by shared test fixtures.

License

MIT

Commit count: 0

cargo fmt