Just a simple example of how Diffie-Hellman Key Exchange can be implemented in End-to-End Chat.
npm iMake sure you have free :3000 in order to run express server. Otherwise, change the port constant inside the express.js.
node express.jsI've set up chat with GET routes, just to make things simple and to emphasize publicity of distribution channels.
There are two participants called alice and bob. You can find them in express.js file.
So you can navigate to one of these URLs using the showcase with axios in express.js
or using your browser:
/send/message/:from/:to/:message- sends a message.:fromis the namealiceorbob
(or yours, if you set it up),:tois the name of another chat participant and the
messageis the message/send-public-key/:from/:to- sends a publicDiffie-Hellmankey from:from(e.g.alice)
to:to(e.g.bob). This public key is then used to generate the common secret key, using
a private key/inbox/:whose- show an inbox of:whose(e.g.alice)
Also I am logging all things to the terminal, so you are able to not use your browser.