[−][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::{WasccHost, Actor, NativeCapability}; fn main() -> std::result::Result<(), Box<dyn std::error::Error>> { env_logger::init(); let host = WasccHost::new(); 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", None )?)?; host.bind_actor( "MDFD7XZ5KBOPLPHQKHJEMPR54XIW6RAG5D7NNKN22NP7NSEWNTJZP7JN", "wascc:http_server", None, generate_port_config(8082), )?; host.bind_actor( "MB4OLDIC3TCZ4Q4TGGOVAZC43VXFE2JQVRAXQMQFXUCREOOFEKOKZTY2", "wascc:http_server", None, generate_port_config(8081), )?; assert_eq!(2, host.actors().len()); if let Some(ref claims) = host.claims_for_actor("MB4OLDIC3TCZ4Q4TGGOVAZC43VXFE2JQVRAXQMQFXUCREOOFEKOKZTY2") { let md = claims.metadata.as_ref().unwrap(); assert!(md.caps.as_ref().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 }
Re-exports
pub use middleware::Middleware; |
Modules
errors | Custom error types |
middleware |
Structs
Actor | An actor is a WebAssembly module that conforms to the waSCC protocols and can securely consume capabilities exposed by native or portable capability providers |
BindingEntry | |
HostManifest | |
Invocation | An immutable representation of an invocation within waSCC |
InvocationResponse | The response to an invocation |
NativeCapability | Represents a native capability provider compiled as a shared object library.
These plugins are OS- and architecture-specific, so they will be |
WapcHost | A WebAssembly host runtime for waPC-compliant WebAssembly modules |
WasccHost | Represents an instance of a waSCC host |
WasiParams | Stores the parameters required to create a WASI instance |
Enums
InvocationTarget | Represents an invocation target - either an actor or a bound capability provider |
Constants
REVISION | |
VERSION |
Type Definitions
Result | |
SubjectClaimsPair |