Use this file to discover all available pages before exploring further.
Additional Authenticated Data (AAD) is a byte sequence that can be included in both private and public MLS messages. It is always authenticated (signed) but never encrypted, making it suitable for metadata that must remain inspectable during transit.
use openmls::prelude::*;// Set AAD on the groupalice_group.set_aad(b"Additional Authenticated Data".to_vec());// Verify AAD is setassert_eq!(alice_group.aad(), b"Additional Authenticated Data");
The AAD will be included in the next outgoing message and then automatically cleared.
use openmls::prelude::*;// Set AAD before creating the messagealice_group.set_aad(b"Message metadata".to_vec());let message = alice_group .create_message(&provider, &signer, b"Hello, Bob!") .expect("Error creating application message");// AAD is now clearedassert_eq!(alice_group.aad(), b"");
// Set AAD before creating a commitalice_group.set_aad(b"Commit metadata".to_vec());// Create commit with AADlet (commit, welcome, group_info) = alice_group .add_members(&provider, &signer, &[bob_key_package]) .expect("Could not add members");// AAD is cleared after successful commit creationassert_eq!(alice_group.aad(), b"");
// Serialize routing infolet routing_info = serde_json::to_vec(&RoutingInfo { destination: "room-123", priority: "high",}).unwrap();alice_group.set_aad(routing_info);let message = alice_group.create_message(&provider, &signer, content).unwrap();// Delivery service can inspect AAD for routing// without decrypting the message
Message correlation
Link messages together:
// Include correlation IDlet correlation_id = format!("thread-{}", thread_id);alice_group.set_aad(correlation_id.as_bytes().to_vec());let message = alice_group.create_message(&provider, &signer, content).unwrap();// Receivers can correlate messages by AADif processed_message.aad() == correlation_id.as_bytes() { // Part of same conversation thread}
Audit trail
Include audit information:
// Add audit metadatalet audit_data = serde_json::to_vec(&AuditInfo { timestamp: current_time(), client_version: "1.2.3", client_id: device_id,}).unwrap();alice_group.set_aad(audit_data);let message = alice_group.create_message(&provider, &signer, content).unwrap();// Audit system can log AAD without accessing message content
Delivery confirmation
Include message identifiers for acknowledgment:
// Set message ID in AADlet message_id = generate_unique_id();alice_group.set_aad(message_id.as_bytes().to_vec());let message = alice_group.create_message(&provider, &signer, content).unwrap();// Receiver can acknowledge using AADsend_acknowledgment(processed_message.aad());
// AAD cannot be modified in transit// Tampering will cause signature verification to faillet result = bob_group.process_message(&provider, modified_message);assert!(result.is_err()); // Signature verification fails if AAD was modified