Skip to content
Versionv0.1 ALPHA 2

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 osdf

Verify 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

FeatureDescription
wasmCompile the verifier to WebAssembly
fipsRoute crypto through a validated module
ledgerEnable transparency-log client

Spec status: working draft v0.4 · subject to change before v1.0.