Function ssb_validate::message::validate_ooo_message_hash_chain [−][src]
pub fn validate_ooo_message_hash_chain<T: AsRef<[u8]>, U: AsRef<[u8]>>(
message_bytes: T,
previous_msg_bytes: Option<U>
) -> Result<()>
Check that an out-of-order message is valid.
It expects the messages to be the JSON encoded message of shape: {key: "", value: {...}}
This checks that:
- the author has not changed
- the actual hash matches the hash claimed in
key
- the message contains the correct fields
This does not check:
- the signature. See ssb-verify-signatures which lets you to batch verification of signatures.
- the sequence increments by 1 compared to previous
- the actual hash of the previous message matches the hash claimed in
previous
previous_msg_bytes
will be None
only when message_bytes
is the first message by that author.