Skip to content

Hyperlight Wasm

Hyperlight Wasm enables Wasm modules to be run within the Hyperlight secure boundary using Wasmtime. Its purpose is to enable applications to run untrusted or third party Wasm code within the VM isolation boundary with very low latency and resource utilization.

// Load and call the component from your host application
let mut sb = hyperlight_wasm::SandboxBuilder::new().build().unwrap();
let rt = bindings::register_host_functions(&mut sb, state);
let sb = sb.load_runtime().unwrap();
let sb = sb.load_module("component_sample.aot").unwrap();
let mut wrapped = bindings::ExampleSandbox { sb, rt };
let instance = bindings::component_sample::example::ExampleExports::adder(&mut wrapped);
let result = instance.add(1, 2);
println!("1 + 2 = {result}"); // 1 + 2 = 3
let result = instance.call_host("Hello".to_string());
println!("{result}"); // Hello from component and the host!
GitHub API Docs