n0-computer / iroh

peer-2-peer that just works
https://iroh.computer
Apache License 2.0
2.6k stars 163 forks source link

Tracking: WebAssembly support for iroh-net #2799

Open matheus23 opened 1 month ago

matheus23 commented 1 month 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:

This is a non-exhaustive list of things that need to land for Wasm support:

amiyatulu commented 1 month 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 month 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 1 month 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).