Skip to main content

build_topic_aad

Function build_topic_aad 

Source
pub fn build_topic_aad(keyed_leaf: &str, epoch: u64) -> Vec<u8> ⓘ
Expand description

Build length-prefixed AAD binding the keyed routing leaf + epoch (EV3).

When the semantic topic moves under the payload AEAD (replacing the cleartext prefix-as-AAD), the AAD MUST bind the keyed topic leaf and the epoch, so a ciphertext from (topic A, epoch N) replayed onto (topic B, epoch M) is rejected by AEAD authentication. Without this binding, replacing the prefix with an opaque keyed leaf would invite cross-topic / cross-epoch reuse.

Format: domain || u32_le(len(leaf)) || leaf || epoch_le (leaf is the hex crate::event_subject::topic_leaf segment).