Can anyone please help me to convert a rust program (Noise protocol) which has tcp connect functions and cryptographic handshakes into wasm32-wasi target.
I get error
wasmtime run -S tcp=y -S inherit-network=y -S allow-ip-name-lookup=y noise_demo/target/wasm32-wasi/debug/noise_wasi_demo.wasm
Error: Error { kind: Unsupported, message: "operation not supported on this platform" }
wasm32-wasi
(also know by its newer name wasm32-wasip1
) has only very rudimentary TCP networking support. You'll want to use the wasm32-wasip2
target if you're using TCP.
In addition to what Joel already covered, with the recent addition of a wasi-tls
implementation, you should likely check out the example programs that are now in the codebase:
wasmtime run
on main has -S tls
, so you should be able to try it out that way.
On the lib side, you'll have to fork the relevant program and fill out the conditional compilation bits that do the TCP.
TCP might be the easier bit there -- as far as crypto goes, this actually recently came up on Zulip, so I made an issue in the component-docs repo to get it added to the component model docs -- there are a bunch of ways to get crypto working, at various levels of completeness/testing.
Thanks a lot for the insights!
Last updated: Apr 08 2025 at 11:03 UTC