Skip to main content

check_consistency_proof

Function check_consistency_proof 

Source
pub async fn check_consistency_proof(
    client: &Client,
    base_url: &Url,
    prev_size: u64,
    next_size: u64,
    perv_root: &[u8; 32],
    next_root: &[u8; 32],
) -> Result<Vec<ConsistencyProofPart>, Error>
Expand description

Fetch the consistency proof from prev_size to next_size from the server and verifies it, returning a Vec<ConsistencyProofPart> if successful, which can later be used to verify the integrity of certificates downloaded from the server later. An Err(...) is returned if the proof is invalid, or some network error happened during the request.

§Ok(Vec<ConsistencyProofPart>)

The Ok result of this function contains all components of the proof which describes a new tree (that’s not in the previous tree). This can be useful if you want to then get all the new certificates and verify that those forms the new tree.

To do this, calculate the leaf hash of all the new certificates, and call ConsistencyProofPart::verify with the array of leaf hashes. See its documentation for more info.

§Panics

…if prev_size >= next_size