pub struct Proof {
root: Cid,
key: String,
value: Option<Cid>,
blocks: BTreeMap<Cid, Vec<u8>>,
nodes: Vec<Cid>,
}Expand description
The blocks that prove what a repository says about one key.
A commit block, the Merkle search tree nodes from the root down to where the key sits, and the record itself when there is one. That is all, and the “that is all” is the point: a verifier that is handed every block in the repository has been given an export, and an export is not a proof of anything in particular.
§What a verifier does with it
- Resolves the DID and takes the public key out of its document.
- Checks the commit block’s signature with it, which fixes
data— the root of the tree the account signed over — as a fact rather than as this server’s word. - Walks: hashes the first node block, requires it to be
data, decodes it, finds which entry range<collection>/<rkey>falls in, and follows that link to the next block. A block that hashes to something the parent did not name is not on the path. - At the end, either the key is an entry — and its
vis the CID of a record block that is also in the file — or it is not, and the key is provably not in the repository.
Every one of those steps fails closed. A missing node breaks step 3, a node lifted from another tree fails the hash comparison in step 3, and a substituted record fails the CID comparison in step 4.
Fields§
§root: Cid§key: String§value: Option<Cid>§blocks: BTreeMap<Cid, Vec<u8>>§nodes: Vec<Cid>Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Proof
impl RefUnwindSafe for Proof
impl Send for Proof
impl Sync for Proof
impl Unpin for Proof
impl UnsafeUnpin for Proof
impl UnwindSafe for Proof
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