-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using WebRTC as transport for signing protocol messages #366
Comments
Nice contextualization and writeup. Double encryption?
I don't think everything gets encrypted twice. Number 3 under Connection Security seems to indicate Noise is just used to authenticate the user, not encrypt data:
Another indicator and important note for implementation (also under Connection Security):
|
Ah good catch. Thats good. And noise is perfect since we already have X25519 keys. Also, the 'not very good' docs for Looking at the WebRTC-direct spec again, if i have understood right, the user (browser) never actually needs to send an SDP offer to the server, and the server never send an answer - the user just fills in the details of these messages based on the certificate and other info from the server's multiaddress. Im still a little bit unclear on why we need to do this meddling with certificates and SDP messages, which diverges from the WebRTC spec. When i follow the data connection example for The noise handshake is a great idea, but i don't understand why not send SDP offer and answer messages. |
The Noise handshake is only used when we're using WebRTC as the transport for libp2p. Since libp2p's identity system uses Ed25519, the peers can be easily authenticated via the Noise handshake at the WebRTC level. The self-signed certs can quire literally be generated on the fly, and are simply used for confidentiality and integrity. If we don't use use libp2p, I think we can just use WebRTC and auth nodes via DTLS by importing signing server self-signed certs (maybe stored on-chain and imported via browser light client). This rust-libp2p webrtc transport doc comment explains how WebRTC auth should happen reasonably clearly, and it is not specific to libp2p, nor does it even mention the Noise protocol. |
We're not looking into this anymore, can re-open if this becomes relevant again. |
This was proposed by Jake.
We discussed using websockets for protocol messages and they have two limitations:
WebRTC enables direct browser-to-browser connections.
Libp2p has a 'webRTC Direct' protocol which specifically aims to address the issue of needing trusted TLS certificates. This uses TLS as well as noise, so everything is encrypted twice. The reasoning for this is that 'TLS provides confidentiality and integrity but not authenticity'.
The rust implementation of Libp2p does include WebRTC but the docs are not great.
webrtc-rs
, which libp2p uses internally has this example showing making communication with a browser using data-channels - which i recommend trying out as it make it easy to see how the signalling needed to set up a connection works.To initiate a WebRTC connection from the browser to a threshold server:
stun.l.google.com
and use it to make a Session Description Protocol (SDP) 'offer' message. This all done by the JSRTCPeerConnection
API.RTCPeerConnection::create_answer
).RTCPeerConnection.setRemoteDescription
with the answer message, and a data connection is initiated.snow
, the NOISE implementation used by Libp2p is also very well documented.I don't know whether it would be easier to use libp2p, or to implement noise over webrtc ourselves.
The text was updated successfully, but these errors were encountered: