Skip to content

feat: migrate messages content to ciphertext (#173)#249

Open
Gabugo-tech wants to merge 2 commits into
codebestia:mainfrom
Gabugo-tech:feature/173-migrate-messages-ciphertext
Open

feat: migrate messages content to ciphertext (#173)#249
Gabugo-tech wants to merge 2 commits into
codebestia:mainfrom
Gabugo-tech:feature/173-migrate-messages-ciphertext

Conversation

@Gabugo-tech

Copy link
Copy Markdown

Description

This PR migrates the messages table and its dependent codebase to use E2E encrypted ciphertext payloads instead of plain text content. This prepares the backend for group/MLS single-ciphertext messages where the server can no longer read the contents of messages directly.

Changes Made:

  • Database Schema (apps/backend/src/db/schema.ts):
    • Dropped the content column in the messages table.
    • Added a nullable ciphertext column.
    • Removed the messages_content_search_idx Gin index that was built for full-text search on plain text content.
  • Message Serialization (apps/backend/src/lib/messages.ts):
    • Updated serializeMessage to accept and correctly handle ciphertext.
  • API & Routes (apps/backend/src/routes/conversations.ts):
    • Removed the GET /:id/search full-text search endpoint since the backend can no longer query plain text message content.
  • Websockets Integration (apps/backend/src/socket/messaging.ts):
    • Replaced content payloads with ciphertext in send_message and ask_assistant event handlers.
  • Testing:
    • Migrated all mock values and testing payloads to use ciphertext instead of content.
    • Deleted full-text search endpoint unit tests.

Related Issues

Acceptance Criteria

  • content column dropped; ciphertext added (nullable)
  • serializeMessage no longer references plaintext
  • Message insert paths and sockets updated
  • Search removal coordinated
  • Application successfully compiles and all tests pass

closes #173

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Gabugo-tech 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

@codebestia

Copy link
Copy Markdown
Owner

@Gabugo-tech
Please fix the CI

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add messages.ciphertext for single-blob messages + remove plaintext content

2 participants