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 delete_by_path(&mut self, path: &HttpCertificationPath<'_>)
pub fn delete_by_path(&mut self, path: &HttpCertificationPath<'_>)
Deletes all HttpCertificationTreeEntrys that match a given HttpCertificationPath. After performing this operation, the canister’s certified variable will need to be updated with the new root hash of the tree.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the tree of all HttpCertificationTreeEntry. 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.
Trait Implementations§
Source§impl Clone for HttpCertificationTree
impl Clone for HttpCertificationTree
Source§fn clone(&self) -> HttpCertificationTree
fn clone(&self) -> HttpCertificationTree
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more