kappa-db / multifeed

Multi-writer hypercore.
135 stars 27 forks source link

upgrade to hypercore@8 #36

Closed hackergrrl closed 4 years ago

hackergrrl commented 4 years ago

This required not just an update to the extensions API, but also some new logic because:

  1. hypercore-proto no longer has a handshake that shuttles userdata on connection init
  2. hypercore-proto no longer ensures that both sides have a common shared key (instead, NOISE generates a keypair dynamically for each side; more like a TLS connection as I understand it)

For (1), there is a new extension that duplicates the old handshake process, which includes the multifeed version and MULTIFEED client constant.

For (2), there's an API for detecting the first opened key on the stream. The muxer opens a channel for the common shared key first, and checks that the remote has also opened it. This can only happen if both sides know the original non-discovery key. If it's verified, the handshake process above runs, and then regular multifeed sync proceeds.