[−][src]Crate wascc_host
waSCC Host
The WebAssembly Secure Capabilities Connector (waSCC) host runtime manages actors written in WebAssembly (aka nanoprocesses) and capability providers written in WebAssembly (via WASI) or as OS-native plugin libraries. waSCC securely manages communications between actors and the capabilities they need.
To start a runtime, simply add actors and capabilities to the host. For more information, take a look at the documentation and tutorials at wascc.dev.
Example
use std::collections::HashMap; use wascc_host::{host, Actor, NativeCapability}; fn main() -> std::result::Result<(), Box<dyn std::error::Error>> { env_logger::init(); host::add_actor(Actor::from_file("./examples/.assets/echo.wasm")?)?; host::add_actor(Actor::from_file("./examples/.assets/echo2.wasm")?)?; host::add_native_capability(NativeCapability::from_file( "./examples/.assets/libwascc_httpsrv.so", )?)?; host::configure( "MDFD7XZ5KBOPLPHQKHJEMPR54XIW6RAG5D7NNKN22NP7NSEWNTJZP7JN", "wascc:http_server", generate_port_config(8082), )?; host::configure( "MB4OLDIC3TCZ4Q4TGGOVAZC43VXFE2JQVRAXQMQFXUCREOOFEKOKZTY2", "wascc:http_server", generate_port_config(8081), )?; assert_eq!(2, host::actors().len()); if let Some(claims) = host::actor_claims("MB4OLDIC3TCZ4Q4TGGOVAZC43VXFE2JQVRAXQMQFXUCREOOFEKOKZTY2") { assert!(claims.caps.unwrap().contains(&"wascc:http_server".to_string())); } // Need to keep the main thread from terminating immediately // std::thread::park(); Ok(()) } fn generate_port_config(port: u16) -> HashMap<String, String> { let mut hm = HashMap::new(); hm.insert("PORT".to_string(), port.to_string()); hm }
Modules
errors | Custom error types |
host | The main interface for managing a waSCC host |
Structs
Actor | An actor is a WebAssembly module that can consume capabilities exposed by capability providers |
NativeCapability | Represents a native capability provider compiled as a shared object library.
These plugins are OS-specific, so they will be |
WasiParams | Stores the parameters required to create a WASI instance |
Traits
Middleware | The trait that must be implemented by all waSCC middleware |
Type Definitions
Result |