Crate transparentlog_core
source · [−]Expand description
Transparent Log
This crate provides an implementation of a Merkle tree for log records, for sceptical clients.
See https://research.swtch.com/tlog
Examples
use transparentlog_core::{check_record,InMemoryLog,InMemoryLogClientBuilder,TransparentLog};
// Create a new log
let mut ml: InMemoryLog<String>=InMemoryLog::default();
// Create a new client
let mut client= InMemoryLogClientBuilder::new(&ml)?.build();
// Append a record to the log
let rec1 = ml.append(String::from("entry1"))?;
// Check the log contains the record
assert_eq!(true, check_record(&mut client,&ml,&rec1)?);
// Get back the data
assert_eq!("entry1",ml.get(rec1.id)?.unwrap().as_str());
Re-exports
pub use test_helpers::*;
Modules
Structs
A file based transparent log
An in-memory transparent log
In-memory client to a TransparentLog, keeping track of the latest log verified
Build an in-memory client, from the current state of the log or a saved state
Reference to a full log: its size and root hash
Position in the tree
Reference to a Record, with its ID and its hash
Traits
A simple log client, optionally keeping a cache of tree entries
Transparent log Trait
Functions
Check a given index + hash is contained in the given log, using the stored latest verification if possible or updating the cache if needed
Hash a given record via its Serialize instance
Calculate the proof positions needed to assert a tree of size1 is a prefix of a tree of size 2
Calculate the proof position needed to assert the record at the given index is present in a log of the given size
Return the level sizes for each level of the tree
Verify that a given record belongs to the given tree, using the proofs provided
Verify that the tree is correct with the proofs provided
Type Definitions
The height of the tree