robertDurst / ChatDemo

A demonstration of private communication on a public channel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chat Demo

A live demonstration of private communication on a public channel.

How it Works

We utilize simple web sockets via socket.io to create a central chat room that broadcasts all messages to all members and RSA for message encryption/decryption.

Before joining the chat room, the user generates a public key [e,n] and private key [d,n]. After generating the keys, the client Registers with the chat server by sending its public key which is broadcasted to all users.

Once the user has joined they can send unencrypted or encrypted messages. To send encrypted messages, they can click on a joined user's public key which will be filled into the encrypt field and write the message they want to encrypt in the send field. After clicking the encrypt button, their message will be encrypted and replace the plaintext in the send field.

Messages are filtered by each client. When a client receives a message with it's public key as the header, it will automatically decrypt the message and alert the user that a message was received.

Prerequisites

  • A recent version of node/npm (probably node 8+ should be fine)
  • Nightly Rust (we use the latest and greatest)

How to Use?

Setup

git clone https://github.com/robertDurst/ChatDemo.git
cd ChatDemo
npm install
npm run build-debug // or npm run build-release

Start Client

npm run client

Start Server

npm run server

Test

cargo test

Cryptography Dependencies

The underlying crypto makes heavy use of the crates in rust-num, specifically num-bigint and num-trait crates.

The randomness for the crypto uses the rust rand crate.

About

A demonstration of private communication on a public channel.


Languages

Language:Rust 67.0%Language:JavaScript 33.0%