Rust SDK
The Rust crate is the reference implementation - every other SDK is validated
against it. It is #![forbid(unsafe_code)] in all parsing paths.
Install
bash
cargo add osdfVerify a package
rust
use osdf::{Verifier, TrustStore}; fn main() -> anyhow::Result<()> { let trust = TrustStore::from_path("./trust")?; let report = Verifier::new(trust).verify_file("contract.osdf")?; println!("trust score: {}", report.score()); for stage in report.stages() { println!("{:<14} {}", stage.name(), stage.status()); } Ok(())}Create and sign
rust
use osdf::{Builder, SigningKey}; let key = SigningKey::from_pem_file("signing.key")?;let pkg = Builder::from_pdf("contract.pdf")? .profile("osdf-verified") .sign(&key)? .build()?;pkg.write("contract.osdf")?;Feature flags
| Feature | Description |
|---|---|
wasm | Compile the verifier to WebAssembly |
fips | Route crypto through a validated module |
ledger | Enable transparency-log client |