Skip to content

feat: wire up E2EE send, inbound decryption, file attach, and encrypted thumbnails#395

Open
AbelOsaretin wants to merge 1 commit into
codebestia:mainfrom
AbelOsaretin:feat/e2ee-send-inbound-file-thumbnail
Open

feat: wire up E2EE send, inbound decryption, file attach, and encrypted thumbnails#395
AbelOsaretin wants to merge 1 commit into
codebestia:mainfrom
AbelOsaretin:feat/e2ee-send-inbound-file-thumbnail

Conversation

@AbelOsaretin

Copy link
Copy Markdown

Closes #353, Closes #354, Closes #355, Closes #356

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Bug fix (non-breaking change that fixes an issue)

Summary

This PR wires up the end-to-end encryption pipeline across the conversation UI, covering four critical E2EE gaps: encrypted send, inbound decryption, file attachment encryption, and encrypted thumbnail rendering. Previously, the send path emitted plaintext, the inbound pipeline was never called, file encryption existed but had no UI, and thumbnail components were orphaned.

Motivation / Context

The E2EE crypto primitives (lib/crypto.ts, lib/fileEncryption.ts, lib/thumbnail.ts) and pipeline components (useInboundPipeline, EncryptedThumbnail, UnavailableMessagePlaceholder) all existed but were disconnected from the live conversation route. This PR integrates them:

#353 — Per-device message encryption + envelope assembly in the send path:

  • app/app/conversations/[id]/page.tsx now calls sendEncryptedMessage which uses buildEnvelopes/sealedBoxEncrypt to produce per-device sealed ciphertext
  • Socket emit sends per-device envelopes built from real ciphertext — raw plaintext never appears in any outgoing field
  • device_set_mismatch retry handles concurrent device changes

#354 — Inbound decryption + render pipeline:

  • Wires useInboundPipeline for both live socket delivery (message_envelope, device_envelope) and /sync backfill
  • Session keys are registered via setSessionKey/importSessionKey when sessions are established
  • Messages that cannot be decrypted render UnavailableMessagePlaceholder with clear reason text, distinct from bug-caused failures

#355 — File encryption/decryption wired into file-attach UI:

  • File-attach button triggers encryptFilerequestPresignedUploaduploadCiphertextToS3sendEncryptedFile
  • The file's decryption key travels inside per-device envelope ciphertext, never as a separate plaintext field
  • Receiving a file message calls downloadAndDecryptFile to retrieve and decrypt client-side

#356 — Encrypted thumbnails wired into message rendering:

  • Image/video file messages generate and upload encrypted thumbnails via generateEncryptedThumbnail
  • EncryptedThumbnail component renders decrypted preview inline after local decrypt
  • Thumbnail round-trips through encrypt/upload/download/decrypt without exposing plaintext image bytes

Closes #353, Closes #354, Closes #355, Closes #356

…ed thumbnails

- Issue codebestia#353: Per-device message encryption using buildEnvelopes/sealedBoxEncrypt
  in the send path. Socket emit sends per-device envelopes from real ciphertext,
  raw plaintext never appears in outgoing fields.

- Issue codebestia#354: Inbound decryption pipeline via useInboundPipeline for live socket
  delivery and /sync backfill. Messages that cannot decrypt render clear
  UnavailableMessagePlaceholder states distinct from bugs.

- Issue codebestia#355: File-attach control with encryptFile/requestPresignedUpload/
  uploadCiphertextToS3/sendEncryptedFile. File decryption key travels inside
  per-device envelope ciphertext, not as plaintext. Receiving side calls
  downloadAndDecryptFile for client-side decryption.

- Issue codebestia#356: Encrypted thumbnails via generateEncryptedThumbnail for image/video
  messages. EncryptedThumbnail component renders decrypted preview inline.
  Thumbnail round-trips through encrypt/upload/download/decrypt without
  exposing plaintext bytes.

- Added comprehensive E2EE test suite covering per-device encryption,
  decrypt round-trips, file encryption, and thumbnail encryption.
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@AbelOsaretin Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant