Gunnar

nordisk/heimdall

crates/heimdall-wasm/src/lib.rs

// SPDX-License-Identifier: AGPL-3.0-only
//! Heimdall wasm host (spec §6). **Heimdall is a defensive sandbox.**
//!
//! A guest is a wasm component that implements `wit/heimdall.wit`: bytes in
//! through `run(input, params)`, a verdict and files out through the return
//! value and `emit-file`. There is no WASI: no filesystem, network, clock or
//! environment is linked, so a guest that imports any is refused at load.
//!
//! Every guest is verified before it is compiled: a detached CMS signature at
//! `<file>.wasm.p7s` over the module's BLAKE3-256 (holger's plugin format, the
//! same verifier through `guest-host`), plus the `<file>.wasm.blake3` pin.
//!
//! A run is bounded by fuel, an epoch wall-clock timeout, memory/table/instance
//! limits and a stack limit. A trap or a limit hit ends the run as
//! `refused: guest trapped (<reason>)`; it never takes the host down.

pub mod codes;
mod host;
mod limits;
mod names;
mod outcome;

pub use host::{Guest, Host, HostError, LoadRefusal, TrustFailure};
pub use limits::{HostConfig, RunLimits};
pub use names::{check_file_name, NameRefusal, MAX_NAME_BYTES};
pub use outcome::{EmittedFile, GuestOutcome, Verdict};

/// The guest interface, for guest authors (`wit-bindgen` path) and tests.
pub const WIT: &str = include_str!("../wit/heimdall.wit");

/// The WIT world a guest implements.
pub const WORLD: &str = "job";