Installation

TrustForge is distributed via crates.io. Add the core cryptographic library to your Rust project:

cargo add trustforge-core

Quickstart: Generating a Proof

Initialize a keystore, create a capability, and mint a proof using Ed25519.

use trustforge_core::{Keystore, Capability, Proof};

// 1. Initialize a new Keystore with a fresh Ed25519 keypair
let keystore = Keystore::generate();

// 2. Define the capability (the boundary of action)
let cap = Capability::new("db:write").with_target("users_table");

// 3. Mint the proof
let proof = keystore.mint_proof(&cap).expect("Failed to mint proof");

println!("Proof minted: {}", proof.signature());

Verifying a Proof

Verification is stateless and occurs entirely in-memory within microseconds.

use trustforge_core::{Verifier, Proof};

// Assume 'proof' was received via an inbound request
let verifier = Verifier::new();

match verifier.verify(&proof) {
    Ok(_) => println!("Proof is cryptographically valid."),
    Err(e) => println!("Invalid proof: {}", e),
}

Rego Policy Engine

Beyond signature validation, TrustForge embeds a lightweight WebAssembly Rego engine to enforce complex logical boundaries (e.g., checking expiration times or IP constraints) before executing actions.