Skip to main content

6. Messages and Attachments

Work in progress — not audited

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

6.1 Application message path​

  1. User plaintext composed in UI.
  2. Serialized to an application envelope (JSON-based in current implementation).
  3. Encrypted through the cascade (Chapter 4).
  4. Sent over WebRTC data channel via MLSProvider / PeerJS.

6.2 Wire format​

Normative PDU catalog and schemas: P4. PDU catalog.

Cascade envelope: P5. Cascade wire encoding.

Processing rules (encrypt/decrypt): P6. Processing rules.

Encoding: JSON UTF-8 on WebRTC data channels; every PDU has a type string. Profile: EnkryptedChat-Profile-v0 (single implementation; not an interoperability standard yet).

Peers MUST reject messages that fail decryption at any cascade layer (P6).

6.3 Text messages​

Text messages use the full cascade when enableCascadingCipher is true in the product shell.

6.4 File transfer​

Two paths exist:

6.4.1 Standard path (cascade + chunking)​

  • Files are split into chunks sized for data channel limits.
  • Chunks are encrypted with the same cascade as messages.
  • Reassembly occurs on the receiver.

Suitable when full application E2EE is required.

6.4.2 Fast file transfer (optional)​

When enableFastFileTransfer is enabled:

  • A optimized WebRTC data channel path may transfer file data with reduced or bypassed cascade overhead for performance.
  • User toggles this in settings (persisted in localStorage).

Security tradeoff: Fast path prioritizes throughput over full cascade protection. The specification requires this behavior to be documented in UI and user-controlled.

6.5 Local files, OPFS, and editor​

Enkrypted Chat stores files in OPFS (Origin Private File System) by default, with optional folder mount. Features include in-browser preview and document editing.

6.6 Encryption at rest (work in progress)​

At-rest encryption is in active development. Intended design:

ElementBehavior
Data encryption key (DEK)Cryptographically random, encrypts local vault
DEK wrappingUser unlock via passkey, passcode, or password
Recovery passwordGenerated at setup; user prompted to back up

Until shipped, local data MAY be stored without at-rest encryption depending on build flags — treat as high risk on shared devices.

6.7 Calendar and plan data​

Calendar events are managed locally in the browser for the Plan feature. They inherit the same at-rest posture as other local app data.

6.8 Multimedia in chat​

Images, video, and animations sent as chat attachments follow the file/message paths above. Large media SHOULD prefer chunked standard path unless user enables fast transfer.