This project is an end-to-end encrypted chat application that uses WebRTC for peer-to-peer communication and Solana wallets for authentication. It features a Next.js frontend and a TypeScript-based signaling server.
- End-to-end encryption using Ed25519 key exchange
- WebRTC peer-to-peer communication
- Solana wallet integration for authentication
- Real-time chat functionality
- Signaling server for WebRTC connection establishment
- Node.js (v14 or later)
- npm (v6 or later)
- A Solana wallet (e.g., Phantom, Solflare)
-
Clone the repository:
git clone https://github.com/your-username/encrypted-chat.git cd encrypted-chat
-
Install dependencies for the frontend:
npm install
-
Install dependencies for the signaling server:
cd signaling-server npm install cd ..
-
Start the signaling server:
cd signaling-server npm start
The server will run on
ws://localhost:8080
. -
In a new terminal, start the frontend development server:
npm run dev
The frontend will be available at
http://localhost:3000
. -
Open two browser windows and navigate to
http://localhost:3000
in each. -
Connect your Solana wallet in each window.
-
In one window, enter the recipient's public key and click "Connect to Recipient".
-
Once connected, you can start sending encrypted messages between the two clients.
- Connect your Solana wallet using the "Select Wallet" button.
- Enter the recipient's Solana public key in the input field.
- Click "Connect to Recipient" to establish a peer connection.
- Once connected, you can send and receive encrypted messages.
This application uses a temporary Ed25519 keypair for the encryption key exchange, which is separate from your Solana wallet keys. Your Solana private key is never exposed or used for message encryption.
- The frontend code is located in the root directory, with the main page in
pages/index.tsx
. - The
ConnectionManager
class inutils/ConnectionManager.ts
handles the WebRTC and encryption logic. - The signaling server code is in the
signaling-server
directory.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.