Quantum Chat is a secure messaging system that uses Quantum Key Distribution (QKD) for cryptographic key generation and RSA for key exchange. It comprises a NodeJS server, a Svelte client, and a QKD Python server for quantum key generation. Report
- Server-side component in TypeScript with WebSocket communication
- Client-side component in Svelte using IndexedDB for local storage
- Quantum Key Distribution for generating secure symmetric keys
- Hybrid encryption system combining symmetric and asymmetric encryption
- AES-CTR algorithm for message encryption and decryption
- Node.js and npm (for TypeScript server and Svelte client)
- Python 3.7+ and pip (for QKD server)
- PowerShell (for Windows users)
git clone https://github.com/CubeStar1/QuantumChat.git
cd QuantumChatcd qkd-server
python -m venv .venv
.\.venv\Scripts\activate # On Windows
source .venv/bin/activate # On Unix or MacOS
pip install -r requirements.txtYou can start the APIs using the provided start.py script or manually.
-
Activate the Virtual Environment: Ensure your virtual environment is activated:
.\.venv\Scripts\activate
-
Run the Script: Execute the
start.pyscript to generate and run the PowerShell script that starts the APIs:python start.py
-
Activate the Virtual Environment:
.\.venv\Scripts\activate
-
Start Each API:
- QKD API:
uvicorn qkd.app:app --host 0.0.0.0 --port 8000
- DICOM API:
uvicorn DICOM.app:app --host 0.0.0.0 --port 8001
- Chatbot API:
uvicorn chatbot.app:app --host 0.0.0.0 --port 8002
- QKD API:
API Endpoints:
- QKD API: Accessible at
http://localhost:8000 - DICOM API: Accessible at
http://localhost:8001 - Chatbot API: Accessible at
http://localhost:8002
cd chatapp-server
npm installStart the TypeScript server:
ts-node server-v3.tscd chatapp-frontend
npm installStart the Svelte development server:
npm run dev -- --open- Ensure the QKD server is running on port 8000
- Start the NodeJS backend (it will run on port 3000)
- Launch the Svelte frontend (typically on port 5000 or 5173)
- Access the application through the URL provided by the Svelte frontend
- Manages WebSocket connections and nicknames
- Handles message routing and key distribution
- Maintains two maps:
connectionsandnicknames - Listens for incoming messages and performs actions based on message type
- Maintains WebSocket connection to the server
- Uses IndexedDB to store users and messages
- Handles user interactions, message sending, and conversation management
- Implements encryption and decryption of messages using AES
- Generates shared keys using quantum computations
- Provides API endpoint for key generation
- Uses FastAPI to handle requests for quantum keys
- Hybrid encryption system using QKD-generated symmetric keys and RSA
- Server encrypts symmetric keys with clients' public RSA keys
- Clients decrypt symmetric keys using their private RSA keys
- Messages encrypted/decrypted using AES algorithm
- Server doesn't store encryption keys; they're generated on-demand for each conversation
- Client-side encryption/decryption ensures message privacy
- Even if the server is compromised, message content remains secure
- The use of QKD provides forward secrecy and resistance to quantum computing attacks
For more detailed information on each component, refer to their respective README files in the qkd-server and chatapp-server directories.

