pub fn try_cache_checkpoint(
store: &dyn ConfigStore,
cache_path: &Path,
new_checkpoint: &SignedCheckpoint,
consistency_proof: Option<&ConsistencyProof>,
) -> Result<ConsistencyReport, TransparencyWorkflowError>Expand description
Cache a checkpoint using trust-on-first-use (TOFU) semantics.
If no cached checkpoint exists, the new checkpoint is accepted and written. If a cached checkpoint exists with the same or smaller tree size and matching root, the cache is left unchanged. If the cached checkpoint has the same size but a different root, this is equivocation — returns a hard error. If a consistency proof is provided, full Merkle consistency is verified.
Args:
store— File-access port for the checkpoint cache file.cache_path— Path to the cached checkpoint JSON file (~/.auths/log_checkpoint.json).new_checkpoint— The checkpoint to cache.consistency_proof— Optional consistency proof for cache-hit cases.
Usage:
ⓘ
try_cache_checkpoint(
&store,
&Path::new("~/.auths/log_checkpoint.json"),
&bundle.signed_checkpoint,
None,
)?;