cabal-club / cabal-client

interface for writing peer-to-peer chat clients
GNU General Public License v3.0
95 stars 14 forks source link

add whisperlinks #63

Closed cblgh closed 3 years ago

cblgh commented 3 years ago

Hi friends!

This PR adds whisperlinks. Whisperlinks are user defined, shortlived, shortname aliases for a cabal key. They look something like

whisper://workshop-1ee

where the first part identifies the string as a whisper link, workshop is the user defined alias, and the -1ee suffix are three first hex characters of the cabal key being shared (which helps verify the joined cabal, as well as disambiguate names & prevent already-unlikely name collisions).

Whisperlinks are shortlived, currently terminating after 5 minutes. A whisperlink can be used multiple times before it self-terminates, and it will sync over LAN as well as the internet (it uses hyperswarm, under the hood)

Anyone can create a whisperlink for a cabal they are in by invoking the /whisper <name> command.

The entire raison d'être of whisperlinks is that creating and sharing cabals in physical space was really awkward before. If you had a workshop at a hackerspace, with everyone gathered locally, you practically had to use a separate chat software in order to transmit the 64 character long cabal key amongst the group. Now, someone could just create a whisperlink and verbally transmit the short & understandable alias they chose.

This PR uses a module I created a while back called paperslip to accomplish most of the not-so-heavy lifting.

cblgh commented 3 years ago

hm. might use crypto.discoveryKey to create a discovery key of the passed in whisperlink, to prevent the possibility that anyone could be monitoring the DHT

edit: added in paperslip@3.0.0

cblgh commented 3 years ago

thanks for the reviews friends! i'll comment individually above :)

pvh commented 3 years ago

Hey this is awesome, @cblgh! I definitely want to clone this feature in our work in the future.

cblgh commented 3 years ago

@pvh go for it! 🖤