How jackjackbits/bitchat works
Project Type and Purpose
• Native iOS/macOS decentralized P2P messaging app
• No servers or internet—Bluetooth LE mesh network with end-to-end encryption
External Elements
• Other peer Device nodes (identical component stacks)
• Bluetooth LE radio/link between Device nodes
1. User action in View → ChatViewModel
2. ChatViewModel → Service Layer (e.g., sendMessage → EncryptionService → BinaryProtocol)
3. BinaryProtocol → BluetoothMeshService → CoreBluetooth API
4. CoreBluetooth API → Physical mesh → CoreBluetooth API on peer
5. Peer’s BluetoothMeshService → Protocol Layer → EncryptionService (decrypt) → ChatViewModel → View
Also show:
– DeliveryTracker/Retry/Retention as observers on inbound/outbound message streams
– KeychainManager used by EncryptionService & Channel management
– CompressionUtil and BloomFilter used inside Service/Protocol to compress and dedupe
Architectural Patterns & Design Principles
• MVVM for UI separation
• Service‐oriented: each service has single responsibility (encryption, networking, retry, retention)
• Protocol abstraction: clean separation between message semantics (BitchatProtocol) and on‐wire format (BinaryProtocol)
• Local‐first, peer‐to‐peer mesh with store‐and‐forward
Technologies & Frameworks
– SwiftUI (Views, declarative UI)
– Combine or Swift concurrency (async streams between ViewModel & Services)
– CoreBluetooth (Bluetooth LE mesh)
– Crypto libraries: X25519, Ed25519, AES-GCM, Argon2id
– LZ4 for compression
– Keychain for secure storage