naftal.co.ke
SPECIFICATION // SYS-04Encrypted Wire Protocol & 2FA

Real-Time LAN Messaging System

Air-gapped LAN messaging daemon and desktop client using a custom framed TCP binary protocol, RSA/AES hybrid encryption, and RFC 6238 TOTP two-factor authentication.

Controls
RSA/AES Hybrid CryptoRFC 6238 TOTP 2FABinary FramingAir-Gapped LAN
Stack
PythonAsyncio SocketsRSA/AESTOTP (RFC 6238)PyQt5SQLite
References
github.com/nafdev01/secure-lan-chat ↗

1.0 // Problem & Threat Context

Restricted internal networks require low-latency messaging with zero external SaaS dependencies, authenticated session establishment, and encrypted transport.

2.0 // Engineering Approach

Implemented an asyncio full-duplex TCP server in Python with length-prefixed binary framing, RSA key exchange bootstrapping per-session AES ciphers, and QR-enrolled TOTP 2FA.

3.0 // System Architecture

Self-contained client/server messaging system achieving <5ms LAN propagation, automatic exponential-backoff reconnection, and local SQLite transcript storage.

4.0 // Verification & Operational Outcome

Sustained 50+ concurrent encrypted sessions with zero packet framing loss and ~70% lower latency than HTTP/WebSocket equivalents.

5.0 // Interface & Telemetry Evidence [5]

CAPTURED LAB / PRODUCTION ARTIFACTS
TOTP 2FA enrollment with local QR secret provisioning
TOTP 2FA enrollment with local QR secret provisioning
Authentication gate enforcing credential + TOTP verification
Authentication gate enforcing credential + TOTP verification
Server-side RSA/AES key exchange and session establishment
Server-side RSA/AES key exchange and session establishment
Authenticated user session transcript
Authenticated user session transcript
Per-user audit and message history view
Per-user audit and message history view