pub fn validate_ooo_message_value_hash_chain<T: AsRef<[u8]>, U: AsRef<[u8]>>(
message_bytes: T,
previous_msg_bytes: Option<U>,
) -> Result<()>Expand description
Validate an out-of-order message value.
It expects the messages to be the JSON encoded message value of shape: { previous: "", author: "", sequence: ..., timestamp: ..., content: {}, signature: "" }
This checks that:
- The fields (keys) of the message value are in the correct order
- The hash signature is
sha256 - The message
contentis canonical base64 (ifcontentis a string) - The message value does not exceed 8192 UTF-16 code units when serialized as a JSON string
- The
authorof the message value matches theauthorof the previous message value
This does not check:
- The signature. See ssb-verify-signatures which lets you to batch verification of signatures
- The
sequenceof the message in relation to the previous message - That the hash value for
previousmatches the actual hashed value of the previous message