n0-computer / iroh

A toolkit for building distributed applications
https://iroh.computer
Apache License 2.0
2.48k stars 159 forks source link

Tracking: WebAssembly support for iroh-net #2799

Open matheus23 opened 1 week ago

matheus23 commented 1 week ago

We're working on Wasm support so you can use iroh-net in rust applications in browsers. See also the accompanying blogpost.

Here's some prior issues with requests for this:

amiyatulu commented 1 week ago

Thanks for the blogspot, and about relay servers. Will Ockam be helpful in end to end encryption?

Also can I use any relay server to connect, other wise it will lead to centralization (e.g. storing relay server addresses in dht)

DougAnderson444 commented 1 week ago

Great blog post, thank you Philipp.

Glad to see Phase 3 being WebRTC, as this means self signed certificates for secure connections (something websocket's can't do, so domain-less nodes are stuck at ws:// instead of wss://).

As far as that complexity, you may want to check out str0m if you haven't already. This was being looked at for libp2p but hasn't been implemented yet.

Overall I'm glad to see this route being examined. One of the reasons holding me back from using iroh was lack of browser and webrtc support. So yeah, LFG!

matheus23 commented 2 days ago

Thanks for the blogspot, and about relay servers. Will Ockam be helpful in end to end encryption?

The traffic that's relayed is already encrypted end-to-end, because we're using QUIC :) (Yes, we're compiling a whole QUIC network stack to Wasm and run it in the browser :upside_down_face: ).

Also can I use any relay server to connect, other wise it will lead to centralization (e.g. storing relay server addresses in dht)

Yes, relay servers are identified by URL. As a node, you can decide to use any "home" relay server you want. By default, number 0 runs three: one in Asia, one in Europe and one in the US (at the moment). But you can simply run one on your own via the binary behind the relay feature in iroh-net + DNS and some TLS config. And if there are any relay servers you want to use from iroh, you configure them via the RelayMap::from_url (or configure a whole set using RelayMap::from_nodes).