From 98883edb92858e1ef74c008457e8c210d1ceaeff Mon Sep 17 00:00:00 2001 From: Ivan FB Date: Fri, 17 Jul 2026 18:07:31 +0200 Subject: [PATCH] fix(channels): default channels to unencrypted so messages flow Channels encrypt on egress and decrypt on ingress through the Encrypt/ Decrypt request brokers. Nothing in the production/FFI path registered a provider, so every send failed at encryption before reaching the wire and every receive failed at decryption before reassembly. The net effect was that channel_send put nothing on the network and channel_message_received never fired. Install the pass-through noop provider in ReliableChannelManager.start(), the symmetric spot to MessagingClient.start() wiring MessagingSend, on the same FFI worker thread the channel handlers run on (the brokers are thread-local). setProvider refuses to overwrite, so an application that installs its own encryption before start keeps it; otherwise channels default to unencrypted payloads. Co-Authored-By: Claude Opus 4.8 --- .../channels/reliable_channel_manager.nim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/logos_delivery/channels/reliable_channel_manager.nim b/logos_delivery/channels/reliable_channel_manager.nim index 6f8ca14dc..37a53aaf1 100644 --- a/logos_delivery/channels/reliable_channel_manager.nim +++ b/logos_delivery/channels/reliable_channel_manager.nim @@ -18,6 +18,7 @@ import logos_delivery/api/reliable_channel_manager_api import logos_delivery/api/conf/channels_conf import ./reliable_channel +import ./encryption/noop_encryption export reliable_channel, channels_conf @@ -40,10 +41,15 @@ proc new*( ) proc start*(self: ReliableChannelManager): Result[void, string] = - ## Placeholder: per-channel listeners are installed in `ReliableChannel.new`, - ## so the manager has nothing to start at this layer. Kept for symmetry - ## with the `Waku` mount/start lifecycle and as a hook for future state. - discard + ## Per-channel listeners are installed in `ReliableChannel.new`, so the only + ## thing to wire up here is the encryption brokers. Channels encrypt on egress + ## and decrypt on ingress via the `Encrypt`/`Decrypt` request brokers; with no + ## provider registered every send and receive would fail, so `channel_send` + ## would never reach the wire and `ChannelMessageReceivedEvent` would never + ## fire. Install the pass-through noop so channels default to unencrypted + ## payloads. `setProvider` refuses to overwrite, so an application that + ## installed its own encryption before start keeps it. + setNoopEncryption() ok() proc stop*(self: ReliableChannelManager) {.async.} =