pub struct MessageV0 {
pub header: MessageV0Header,
pub content: Content,
}Expand description
Version 0 of the message format with Ed25519 signatures and ChaCha20-Poly1305 encryption.
§Message Structure
MessageV0 represents the core message data that gets signed and transmitted.
It contains metadata (header) and the actual content payload.
The message is signed using Ed25519 to create a MessageFull for transmission.
§Cryptographic Binding
This message version hard-wires the following cryptographic choices:
- Digital Signatures: Ed25519 (see
MessageFull) - Content Encryption: ChaCha20-Poly1305 AEAD (see
Content) - Hash Function: Blake3 for message IDs (see
MessageFull::new) - Key Derivation: Ed25519-based and context-based schemes
These choices cannot be negotiated or downgraded - they are fixed for all
MessageV0 instances to prevent cryptographic downgrade attacks.
§Field Description
header: Message metadata including sender, timestamp, type, and tagscontent: The actual message payload (seeContentvariants)
§Serialization Format
Messages are serialized using postcard for efficiency:
[header: variable][content: 1+ bytes]The compact binary format minimizes wire overhead while maintaining self-describing properties through postcard’s type system.
§Example Usage
use zoe_wire_protocol::{MessageV0, MessageV0Header, Content, Kind, Tag};
use ed25519_dalek::SigningKey;
use rand::rngs::OsRng;
let signing_key = SigningKey::generate(&mut OsRng);
let message = MessageV0 {
header: MessageV0Header {
sender: signing_key.verifying_key(),
when: 1640995200, // 2022-01-01 00:00:00 UTC
kind: Kind::Regular,
tags: vec![Tag::Protected],
},
content: Content::raw("Hello, world!".as_bytes().to_stdvec()),
};
// Convert to signed message for transmission
use zoe_wire_protocol::{Message, MessageFull};
let full_message = MessageFull::new(Message::MessageV0(message), &signing_key)?;Fields§
§header: MessageV0HeaderMessage header containing metadata and routing information.
Contains sender identity, timestamp, message type, and routing tags. This information is accessible without deserializing the content.
content: ContentThe message payload with optional encryption.
See Content for available variants:
Raw: Unencrypted dataChaCha20Poly1305: Context-encrypted dataEd25519Encrypted: Identity-encrypted data