-
Notifications
You must be signed in to change notification settings - Fork 4
Architecture
This page describes the overall architecture of QuietDrop, its components, and how they interact.
QuietDrop now follows a modern architecture with a shared core library and multiple interface options: a CLI for command-line operations and a cross-platform application built with Tauri 2.0 for desktop and mobile devices.
graph TD
subgraph "QuietDrop System"
subgraph "Core Library"
A[Authentication Module] --> Core[quietdrop-core]
E[Encryption Module] --> Core
M[Message Module] --> Core
C[Client Module] --> Core
S[Server Module] --> Core
end
subgraph "Interfaces"
CLI[Command Line Interface] --> Core
subgraph "Tauri Application"
TA[Tauri Backend] --> Core
YF[Yew Frontend] <--> TA
TA --> DP[Desktop Platforms]
TA --> MP[Mobile Platforms]
end
end
Server[Server Instance] <--> CLI
Server <--> TA
end
DP --> Windows[Windows]
DP --> MacOS[macOS]
DP --> Linux[Linux]
MP --> Android[Android]
MP --> iOS[iOS]
Client1[Client 1] <-->|Encrypted Messages| Server
Client2[Client 2] <-->|Encrypted Messages| Server
QuietDrop uses a Rust workspace with multiple crates:
graph TD
W[Workspace] --> Core[quietdrop-core]
W --> CLI[quietdrop-cli]
W --> Tauri[quietdrop-tauri]
Core --> A[authentication.rs]
Core --> E[encryption.rs]
Core --> M[message.rs]
Core --> C[client.rs]
Core --> S[server.rs]
CLI --> main[main.rs]
Tauri --> Frontend[Yew Frontend]
Tauri --> Backend[Tauri Backend]
Frontend --> Components[UI Components]
Frontend --> Services[Service Layer]
Backend --> Commands[Tauri Commands]
Backend --> Handlers[Event Handlers]
Handles user authentication and password security:
- Password hashing using Argon2id algorithm
- Salt generation and management
- Password verification
// Key functions
pub fn hash_password(password: &str) -> Result<(String, String)>
pub fn verify_password(hashed_password: &str, salt: &str, password: &str) -> Result<bool>
Manages cryptographic operations:
- Key pair generation for asymmetric encryption
- Message encryption and decryption
- Uses libsodium (via sodiumoxide) for cryptographic primitives
// Key functions
pub fn generate_keypair() -> KeyPair
pub fn encrypt_message(message: &str, public_key: &PublicKey, secret_key: &SecretKey) -> Vec<u8>
pub fn decrypt_message(encrypted_data: &[u8], public_key: &PublicKey, secret_key: &SecretKey) -> Result<String, &'static str>
Defines message structure and handling:
- Message serialization and deserialization
- Message types (text, file, etc.)
- Content encryption
// Data structures
pub struct Message {
pub timestamp: DateTime<Utc>,
pub message_type: MessageType,
pub sender: String,
pub recipient: String,
pub content: Vec<u8>,
pub public_key: PublicKey,
}
pub enum MessageType {
Text,
File,
}
Manages the client side of communication:
- Connection to server
- Message sending
- User interface interaction
// Key functions
pub async fn send_message(message: &Message, server_addr: &str) -> Result<(), Box<dyn std::error::Error>>
Handles server-side operations:
- Listening for client connections
- Message routing
- Rate limiting for security
// Key functions
pub async fn run_server(addr: &str, server_secret_key: &SecretKey) -> Result<(), Box<dyn std::error::Error>>
The Tauri 2.0 application provides a cross-platform interface for QuietDrop:
Built entirely in Rust and compiled to WebAssembly:
- Component-based UI architecture
- State management using Yew hooks and contexts
- Responsive design for desktop and mobile
- Platform-specific adaptations
Bridges the frontend with the core library:
- Exposes core functionality through Tauri commands
- Manages application state
- Handles platform-specific features
- Provides system integration (file system, notifications, etc.)
sequenceDiagram
participant User
participant YewUI as Yew UI
participant TauriBackend as Tauri Backend
participant CoreLib as Core Library
participant Server
User->>YewUI: Interact with UI
YewUI->>TauriBackend: Call Tauri command
TauriBackend->>CoreLib: Use core functionality
CoreLib->>Server: Send encrypted message
Server-->>CoreLib: Acknowledge message
CoreLib-->>TauriBackend: Return result
TauriBackend-->>YewUI: Update UI state
YewUI-->>User: Show confirmation
- Both server and clients generate their own key pairs (public and private keys)
- Server's public key is stored in a file that clients can access
- Clients send their public key along with each message
- Client constructs a message with sender, recipient, and content
- Client encrypts the message content using:
- Recipient's public key (or server's public key in current implementation)
- Client's private key
- Encrypted message is sent to the server
- Server receives the encrypted message
- Server decrypts the message using:
- Sender's public key (included in the message)
- Server's private key
- Server processes the message and can relay it to other clients
- Core Language: Rust (for memory safety and performance)
- Frontend Framework: Yew (Rust-based UI framework)
- Application Framework: Tauri 2.0 (cross-platform deployment)
- Cryptography: sodiumoxide (Rust bindings for libsodium)
- Networking: Tokio (asynchronous runtime)
- Serialization: Serde (for structuring messages)
- Password Hashing: Argon2 (memory-hard function resistant to attacks)
- Database (planned): SQLite with sqlx for persistent storage
- End-to-End Encryption: Messages can only be decrypted by intended recipients
- Forward Secrecy: Compromise of keys doesn't expose past communications
- Authentication: Strong password hashing prevents credential theft
- Rate Limiting: Protects against brute force and DoS attacks
- Process Isolation: Tauri's architecture separates the frontend (WebView) from backend (Rust)
- Platform Security: Leverages platform-specific security features on desktop and mobile
graph TD
subgraph "Platform-Specific Features"
subgraph "Desktop"
DT[System Tray]
DW[Multiple Windows]
DN[Desktop Notifications]
DFS[File System Access]
end
subgraph "Mobile"
MP[Push Notifications]
MB[Biometric Authentication]
MC[Camera Access]
MPH[Photo Library]
end
subgraph "Shared"
SE[Secure Storage]
SN[Network Communication]
SC[Clipboard Access]
SD[Dialog Windows]
end
end
- UI Adaptation: Components adapt to different screen sizes and input methods
- Platform Detection: Runtime detection of platform for feature availability
- Resource Management: Different strategies for desktop and mobile
- Permission Handling: Platform-specific permission requests and management
- Database Integration: SQLite with sqlx for message persistence and user management
- Federation Protocol: To allow communication between different QuietDrop servers
- Push Notification Service: For mobile message delivery
- Offline Capabilities: Local-first architecture with synchronization
Current deployment is simplified for development:
graph TD
subgraph "Development Environment"
Server[Server Instance]
CLI[CLI Client]
Desktop[Desktop App]
Mobile[Mobile App]
CLI -->|Connects to| Server
Desktop -->|Connects to| Server
Mobile -->|Connects to| Server
end
Future scalable deployment architecture:
graph TD
subgraph "Server Infrastructure"
LB[Load Balancer]
subgraph "Server Cluster"
S1[Server 1]
S2[Server 2]
S3[Server 3]
end
subgraph "Database Cluster"
DB1[(Primary DB)]
DB2[(Replica DB)]
end
LB --> S1
LB --> S2
LB --> S3
S1 <--> DB1
S2 <--> DB1
S3 <--> DB1
DB1 <-->|Replication| DB2
end
subgraph "Clients"
DC[Desktop Clients]
MC[Mobile Clients]
end
DC --> LB
MC --> LB
For more detailed technical information, please see:
QuietDrop Wiki | Home | Getting Started | FAQ | Security Model | Architecture | Development Guide
Main Repository | Report Issues | Contributing
© 2023-2025 QuietDrop Contributors | MIT License
Last updated: April 2025