pub struct LogWriter<S: TileStore> { /* private fields */ }Expand description
Appends leaves to a tile-backed transparency log and mints offline inclusion proofs against its signed checkpoint.
Args:
store— AnyTileStore(e.g.crate::FsTileStore).key— The log operator’sLogSigningKey.origin— The log’s origin line; a store whose checkpoint carries a different origin is rejected on every operation.
Usage:
ⓘ
let writer = LogWriter::new(FsTileStore::new(dir), key, origin);
let leaf = hash_leaf(b"sha256:...");
let appended = writer.append(leaf, now).await?;
let inclusion = writer.prove(&leaf).await?;Implementations§
Source§impl<S: TileStore> LogWriter<S>
impl<S: TileStore> LogWriter<S>
Sourcepub fn new(store: S, key: LogSigningKey, origin: LogOrigin) -> Self
pub fn new(store: S, key: LogSigningKey, origin: LogOrigin) -> Self
Create a writer over a tile store with the given signing key + origin.
Sourcepub async fn append(
&self,
leaf_hash: MerkleHash,
now: DateTime<Utc>,
) -> Result<AppendedLeaf, TransparencyError>
pub async fn append( &self, leaf_hash: MerkleHash, now: DateTime<Utc>, ) -> Result<AppendedLeaf, TransparencyError>
Append one leaf hash: persist it to the level-0 tiles, recompute the root, and sign a fresh checkpoint over the grown tree.
Args:
leaf_hash— The RFC 6962 leaf hash (seehash_leaf).now— Injected checkpoint timestamp (never read from a wall clock here).
Sourcepub async fn prove(
&self,
leaf_hash: &MerkleHash,
) -> Result<TransparencyInclusion, TransparencyError>
pub async fn prove( &self, leaf_hash: &MerkleHash, ) -> Result<TransparencyInclusion, TransparencyError>
Mint the offline inclusion evidence for a leaf already in the log: an inclusion proof directly against the current signed checkpoint.
Auto Trait Implementations§
impl<S> Freeze for LogWriter<S>where
S: Freeze,
impl<S> RefUnwindSafe for LogWriter<S>where
S: RefUnwindSafe,
impl<S> Send for LogWriter<S>
impl<S> Sync for LogWriter<S>
impl<S> Unpin for LogWriter<S>where
S: Unpin,
impl<S> UnsafeUnpin for LogWriter<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for LogWriter<S>where
S: UnwindSafe,
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