Skip to main content

2. Architecture and Trust

Work in progress — not audited

This chapter is part of an initial draft specification. Enkrypted Chat has not been independently audited. Content may change.

2.1 Design stance

Enkrypted Chat is not “serverless.” It is message-serverless: there is no central service that stores or decrypts conversation content. Limited infrastructure remains for signaling, NAT traversal, and static asset delivery. Honest documentation of those components is required for professional review.

2.2 High-level architecture

2.3 Layered stack (summary)

LayerResponsibility
PresentationReact UI (ui, app shell)
Session / P2PMLSProvider, PeerJS, WebRTC data channels
Application cryptoCascading cipher + Signal WASM
Transport cryptoWebRTC DTLS, SRTP (media)
Local persistenceOPFS, IndexedDB (files, keys — at-rest encryption WIP)

Full encrypt order: Chapter 4. Transport detail: Chapter 3.

2.4 Module federation

Module Federation is central to the architecture. The chat shell dynamically loads:

  • ui — Components (contacts, chat, QR connect UI, file browser, etc.)
  • p2pMLSProvider, messaging, calls, file transfer
  • cryptography — MLS, Signal WASM, cascading cipher, SFrame managers

Implications:

  • Runtime dependency on remote entry URLs (supply-chain risk).
  • Version skew between shell and remotes MUST be managed in deployments.
  • Self-hosting MUST include all federated entry points, not only the shell bundle.

See Decentralized architecture and Statics as infrastructure.

2.5 Trust boundaries

ComponentTrust levelRationale
Remote peerUntrustedMalicious peer may send invalid ciphertext; crypto must fail closed.
Signaling serverSemi-trustedSees peer IDs, SDP, ICE candidates, connection timing; MUST NOT receive message plaintext.
TURN relaySemi-trustedMay see IPs, packet sizes/timing; in relay-mode carries ciphertext blobs only.
CDN / static hostSemi-trustedCan serve trojaned JS if compromised; mitigated by self-host, CSP, SRI (Chapter 8).
Federation remotesSemi-trustedSame class as CDN for code integrity.
Browser / OSTCBExecutes all crypto; spec assumes non-malicious browser.
Local storage (OPFS)User-trustedProtected by at-rest encryption when enabled (Chapter 6).

2.6 Infrastructure truth table

ComponentUsed todaySelf-hostableCarries message plaintext?
Signaling (PeerJS broker)YesYesNo
Static hosting (S3/CDN)YesYesNo (serves code only)
STUN/TURNYesYes (user keys)No (encrypted payloads)
Central message storeNoN/AN/A
Offline message relayNo (planned)PlannedFuture spec

2.7 Comparison: centralized vs Enkrypted Chat

AspectCentralized (e.g. Signal, WhatsApp)Enkrypted Chat
Message routingThrough operator serversDirect P2P when connected
Pre-key / async deliveryServer-backedRequires both peers online (broker signaling only)
Operator metadataTypically collectedReduced for content; signaling/TURN metadata remains
Account systemPhone/email identityPeer ID only (no registration server)
Video E2EEProduct-dependentWebRTC + experimental SFrame layer

Extended comparison tables: Chapter 11 and migrated analysis in project audit materials.

2.8 Multi-device (partial prototype)

Multi-device sync is a partial prototype. The specification documents intended direction in Chapter 11; normative requirements for production multi-device are not defined in this draft.