Architecture
Technical overview of the Zentalk system architecture.
System Components
Zentalk consists of four core components:
| Component | Language | Purpose |
|---|---|---|
| zentalk-web | TypeScript/React | Client application, local encryption, key management |
| zentalk-api | Go | User registration, key distribution, message queuing |
| zentalk-node | Go | Relay network, 3-hop relay routing, mesh storage |
| zentalk-validator | Go | Network consensus, identity registration |
Encryption Layers
Zentalk applies multiple encryption layers to protect messages:
| Layer | Protocol | Purpose |
|---|---|---|
| E2EE | X3DH + Double Ratchet | End-to-end message encryption |
| Post-Quantum | Kyber-768 (ML-KEM) | Quantum-resistant key encapsulation |
| Symmetric | AES-256-GCM | Message payload encryption |
| Transport | TLS 1.3 | Network connection encryption |
| At-Rest | AES-256-GCM + PBKDF2 | Local storage encryption |
Cryptographic Primitives
Key Exchange
| Algorithm | Purpose | Key Size |
|---|---|---|
| X25519 | Elliptic curve Diffie-Hellman | 32 bytes |
| Ed25519 | Digital signatures | 32/64 bytes (pub/priv) |
| Kyber-768 | Post-quantum KEM | 1184/2400 bytes (pub/priv) |
Symmetric Encryption
| Algorithm | Purpose | Parameters |
|---|---|---|
| AES-256-GCM | Message encryption | 256-bit key, 96-bit nonce, 128-bit tag |
| HKDF-SHA256 | Key derivation | Variable output length |
| PBKDF2-SHA256 | Password-based KDF | 600,000 iterations |
Hashing
| Algorithm | Purpose | Output |
|---|---|---|
| SHA-256 | General hashing, HKDF | 256 bits |
| BLAKE2b | Fast hashing, fingerprints | 256 bits |
Message Flow
Messages pass through multiple stages:
- Sender encrypts using X3DH + Double Ratchet
- Optional PQC layer with Kyber-768
- AES-256-GCM seal for symmetric encryption
- API receives encrypted payload
- Relay network routes via 3-hop relay (Guard → Middle → Exit)
- Recipient decrypts in reverse order
Key Types
| Key | Lifetime | Purpose |
|---|---|---|
| Identity Key (IK) | Long-term | User identification, signing |
| Signed Pre-Key (SPK) | Weekly rotation | Initial key exchange |
| One-Time Pre-Key (OPK) | Single use | Forward secrecy for first message |
| Ephemeral Key (EK) | Per session | Session forward secrecy |
| Chain Key (CK) | Per ratchet step | Derive message keys |
| Message Key (MK) | Single use | Encrypt one message |
Data Storage
Client-Side
| Data | Storage | Encryption |
|---|---|---|
| Private keys | IndexedDB | AES-256-GCM + device key |
| Session state | IndexedDB | AES-256-GCM |
| Message cache | IndexedDB | Plaintext (already E2EE) |
| Key backup | Mesh storage | AES-256-GCM + PBKDF2 |
Server-Side
| Data | Storage | Access |
|---|---|---|
| Public key bundles | PostgreSQL | Read by any authenticated user |
| Encrypted messages | Queue | Deleted after delivery |
| User metadata | Minimal | Address, public keys only |
Mesh Storage
Decentralized storage for privacy-preserving data:
| Module | Purpose |
|---|---|
| messages | Store-and-forward encrypted messages |
| media | Chunked media with per-chunk encryption |
| keys | E2EE key bundle distribution |
| profile | Encrypted profile data sync |
| call-history | Private call logs |
Replication & Redundancy
| Parameter | Value |
|---|---|
| Replication factor | 3 nodes minimum |
| Retention period | 72 hours (configurable) |
| Chunk size (media) | 256 KB |
| Node selection | DHT-based, XOR distance |
Zero-Knowledge Guarantees
The server sees only encrypted blobs. Decryption happens client-side.
| Data Layer | Server Access |
|---|---|
| Encrypted blob | Can store |
| Encryption key | Cannot access |
| File metadata | Cannot read |
| Access patterns | Minimized via padding |
Security Headers
| Header | Value | Purpose |
|---|---|---|
| Cross-Origin-Opener-Policy | same-origin | Prevent cross-origin attacks |
| Cross-Origin-Embedder-Policy | credentialless | Enable SharedArrayBuffer |
| Content-Security-Policy | strict | XSS prevention |
Related Documentation
- Protocol Specification - Detailed cryptographic protocols
- Getting Started - Installation and setup
- Run a Node - Validator node operation
Last updated on