Skip to main content

LogWriter

Struct LogWriter 

Source
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 — Any TileStore (e.g. crate::FsTileStore).
  • key — The log operator’s LogSigningKey.
  • 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>

Source

pub fn new(store: S, key: LogSigningKey, origin: LogOrigin) -> Self

Create a writer over a tile store with the given signing key + origin.

Source

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 (see hash_leaf).
  • now — Injected checkpoint timestamp (never read from a wall clock here).
Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.