Skip to content

eminmuhammadi/e2e-realtime-secure-chat

Repository files navigation

E2E realtime chat

Uses Diffie-Hellman key exchange to generate a shared secret between two users. The shared secret is used to encrypt (AES-256-GCM) messages sent between the two users.

Keys are generated on client side. Only the public keys are sent to the server. The server does not have access to the private keys and symmetric key.

Data is sent over a websocket connection:

{
    "socket_id": "qaY0wQGzyN37QhccAAAj",
    "data": {
        "toPubK": "XXX",
        "fromPubK": "XXX",
        "message": "q0gi3w==.2xJxABQsA/n5ZIOVI4ASqA==.ooGFkuZqxcgySSB5lWwzPw=="
    },
    "timestamp": 1694292428594
}

Setup

yarn install && sh certgen.sh && node .

or

yarn install && node .

You can use insecure app mode like this

const {app, StartServer} = require("./server.js");
const {registerRoutes} = require("./routes.js");
const {registerSocket} = require("./socket.js");

// Register routes
registerRoutes(app);

// Register socket.io
registerSocket(app);

// Start the server
StartServer(app);

About

End to end realtime secure chat

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published