Skip to main content

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

  1. Transport Encryption: MQTT over TLS (optional)
  2. Room Encryption: AES-256-GCM with password-derived key
  3. DM Encryption: X25519 ECDH for key exchange + AES-GCM
  4. Message Signing: RSA-2048 for authenticity
  5. 2FA: TOTP with backup codes
  6. 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 client
  • rich>=13.0.0 - Terminal UI
  • prompt-toolkit>=3.0.0 - Non-blocking input
  • cryptography>=41.0.0 - Encryption
  • pyotp>=2.9.0 - 2FA/TOTP
  • reportlab>=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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bstkchat-2.1.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bstkchat-2.1.0-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file bstkchat-2.1.0.tar.gz.

File metadata

  • Download URL: bstkchat-2.1.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bstkchat-2.1.0.tar.gz
Algorithm Hash digest
SHA256 7528804851c5be1fb53e2b7fed04b62f8ca905ae9da190b3341f300cea55c7e0
MD5 1d8961de8343066ef0f48e9cd159004e
BLAKE2b-256 d63b71bdd2ae9c4f9175977f00fd93c055d58b38f296a6377a074b1c5b93fd0c

See more details on using hashes here.

File details

Details for the file bstkchat-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: bstkchat-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bstkchat-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 349956fb0618dfa2fa01ead633c1ddeb4f96a7f28d091976c9f28c1da1e8f12e
MD5 ff15203a2fd6c5fe8570ff9d28a1d9dd
BLAKE2b-256 eb105231a9acc593cbb22bfed927a14b4e649db69577196b39fcf0a1ed364724

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page