aztec-nr - noir_aztec::messages::encoding

Function decode_message

pub unconstrained fn decode_message(
    message: BoundedVec<Field, 12>,
) -> Option<(u64, u64, BoundedVec<Field, 11>)>

Decodes a standard aztec-nr message, i.e. one created via encode_message, returning the original encoded values.

Returns None if the message is empty or has invalid (>128 bit) expanded metadata.

Note that encode_message returns a fixed size array while this function takes a BoundedVec: this is because prior to decoding the message type is unknown, and consequentially not known at compile time. If working with fixed-size messages, consider using BoundedVec::from_array to convert them.