Struct ic_http_certification::tree::HttpCertificationTree
source · pub struct HttpCertificationTree { /* private fields */ }
Expand description
A certification tree for generic HTTP requests.
Implementations§
source§impl HttpCertificationTree
impl HttpCertificationTree
sourcepub fn new(tree: NestedTree<Vec<u8>, Vec<u8>>) -> Self
pub fn new(tree: NestedTree<Vec<u8>, Vec<u8>>) -> Self
Creates a new empty HttpCertificationTree from a given [CertificationTree]. The default implementation should be used in most cases.
sourcepub fn root_hash(&self) -> Sha256Digest
pub fn root_hash(&self) -> Sha256Digest
Returns the root hash of the tree. This hash can be used as the canister’s certified variable.
sourcepub fn insert(&mut self, entry: &HttpCertificationTreeEntry<'_>)
pub fn insert(&mut self, entry: &HttpCertificationTreeEntry<'_>)
Inserts a given HttpCertificationTreeEntry into the tree. After performing this operation, the canister’s certified variable will need to be updated with the new root hash of the tree.
sourcepub fn delete(&mut self, entry: &HttpCertificationTreeEntry<'_>)
pub fn delete(&mut self, entry: &HttpCertificationTreeEntry<'_>)
Deletes a given HttpCertificationTreeEntry from the tree. After performing this operation, the canister’s certified variable will need to be updated with the new root hash of the tree.
sourcepub fn witness(
&self,
entry: &HttpCertificationTreeEntry<'_>,
request_url: &str
) -> HttpCertificationResult<HashTree>
pub fn witness( &self, entry: &HttpCertificationTreeEntry<'_>, request_url: &str ) -> HttpCertificationResult<HashTree>
Returns a pruned HashTree that will prove the presence of a given HttpCertificationTreeEntry in the full HttpCertificationTree, without needing to return the full tree.
request_url
is required so that the witness can be generated with respect to the request URL.