Description
The bundled Matrix adapter at crates/openfang-channels/src/matrix.rs is plaintext-only — it has no end-to-end encryption support. Most production Matrix deployments use encrypted rooms by default (Element creates DMs and most new rooms encrypted), so the adapter is effectively unusable in those rooms today.
Verified against v0.6.4 (3cce1eb):
$ wc -l crates/openfang-channels/src/matrix.rs
542 crates/openfang-channels/src/matrix.rs
$ grep -c -iE 'encrypted|olm|megolm' crates/openfang-channels/src/matrix.rs
0
Zero matches for encrypted, olm, or megolm — no olm/megolm session management, no m.room.encrypted decryption, no outbound encryption, no key recovery, no cross-signing.
Expected Behavior
When [channels.matrix] is configured against a bot account that lives in encrypted rooms:
- Inbound
m.room.encrypted events are decrypted using a persisted olm/megolm session store (typical pattern: SQLite store keyed by a stable device_id).
- Outbound replies into encrypted rooms are encrypted with the room's megolm session.
- A configurable cross-signing / recovery-key option exists so the device can verify itself across restarts and key rotations.
- The session/crypto store survives daemon restarts.
For comparison: matrix-rust-sdk (LGPL/MIT in apps that depend on it via the standard Cargo path; the SDK itself is Apache-2.0) provides this out of the box via Client::builder().sqlite_store(..).build() with the e2e-encryption + sqlite features. The Hermes project's gateway/platforms/matrix.py uses the equivalent in mautrix-python (mautrix[encryption]) and serves as a reference for what the surface area looks like.
Steps to Reproduce
- Create a Matrix bot account on any homeserver.
- Invite the bot into a default-encrypted room (Element-created DM works).
- Configure OpenFang v0.6.4 with
[channels.matrix] pointing at that account.
- From the room, send the bot a message.
- Observe the bot either silently drops the event or logs an inability to decrypt; outbound responses are sent unencrypted (and rejected/undecryptable by encrypted-room participants).
OpenFang Version
0.6.4 (commit 3cce1eb3fb19ad590a0937e039a8bf8bc09aba13)
Operating System
macOS (Apple Silicon) and Linux x86_64 — the gap is substrate-independent (it is a missing implementation, not a build issue).
Logs / Screenshots
Indirect evidence — the source itself:
$ grep -c -iE 'encrypted|olm|megolm' crates/openfang-channels/src/matrix.rs
0
When deployed in an encrypted room, downstream symptoms are typically:
m.room.encrypted events with empty body and algorithm: "m.megolm.v1.aes-sha2"
- Outbound messages visible only to non-encrypted observers / not decryptable by room members
Suggested Direction
Two reasonable paths:
- Re-host the adapter on
matrix-rust-sdk — the Rust-native SDK with first-class olm/megolm + SqliteCryptoStore + cross-signing. Pro: minimal surface to maintain, idiomatic Rust. Con: adds a fairly large dep tree.
- Document the gap and recommend a host-side sidecar for E2EE-required deployments, with the bundled adapter explicitly marked plaintext-only in the docs.
Happy to test against a branch and provide a reference deployment if helpful.
Description
The bundled Matrix adapter at
crates/openfang-channels/src/matrix.rsis plaintext-only — it has no end-to-end encryption support. Most production Matrix deployments use encrypted rooms by default (Element creates DMs and most new rooms encrypted), so the adapter is effectively unusable in those rooms today.Verified against
v0.6.4(3cce1eb):$ wc -l crates/openfang-channels/src/matrix.rs 542 crates/openfang-channels/src/matrix.rs $ grep -c -iE 'encrypted|olm|megolm' crates/openfang-channels/src/matrix.rs 0Zero matches for
encrypted,olm, ormegolm— no olm/megolm session management, nom.room.encrypteddecryption, no outbound encryption, no key recovery, no cross-signing.Expected Behavior
When
[channels.matrix]is configured against a bot account that lives in encrypted rooms:m.room.encryptedevents are decrypted using a persisted olm/megolm session store (typical pattern: SQLite store keyed by a stabledevice_id).For comparison:
matrix-rust-sdk(LGPL/MIT in apps that depend on it via the standard Cargo path; the SDK itself is Apache-2.0) provides this out of the box viaClient::builder().sqlite_store(..).build()with thee2e-encryption+sqlitefeatures. The Hermes project'sgateway/platforms/matrix.pyuses the equivalent inmautrix-python(mautrix[encryption]) and serves as a reference for what the surface area looks like.Steps to Reproduce
[channels.matrix]pointing at that account.OpenFang Version
0.6.4 (commit
3cce1eb3fb19ad590a0937e039a8bf8bc09aba13)Operating System
macOS (Apple Silicon) and Linux x86_64 — the gap is substrate-independent (it is a missing implementation, not a build issue).
Logs / Screenshots
Indirect evidence — the source itself:
When deployed in an encrypted room, downstream symptoms are typically:
m.room.encryptedevents with emptybodyandalgorithm: "m.megolm.v1.aes-sha2"Suggested Direction
Two reasonable paths:
matrix-rust-sdk— the Rust-native SDK with first-class olm/megolm + SqliteCryptoStore + cross-signing. Pro: minimal surface to maintain, idiomatic Rust. Con: adds a fairly large dep tree.Happy to test against a branch and provide a reference deployment if helpful.