Skip to content

feat(messaging): add native Matrix adapter with E2EE support#20

Open
ProductOfAmerica wants to merge 1 commit intospacedriveapp:mainfrom
ProductOfAmerica:main
Open

feat(messaging): add native Matrix adapter with E2EE support#20
ProductOfAmerica wants to merge 1 commit intospacedriveapp:mainfrom
ProductOfAmerica:main

Conversation

@ProductOfAmerica
Copy link

Add a full Matrix messaging adapter with end-to-end encryption, streaming responses, and frontend UI support.

Backend (src/messaging/matrix.rs)

  • Password login, access token restore, and persistent session via session.json
  • E2EE out of the box via matrix-sdk's e2e-encryption + sqlite store
  • Streaming responses via message edits (300ms throttle)
  • Typing indicators with auto-repeat
  • Auto-join on room invite
  • File attachment support (images, documents, audio, video via mxc:// URLs)
  • DM access control (dm_allowed_users allowlist)
  • History backfill for conversation context
  • Message splitting at 4096-char Matrix limit

Config (src/config.rs)

  • MatrixConfig and MatrixPermissions structs with hot-reload support
  • Binding matching via matrix_room_id metadata key

API (src/api/server.rs)

  • Matrix status in /api/messaging/status endpoint
  • create_binding support with Matrix credentials
  • Fix: add missing telegram field to MessagingStatusResponse

Frontend (interface/)

  • Matrix platform card, setup dialog (homeserver URL, user ID, password/access token)
  • Matrix binding support with optional Room ID filter
  • API types for Matrix credentials and status

Docs

  • matrix-setup.mdx setup guide covering account creation, TOML config, E2EE, DM access control, and platform notes

Tested:

  • Password login to matrix.org
  • E2EE message receive/send in encrypted rooms
  • Streaming response edits
  • History backfill
  • Auto-join
  • Frontend settings UI renders Matrix card and setup dialog
  • Bindings section shows Matrix with Room ID field

@ProductOfAmerica
Copy link
Author

@jamiepine Hey! Couple of questions:

  1. matrix-sdk version — I built this against matrix-sdk 0.9 since it's the latest version compatible with sqlx 0.8. The latest matrix-sdk is 0.16, but it pulls in rusqlite 0.37libsqlite3-sys 0.35, which conflicts with sqlx's libsqlite3-sys 0.28-0.30 (Cargo enforces a single links = "sqlite3" in the dep graph). Upgrading to matrix-sdk 0.16 would require bumping sqlx to 0.9 (currently alpha). Any preference on how to handle this?

  2. Telegram status bug — While working on this I noticed MessagingStatusResponse in server.rs was missing the telegram field entirely, so the status endpoint never reported Telegram. I included the fix in this PR since it was a one-liner — let me know if you'd prefer it as a separate commit/PR.

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.

1 participant

Comments