Enhanced Terminal-based Encrypted Chat Application with threading, reactions, 2FA, file sharing, and more.
Project description
BSTK Chat (bstkchat) - v2.0
Enhanced Terminal-based Encrypted Chat with threading, reactions, 2FA, file sharing, polls, and more.
bstkchat is a real-time, terminal-based, zero-configuration collaborative chat client. Anyone who launches the client and joins using the same Room ID will instantly join a shared, encrypted room to text and exchange thoughts.
🚀 What's New in v2.0
- 20 Major Features across User Experience, Communication, Privacy & Security, and Persistence
- SQLite Database - Full message history with search
- Message Reactions & Polls - Emoji reactions and voting
- Message Threading - Organized conversations
- Typing Indicators - See who's typing
- Read Receipts - Know when messages are read
- 2FA Authentication - TOTP-based security
- Admin Controls - Mute, kick, ban users
- RSA Signing - Message authenticity verification
- File Sharing - Share files over chat
- Voice Messages - Send audio messages
- Message TTL - Auto-expiring messages
- Archive/Export - Download chat history (JSON/CSV)
- User Profiles - Bio, avatar, location info
- Draft Auto-Save - Never lose your message
Features
Core Features
- Zero Configuration: Connects instantly to a public MQTT infrastructure—no servers to set up
- Non-blocking Input: Messages arriving dynamically will never corrupt your typing, thanks to prompt_toolkit
- Memorable Auto-Rooms: Auto-generates fun phonetic room names like
quantum-beacon-55 - Deterministic Color Codes: Users get static text colors for easy conversation following
- Command Architecture: 50+ slash commands for advanced functionality
User Experience
- Message Search (
/search <query>) - Full-text search through history - Message History (
/history [limit]) - View past messages - User Profiles (
/profile [user]) - View user bios and stats - Typing Indicators - Real-time "user is typing..." notifications
- Message Reactions (
/react <id> <emoji>) - React with emojis - Draft Auto-Save - Automatic message drafts to avoid data loss
- Rich Formatting - Full markdown support with code blocks
Communication
- Message Threading (
/thread <id> <reply>) - Organized conversations - Polls (
/poll <q> <opt1> <opt2>) - Create and vote on polls - File Sharing (
/file <path>) - Share files over MQTT - Voice Messages (
/voice <seconds>) - Send audio messages - Direct Messages (
/msg <user> <text>) - Private encrypted DMs - Channels (
/channel <name>) - Channel-like organization
Privacy & Security
- End-to-End Encryption - AES-GCM room encryption + X25519 DM encryption
- RSA Message Signing - Verify message authenticity
- 2FA Authentication (
/2fa,/verify <code>) - Time-based one-time passwords - Read Receipts - Know who read your messages
- Message TTL - Auto-expiring messages
- Admin Controls - Mute, kick, or ban users
/mute <user>- Hide user's messages/kick <user>- Remove from room/ban <user>- Permanent ban
Persistence
- Local SQLite Database - Full message history
- Archive Export (
/archive) - Export room to JSON - Multiple Formats (
/export csv|json) - CSV or JSON export - User Profiles - Bio, avatar, location, website
- Multi-Session Sync - History available across sessions
Installation
Method 1: Local Pip Installation (Recommended)
git clone https://github.com/yourusername/bstkchat.git
cd bstkchat
pip install .
Then run from anywhere:
bstkchat
Method 2: Running from Source
pip install -r requirements.txt
python -m bstkchat.cli
All Slash Commands
| Category | Command | Action |
|---|---|---|
| Messaging | /msg <user> <text> |
Send direct message |
/thread <id> <reply> |
Reply in thread | |
/react <msg_id> <emoji> |
Add emoji reaction | |
/typing |
Send typing indicator | |
| Room | /room <id> [password] |
Switch room |
/topic <text> |
Set room topic | |
/channel <name> |
Switch channel | |
| User | /nick <name> |
Change nickname |
/profile [user] |
View profile | |
/status <text> |
Set status message | |
/who or /users |
List online users | |
| Search & History | /search <query> |
Search messages |
/history [limit] |
View message history | |
| Drafts | /draft <text> |
Save draft |
/drafts |
List drafts | |
| Polls | /poll <q> <o1> <o2> |
Create poll |
/vote <id> <option> |
Vote in poll | |
| Files | /file <path> |
Share file |
/download <id> |
Download file | |
| Voice | /voice <seconds> |
Send voice message |
| Admin | /mute <user> |
Mute user |
/unmute <user> |
Unmute user | |
/kick <user> |
Remove from room | |
/ban <user> |
Ban user | |
/unban <user> |
Unban user | |
| Security | /2fa |
Enable 2FA |
/verify <code> |
Verify 2FA code | |
| Archive | /archive |
Archive room |
/export csv|json |
Export messages | |
| Utility | /help |
Show command help |
/clear |
Clear screen | |
/log |
Toggle logging | |
/broker <host> [port] |
Change MQTT broker | |
/exit |
Leave chat |
Project Structure
bstkchat/
├── __init__.py # Package init
├── cli.py # Main ChatClient + entry point
├── models.py # Data classes (Message, User, Room, etc.)
├── database.py # SQLite database layer
├── crypto.py # Encryption + 2FA + RSA signing
├── network.py # MQTT wrapper
├── ui.py # Terminal UI with Rich
├── commands.py # Command handler (50+ commands)
├── cli_backup.py # v1 backup
└── ...
Database Schema
Automatically created at ~/.bstkchat/chat.db with tables for:
- Messages (with reactions, threading, signatures)
- Users (profiles, keys, settings)
- Rooms (configuration, topics, members)
- Drafts (auto-save)
- Polls (questions and votes)
- File Shares (with metadata)
- Voice Messages
- Admin Actions (mute, kick, ban)
- Read Receipts
- User Profiles (extended info)
Security Model
- Transport Encryption: MQTT over TLS (optional)
- Room Encryption: AES-256-GCM with password-derived key
- DM Encryption: X25519 ECDH for key exchange + AES-GCM
- Message Signing: RSA-2048 for authenticity
- 2FA: TOTP with backup codes
- Admin Controls: Client-side enforcement of mute/kick
Configuration
Default MQTT broker: broker.hivemq.com:1883
Switch at runtime: /broker mosquitto.example.com 8883
Or set in config file (future): ~/.bstkchat/config.yaml
Dependencies
paho-mqtt>=1.6.1- MQTT clientrich>=13.0.0- Terminal UIprompt-toolkit>=3.0.0- Non-blocking inputcryptography>=41.0.0- Encryptionpyotp>=2.9.0- 2FA/TOTPreportlab>=4.0.0- PDF export (future)
Performance
- Lightweight terminal UI
- Efficient SQLite queries with indexing
- Background task for heartbeat/cleanup (15s interval)
- Typing indicator auto-cleanup (3s timeout)
- Message expiration cleanup
Roadmap
- Web UI for browser access
- Mobile app port
- Server mode with persistence
- Plugin system for custom commands
- Voice call support
- Video messages
- Desktop notifications
- Message reactions with skin tone variants
- Community plugins marketplace
Contributing
Pull requests welcome! Areas for contribution:
- New message types
- Additional export formats (PDF, Excel)
- Custom themes
- Mobile UI
- Documentation
- Tests
License
MIT License - See LICENSE file
For detailed feature documentation, see FEATURES.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bstkchat-2.1.1.tar.gz.
File metadata
- Download URL: bstkchat-2.1.1.tar.gz
- Upload date:
- Size: 32.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bf73bf84666d54a5a09eaef09fa4a3fa6edf35e9a406c9ab24b93a36c0afda1
|
|
| MD5 |
7d8923ab08b4ef0a5e21ca9515bc23a1
|
|
| BLAKE2b-256 |
aa9705c2ffb83644c6097a48fa0437bbd6664290f182cd76038c514c865038a4
|
File details
Details for the file bstkchat-2.1.1-py3-none-any.whl.
File metadata
- Download URL: bstkchat-2.1.1-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fd18144e60376d91fd1a1b947e7bf0f0c302827c1fcdb7ac2ba1285ba3539df
|
|
| MD5 |
045f5f9f6f6dc0fdb9fe1a8cdfe34805
|
|
| BLAKE2b-256 |
a2a2ce5f7c22cad4972c4af38ddab9cb69adde035b057365c247005105321d4c
|