Skip to content

Commit

Permalink
Finalize the specs and update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Pradyumna Krishna <[email protected]>
  • Loading branch information
PradyumnaKrishna committed Jul 22, 2024
1 parent 840d5f0 commit 0383477
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 66 deletions.
2 changes: 1 addition & 1 deletion PROTOCOL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Enigma Protocol

**Date**: July 8, 2024
**Version**: 0.3.0 (Draft)
**Version**: 0.3.0

This document describes the protocol/algorithm for encrypting and decrypting messages, independent of how the keys are generated and the messages are transmitted. For message transmission, see the [Specification](SPECIFICATION.md).

Expand Down
83 changes: 23 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,39 @@
<img src="https://raw.githubusercontent.com/PradyumnaKrishna/PradyumnaKrishna/master/logo.svg" alt="Logo" title="Logo" align="right" height="50" width="50"/>
# Enigma Protocol

# Enigma Protocol [![Python Server][Python-Badge]][Python] [![Github Pages][Pages-Badge]][Pages]
An encrypted chat application using RSA encryption and Diffie-Hellman key exchange built with WebSockets.

Hello Friends, I built an end to end encrypted messenger using Flask, SocketIO, and Vue.js.
To learn more about the protocol, see the [Protocol](PROTOCOL.md) and [Specification](SPECIFICATION.md). This repository contains the client application of engima-protocol project implemented with Vue.js. The server side implementation is engima-protocol-python, which is a Python implementation of the protocol.

![Client App](/images/client.png)

## Working
## Getting Started

The Chat is encrypted using RSA encryption that is a public key encryption or you can say asymmetric encryption. RSA gives two keys, public key and private key, public key is used to encrypt messages while private key is used to decrypt them.
### Development

I have used [Diffie–Hellman key exchange](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) to exchange the public keys of the users. These keys are used by user A to encrypt messages and send them to another user B and user B can decrypt them using his private key.
To run the client application in development mode, follow these steps:

Socket.io is used to send and receive messages, these messages are encrypted and sent to the user having the private key to decrypt it.
1. Clone the repository:

I created some Flask API to store the information* of the users in a SQLite database and relogin as the user if page reloaded.
```bash
git clone https://github.com/PradyumnaKrishna/enigma-protocol.git
```

Finally Vue.js is used to perform client side encryption/decryption, send/receive message and login or connect to the user.
2. Install the dependencies:

*Information contains `id`, `publicKey`, and `last_activity` of a user.
```bash
npm ci
```

3. Start the development server:

## Development
```bash
npm run dev
```

Those who wants to develop or build the code then, just clone this repository using:
## Specification

```bash
git clone https://github.com/PradyumnaKrishna/enigma-protocol.git
```
The [PROTOCOL](PROTOCOL.md) document describes the protocol used for encrypting and decrypting messages, and [SPECIFICATION](SPECIFICATION.md) document describes the specification of the project, including the client and server implementations.

### Server (Python 3)
- Install Dependencies
```bash
pip3 install -r requirements.txt
```
- Run the Server
```bash
python main.py
```

Supported Python Versions
- Python 3.7/3.8


### Server (Golang)
This is on hold because go-socket.io doesn't support newer versions of client-socket.io.


### Client (Vue.js)
- Install Dependencies
```bash
npm ci
```
- Run the development client
```bash
npm run serve
```

**NOTE**: To run the vue.js app you need to confiure an env variables, open `.env.sample` to see an sample environment file.

Supported Node.js Version
- Current LTS version (14) or newer

## What next

I will create Issues and try to fix them.


[Python-Badge]: https://github.com/PradyumnaKrishna/Enigma-Protocol/actions/workflows/python_build.yml/badge.svg

[Python]: https://ghcr.io/PradyumnaKrishna/enigma-protocol/python-server

[Pages-Badge]: https://github.com/PradyumnaKrishna/Enigma-Protocol/actions/workflows/client_build.yml/badge.svg

[Pages]: https://protocol.onpy.in
## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.
9 changes: 4 additions & 5 deletions SPECIFICATION.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Enigma Protocol Specification

**Date**: July 8, 2024
**Version**: 0.3.0 (Draft)
**Version**: 0.3.0

## Overview

Expand All @@ -28,7 +28,7 @@ The server must provide the following REST APIs:
`GET /login/{publicKey}`

- **Description**: Stores the user's public key and assigns a userId.
- **Request**:
- **Request**:
- `publicKey`: The public key of the user.
- **Response**: A JSON object containing:
- `userId`: The unique identifier of the user.
Expand All @@ -40,7 +40,7 @@ The server must provide the following REST APIs:
`GET /connect/{userId}`

- **Description**: Retrieves the public key of the specified user.
- **Request**:
- **Request**:
- `userId`: The unique identifier of the requested user.
- **Response**: A JSON object containing:
- `userId`: The unique identifier of the requested user.
Expand All @@ -56,7 +56,7 @@ The server must provide a WebSocket endpoint for users to connect and transmit m
`WebSocket /connect/{userId}`

- **Description**: Connect to the server to receive messages.
- **Request**:
- **Request**:
- `userId`: The unique identifier of the user.
- **Response**: If the user does not exist, the connection is closed with a JSON response containing:
- `error`: Error message.
Expand Down Expand Up @@ -91,7 +91,6 @@ The key exchange process involves the following steps:
- Alice and Bob log their public keys on the server using the `/login` endpoint and obtain their respective userIds.
- Alice requests Bob's public key using the `/connect` endpoint.


### Message Transmission

1. Alice connects to the server using the `/connect` WebSocket endpoint.
Expand Down
Binary file added images/client.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0383477

Please sign in to comment.