weave-sdk · messaging
Source declarations, signatures and documentation for messaging.
Reviewed implementation boundary: The current MessagingManager bypasses SecretStream, sends plain TCP, and forwards received messages without calling AgentMessage::verify. Historical comments describing encrypted Noise XX channels do not describe this implementation. Callers must provide secure transport, verify signatures against a trusted sender-key binding, and enforce authorization and replay controls. See /libraries/weave-sdk/identity-messaging.
Source: sigil/weave/libs/weave-sdk/src/messaging.rs. SHA-256: d3605a8f988369d7d86c9575a5399304618bb5092630e7461199c0e0f92d4718.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
messaging::AgentMessage
A message exchanged between agents.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AgentMessage {
/// Sender's DID.
pub from: String,
/// Message topic/channel.
pub topic: String,
/// Message payload (application-defined).
pub payload: Vec<u8>,
/// Timestamp (milliseconds since epoch).
pub timestamp: u64,
/// Ed25519 signature over (topic + payload + timestamp).
pub signature: Vec<u8>
}Source line: 33.
messaging::AgentMessage::new
Create a new signed message.
pub fn new(identity: &WeaveIdentity, topic: &str, payload: Vec<u8>) -> Self;Source line: 48.
messaging::AgentMessage::verify
Verify the message signature using the sender's public key.
pub fn verify(&self, sender_public_key: &[u8; 32]) -> Result<()>;Source line: 71.
messaging::MessagingManager
Manages agent-to-agent messaging channels.
pub struct MessagingManager {
}Source line: 92.
messaging::MessagingManager::new
Create a new messaging manager.
pub fn new(identity: WeaveIdentity, inbox_tx: mpsc::Sender<AgentMessage>) -> Self;Source line: 111.
messaging::MessagingManager::listen
Start listening for incoming message connections.
pub async fn listen(&self, bind_addr: SocketAddr) -> Result<SocketAddr>;Source line: 121.
messaging::MessagingManager::connect
Connect to a peer and establish a messaging channel.
pub async fn connect(&self, peer_did: &str, addr: SocketAddr) -> Result<()>;Source line: 154.
messaging::MessagingManager::send
Send a message to a connected peer.
pub async fn send(&self, peer_did: &str, topic: &str, payload: Vec<u8>) -> Result<()>;Source line: 216.
messaging::MessagingManager::peer_count
Get the number of connected peers.
pub async fn peer_count(&self) -> usize;Source line: 229.