pub struct MessageSummary {
pub id: MessageId,
pub sender_id: AgentId,
pub sender_name: AgentName,
pub recipient_id: Option<AgentId>,
pub encryption: MessageEncryption,
pub body: Option<String>,
pub sent_at: DateTime<Utc>,
pub read_at: Option<DateTime<Utc>>,
pub state: Option<InboxState>,
pub ciphertext: Option<String>,
pub wrapped_key: Option<String>,
pub sender_public_key: Option<String>,
}Expand description
One message as rendered in an inbox.
recipient_id is None for broadcasts. body is None when the
server cannot produce plaintext (E2EE rows, phase 2) — clients
decrypt those locally from the ciphertext fields that phase 2 adds.
Fields§
§id: MessageId§sender_id: AgentId§sender_name: AgentName§recipient_id: Option<AgentId>None = system broadcast (delivered to every agent).
encryption: MessageEncryption§body: Option<String>Plaintext body (server-mode and broadcasts). None for E2EE.
sent_at: DateTime<Utc>§read_at: Option<DateTime<Utc>>When this agent read the message. None = unread, for a DM; a
broadcast has none (its reads are one watermark per agent), so
read its state.
state: Option<InboxState>Where this message stands for this read, by the rule the inbox’s
unread count uses (0.117.1). Absent from servers before it, when
read_at is all there is to go on.
ciphertext: Option<String>E2EE only: hex envelope blob (version || xnonce || ct).
wrapped_key: Option<String>E2EE only: hex message key wrapped to this agent’s X25519 key (the recipient wrap for inbox rows, the sender wrap for outbox export).
sender_public_key: Option<String>E2EE only: the sender’s hex Ed25519 public key, for verifying the embedded message signature. TOFU: pin it — a key change for a known sender is a red flag, not a routine event.
Implementations§
Source§impl MessageSummary
impl MessageSummary
Sourcepub fn state_or_read_at(&self) -> InboxState
pub fn state_or_read_at(&self) -> InboxState
Self::state, or for a server that does not send it, what
read_at says
Sourcepub fn decrypt(
&self,
own_secret: &EncryptionSecretKey,
) -> Option<Result<String, EnvelopeError>>
pub fn decrypt( &self, own_secret: &EncryptionSecretKey, ) -> Option<Result<String, EnvelopeError>>
Decrypt and verify an E2EE message with this agent’s encryption
secret. Returns the plaintext, or None if this is not an E2EE
row (use body directly).
Verification uses the row’s own context fields and
sender_public_key — callers doing TOFU pinning should check
the key against their pin first.