SCAR Chat
Written by Claude Sonnet, with assistancer from Ganome.
A cross-platform C++20 chat application with text messaging, live video streaming, and screen sharing capabilities.
Features
- 🔐 Secure Authentication - User/password with Argon2 hashing and JWT session management
- 💬 Real-time Text Chat - Instant messaging with online user list
- 🎥 Live Video Streaming - Camera feed sharing via Pipewire (Linux)
- 🖥️ Screen Sharing - Multi-platform screen capture (X11/Wayland/Hyprland/Windows)
- 🎨 Modern UI - Dark Discord-inspired Qt6 interface with grid video layout
- 🔒 SSL/TLS - End-to-end encrypted connections via Boost.ASIO
- 📱 Cross-Platform - Desktop (Linux/Windows) and Android support
Architecture
- Language: C++20
- GUI Framework: Qt6
- Networking: Boost.ASIO with SSL
- Database: SQLite3
- Hashing: Argon2
- Auth: JWT tokens
- Media: FFmpeg, Pipewire, DBus portals
- Build: CMake 3.20+
Project Structure
scar-chat7/
├── client/ # Qt6 GUI client (scarchat)
├── server/ # Boost.ASIO server (scarchat-server)
├── shared/ # Common protocol and utilities
├── dbmanager/ # Database management CLI tool
├── third_party/ # External dependencies (Argon2, JWT-CPP)
├── tests/ # Unit and integration tests
├── installer/ # WiX installer scripts
└── CMakeLists.txt # Root build configuration
Prerequisites
Linux
# Ubuntu/Debian
sudo apt install build-essential cmake qt6-base-dev libboost-all-dev \
libssl-dev libsqlite3-dev libpipewire-0.3-dev \
libavcodec-dev libavformat-dev libavutil-dev
# Fedora
sudo dnf install gcc-c++ cmake qt6-qtbase-devel boost-devel \
openssl-devel sqlite-devel pipewire-devel \
ffmpeg-devel
Windows
- Visual Studio 2022 (with C++20 support)
- CMake 3.20+
- Qt6 (install via official installer)
- Boost (via vcpkg or pre-built binaries)
- OpenSSL (via vcpkg)
- SQLite3 (via vcpkg)
- FFmpeg development libraries
Android
- Android NDK r25+
- Qt for Android
- Android SDK with minimum API level 24
Building
Linux/Windows Desktop
# Configure
cmake -B build -DCMAKE_BUILD_TYPE=Release
# Build
cmake --build build --config Release
# Optional: Build only server or client
cmake -B build -DBUILD_CLIENT=OFF # Server only
cmake -B build -DBUILD_SERVER=OFF # Client only
Binaries will be in:
build/server/scarchat-server- Server executablebuild/client/scarchat- Client executablebuild/dbmanager/dbmanager- Database management tool
Android
# Requires Qt for Android and Android NDK
cmake -B build-android \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-24 \
-DQt6_DIR=/path/to/Qt/6.x.x/android_arm64_v8a/lib/cmake/Qt6
cmake --build build-android
Usage
Server
# Start with default settings (looks for scarchat.db, server.pem, server.key in current directory)
./scarchat-server
# Specify custom paths
./scarchat-server --db /path/to/custom.db \
--cert /path/to/cert.pem \
--key /path/to/key.pem
Server Configuration:
- Database:
scarchat.db(auto-created on first run) - SSL Certificate:
server.pemor via--cert - SSL Key:
server.keyor via--key - Config:
server.jsonwith hardcoded defaults as fallback
Client
./scarchat
Client Configuration:
- Settings stored in
$XDG_CONFIG_HOME/scarchat/client.json(Linux) or%APPDATA%/scarchat/client.json(Windows) - Remembers last username, server IP/hostname, port, and JWT token
Database Management
Use the dbmanager tool for user administration:
# Create a user
./dbmanager adduser alice password123
# Create admin with avatar
./dbmanager adduser admin adminpass /path/to/avatar.jpg
./dbmanager modifyrole admin admin
# List all users
./dbmanager list
# Search users
./dbmanager search role admin
# Fetch user details
./dbmanager fetch alice
# Modify user
./dbmanager modifypass alice newpassword
./dbmanager modifyemail alice alice@example.com
See dbmanager/README.md for complete documentation.
Database Schema
The scarchat.db SQLite database contains:
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
password TEXT NOT NULL, -- Argon2 hash
salt TEXT NOT NULL,
token TEXT, -- JWT session token
status TEXT DEFAULT 'offline',
role TEXT, -- Optional
email TEXT, -- Optional
last_login INTEGER, -- Unix timestamp
avatar_pic BLOB -- Optional
);
Security Model
-
Client → Server Login:
- Client sends username + plaintext password over SSL
- Server fetches user's SALT from database
- Server computes Argon2 hash and verifies
- Server generates JWT token on success
-
Session Management:
- JWT stored in database TOKEN field and client config
- All subsequent requests authenticated via JWT
-
Transport Security:
- All connections enforce SSL/TLS
- No plaintext transmission outside SSL layer
Windows Installer
Build the MSI installer using WiX Toolset:
# After building the Release binaries
cd installer
candle -ext WixUIExtension installer.wxs
light -ext WixUIExtension -out "Scar Chat.msi" installer.wixobj
Development Progress
See PROGRESS.md for detailed feature implementation status and dependencies.
License
[Specify your license here]
Contributing
[Contribution guidelines if applicable]
Troubleshooting
Linux: Missing Pipewire/Portal
Ensure pipewire and xdg-desktop-portal-hyprland (or appropriate portal) are installed and running:
systemctl --user status pipewire
Windows: FFmpeg not found
Add FFmpeg library paths to CMake:
cmake -DFFMPEG_ROOT=/path/to/ffmpeg ..
SSL Certificate Errors
Generate self-signed certificates for testing:
openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.pem -days 365 -nodes
Project Status: In Development - See PROGRESS.md for current milestone