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§
- FileLog
- A file based transparent log
- InMemory
Log - An in-memory transparent log
- InMemory
LogClient - In-memory client to a TransparentLog, keeping track of the latest log verified
- InMemory
LogClient Builder - Build an in-memory client, from the current state of the log or a saved state
- LogTree
- Reference to a full log: its size and root hash
- LogTree
Position - Position in the tree
- Record
- Reference to a Record, with its ID and its hash
Traits§
- LogClient
- A simple log client, optionally keeping a cache of tree entries
- Transparent
Log - Transparent log Trait
Functions§
- check_
record - 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
- Hash a given record via its Serialize instance
- prefix_
proof_ positions - Calculate the proof positions needed to assert a tree of size1 is a prefix of a tree of size 2
- proof_
positions - Calculate the proof position needed to assert the record at the given index is present in a log of the given size
- tree_
sizes - Return the level sizes for each level of the tree
- verify
- Verify that a given record belongs to the given tree, using the proofs provided
- verify_
tree - Verify that the tree is correct with the proofs provided
Type Aliases§
- LogHeight
- The height of the tree