pub struct KeyProof {
pub root: Option<Cid>,
pub key: Vec<u8>,
pub path: Vec<Node>,
}Expand description
Root-to-leaf proof for one key.
Fields§
§root: Option<Cid>Root CID the path claims to prove against, or None for an empty tree.
key: Vec<u8>Key being proven.
path: Vec<Node>Nodes from root to leaf. Empty only when root is None.
Implementations§
Source§impl KeyProof
impl KeyProof
Sourcepub fn verify(&self) -> KeyProofVerification
pub fn verify(&self) -> KeyProofVerification
Verify this proof without consulting a store.
Sourcepub fn path_node_bytes(&self) -> Vec<Vec<u8>>
pub fn path_node_bytes(&self) -> Vec<Vec<u8>>
Return the nodes in this proof as deterministic encoded bytes.
Sourcepub fn from_node_bytes(
root: Option<Cid>,
key: impl Into<Vec<u8>>,
path_node_bytes: Vec<Vec<u8>>,
) -> Result<Self, Error>
pub fn from_node_bytes( root: Option<Cid>, key: impl Into<Vec<u8>>, path_node_bytes: Vec<Vec<u8>>, ) -> Result<Self, Error>
Rebuild a typed proof from encoded path nodes.
Sourcepub fn to_bundle_bytes(&self) -> Result<Vec<u8>, Error>
pub fn to_bundle_bytes(&self) -> Result<Vec<u8>, Error>
Serialize this proof as a versioned, deterministic binary bundle.
Sourcepub fn from_bundle_bytes(bytes: &[u8]) -> Result<Self, Error>
pub fn from_bundle_bytes(bytes: &[u8]) -> Result<Self, Error>
Decode a proof from bytes produced by KeyProof::to_bundle_bytes.
Trait Implementations§
impl StructuralPartialEq for KeyProof
Auto Trait Implementations§
impl Freeze for KeyProof
impl RefUnwindSafe for KeyProof
impl Send for KeyProof
impl Sync for KeyProof
impl Unpin for KeyProof
impl UnsafeUnpin for KeyProof
impl UnwindSafe for KeyProof
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more