Skip to content

Add WebRTC Transport Spec #220

@Stebalien

Description

@Stebalien

At the moment, we have three big issues communicating between go-libp2p and a browser:

  1. We can't dial them.
  2. We have to do our crypto in javascript.
  3. If the dApp is running in a secure origin, the go-libp2p node needs a valid TLS certificate for a valid domain.

However, it turns out that WebRTC already has built-in support for both encryption and multiplexing. Even better, the browser APIs allow the user to get the local and remote certificates of a connection (and their fingerprints).

Given this, we should be able to:

Setup

  1. Generate a certificate.
  2. Get the certificate's fingerprint.
  3. Sign this fingerprint using the libp2p peer key to generate a "peer cert"

Connection Establishment

  1. Create a connection with the certificate.
  2. Open a data stream.
  3. Send the "peer cert".
  4. Wait for the other side to do the same.
  5. Get the remote peer's TLS certificate.
  6. Check the remote endpoint's "peer cert".

Unfortunately, Firefox and Safari still need to implement https://www.w3.org/TR/webrtc/#dom-rtcdtlstransport-getremotecertificates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions