|
Radix Relay
Hybrid mesh communications with Signal Protocol encryption
|
Handles processing of incoming and outgoing Nostr messages. More...
#include <message_handler.hpp>
Public Member Functions | |
| message_handler (std::shared_ptr< Bridge > bridge) | |
| Constructs a message handler. | |
| auto | handle (const nostr::events::incoming::encrypted_message &event) -> std::optional< core::events::message_received > |
| Handles an incoming encrypted message event. | |
| auto | handle (const core::events::send &cmd) -> std::pair< std::string, std::vector< std::byte > > |
| Handles a send command by encrypting and serializing a message. | |
| auto | handle (const core::events::publish_identity &) -> publish_bundle_result |
| Handles a publish identity command by generating and serializing a bundle. | |
| auto | handle (const core::events::unpublish_identity &) -> std::pair< std::string, std::vector< std::byte > > |
| Handles an unpublish identity command by generating an empty bundle. | |
| auto | handle (const core::events::trust &cmd) -> void |
| Handles a trust command by assigning an alias to a peer. | |
| auto | handle (const core::events::establish_session &cmd) -> std::optional< core::events::session_established > |
| Handles session establishment from bundle data. | |
Static Public Member Functions | |
| static auto | handle (const nostr::events::incoming::bundle_announcement &event) -> std::optional< std::variant< core::events::bundle_announcement_received, core::events::bundle_announcement_removed > > |
| Handles an incoming bundle announcement event. | |
| static auto | handle (const core::events::subscribe &cmd) -> std::pair< std::string, std::vector< std::byte > > |
| Handles a subscription request. | |
| static auto | handle (const nostr::events::incoming::ok &event) -> void |
| Handles an incoming OK response (logs only). | |
| static auto | handle (const nostr::events::incoming::eose &event) -> void |
| Handles an incoming EOSE marker (logs only). | |
| static auto | handle (const nostr::events::incoming::unknown_message &event) -> void |
| Handles an unknown message type (logs warning). | |
| static auto | handle (const nostr::events::incoming::unknown_protocol &event) -> void |
| Handles an unknown protocol message (logs warning). | |
| static auto | handle (const nostr::events::incoming::identity_announcement &) -> void |
| Handles an incoming identity announcement (no-op). | |
| static auto | handle (const nostr::events::incoming::session_request &) -> void |
| Handles an incoming session request (no-op). | |
| static auto | handle (const nostr::events::incoming::node_status &) -> void |
| Handles an incoming node status update (no-op). | |
Handles processing of incoming and outgoing Nostr messages.
| Bridge | Type satisfying the signal_bridge concept |
Converts between Nostr events and internal event types, handling encryption/decryption, bundle management, and event serialization.
Definition at line 44 of file message_handler.hpp.
|
inlineexplicit |
Constructs a message handler.
| bridge | Signal Protocol bridge for crypto operations |
Definition at line 52 of file message_handler.hpp.
|
inline |
Handles session establishment from bundle data.
| cmd | Establish session command with bundle data |
Definition at line 257 of file message_handler.hpp.
|
inline |
Handles a publish identity command by generating and serializing a bundle.
| command | Publish identity command |
Definition at line 167 of file message_handler.hpp.
References radix_relay::nostr::protocol::event_data::content, radix_relay::nostr::protocol::event_data::created_at, radix_relay::nostr::publish_bundle_result::event_id, radix_relay::nostr::protocol::event::from_event_data(), radix_relay::nostr::protocol::event_data::id, radix_relay::nostr::protocol::event_data::pubkey, radix_relay::nostr::protocol::event_data::sig, and radix_relay::nostr::protocol::event_data::tags.
|
inline |
Handles a send command by encrypting and serializing a message.
| cmd | Send command containing peer and message |
Definition at line 122 of file message_handler.hpp.
References radix_relay::nostr::protocol::event_data::content, radix_relay::nostr::protocol::event_data::created_at, radix_relay::nostr::protocol::event::from_event_data(), radix_relay::nostr::protocol::event_data::id, radix_relay::nostr::protocol::event_data::pubkey, radix_relay::nostr::protocol::event_data::sig, and radix_relay::nostr::protocol::event_data::tags.
|
inlinestatic |
Handles a subscription request.
| cmd | Subscribe command with JSON filter |
Definition at line 270 of file message_handler.hpp.
|
inline |
Handles a trust command by assigning an alias to a peer.
| cmd | Trust command containing peer and alias |
Definition at line 249 of file message_handler.hpp.
|
inline |
Handles an unpublish identity command by generating an empty bundle.
| command | Unpublish identity command |
Definition at line 210 of file message_handler.hpp.
References radix_relay::nostr::protocol::event_data::content, radix_relay::nostr::protocol::event_data::created_at, radix_relay::nostr::protocol::event::from_event_data(), radix_relay::nostr::protocol::event_data::id, radix_relay::nostr::protocol::event_data::pubkey, radix_relay::nostr::protocol::event_data::sig, and radix_relay::nostr::protocol::event_data::tags.
|
inlinestatic |
Handles an incoming bundle announcement event.
| event | Bundle announcement from Nostr relay |
Definition at line 97 of file message_handler.hpp.
References radix_relay::nostr::protocol::bundle_announcement_minimum_version, radix_relay::nostr::extract_version_from_tags(), radix_relay::core::is_version_compatible(), radix_relay::core::events::bundle_announcement_received::pubkey, and radix_relay::core::events::bundle_announcement_removed::pubkey.
|
inline |
Handles an incoming encrypted message event.
| event | Encrypted message from Nostr relay |
Definition at line 60 of file message_handler.hpp.
References radix_relay::core::events::message_received::sender_rdx.
|
inlinestatic |
Handles an incoming EOSE marker (logs only).
| event | EOSE marker from relay |
Definition at line 301 of file message_handler.hpp.
|
inlinestatic |
Handles an incoming identity announcement (no-op).
| event | Identity announcement from relay |
Definition at line 331 of file message_handler.hpp.
|
inlinestatic |
Handles an incoming node status update (no-op).
| event | Node status from relay |
Definition at line 345 of file message_handler.hpp.
|
inlinestatic |
Handles an incoming OK response (logs only).
| event | OK response from relay |
Definition at line 288 of file message_handler.hpp.
|
inlinestatic |
Handles an incoming session request (no-op).
| event | Session request from relay |
Definition at line 338 of file message_handler.hpp.
|
inlinestatic |
Handles an unknown message type (logs warning).
| event | Unknown message event |
Definition at line 311 of file message_handler.hpp.
|
inlinestatic |
Handles an unknown protocol message (logs warning).
| event | Unknown protocol event |
Definition at line 321 of file message_handler.hpp.