pub struct Checkpoint { /* private fields */ }Expand description
A parsed checkpoint (signed-tree-head body).
Implementations§
Source§impl Checkpoint
impl Checkpoint
Sourcepub fn new(origin: &str, size: u64, root_hash: Hash) -> Result<Self>
pub fn new(origin: &str, size: u64, root_hash: Hash) -> Result<Self>
Build a checkpoint with no extension lines.
§Errors
Returns Error::MalformedCheckpoint if origin is empty or contains a
newline.
Sourcepub fn with_extensions(
origin: &str,
size: u64,
root_hash: Hash,
extensions: Vec<String>,
) -> Result<Self>
pub fn with_extensions( origin: &str, size: u64, root_hash: Hash, extensions: Vec<String>, ) -> Result<Self>
Build a checkpoint with explicit extension lines.
§Errors
Returns Error::MalformedCheckpoint if origin is empty/contains a
newline, or any extension line is empty or contains a newline.
Sourcepub fn extensions(&self) -> &[String]
pub fn extensions(&self) -> &[String]
The opaque extension lines (usually empty).
Sourcepub fn parse(text: &str) -> Result<Self>
pub fn parse(text: &str) -> Result<Self>
Parse a checkpoint body (the note text), byte-for-byte per the spec.
§Errors
Returns Error::MalformedCheckpoint for a missing/empty origin, a
non-decimal or leading-zero size, a root hash that is not exactly 32
bytes once base64-decoded, fewer than three lines, or an empty extension
line.
Sourcepub fn marshal(&self) -> String
pub fn marshal(&self) -> String
Serialize the checkpoint body (the note text), ending in a newline.
Sourcepub fn from_signed_note(msg: &str, trusted: &[VerifierKey]) -> Result<Self>
pub fn from_signed_note(msg: &str, trusted: &[VerifierKey]) -> Result<Self>
Parse and verify a full signed checkpoint, returning the checkpoint body.
The msg is the complete signed note (body + blank line + signature
lines). It is verified against trusted (at least one trusted signature
— e.g. the log’s Ed25519 key, or a witness co-signature — must verify),
then its body is parsed as a checkpoint.
§Errors
Propagates crate::note::SignedNote::parse / verify errors and
Checkpoint::parse errors.
Sourcepub fn verify_inclusion(
&self,
leaf_index: u64,
leaf_hash: &[u8],
proof: &[Vec<u8>],
) -> Result<()>
pub fn verify_inclusion( &self, leaf_index: u64, leaf_hash: &[u8], proof: &[Vec<u8>], ) -> Result<()>
Verify that leaf_hash is included at leaf_index in the tree committed
by this checkpoint, using the Slice-1 RFC 6962/9162 verifier.
§Errors
Propagates crate::proof::verify_inclusion errors (index out of range,
wrong proof size, hash-length, or root mismatch).
Sourcepub fn verify_consistency(
&self,
newer: &Checkpoint,
proof: &[Vec<u8>],
) -> Result<()>
pub fn verify_consistency( &self, newer: &Checkpoint, proof: &[Vec<u8>], ) -> Result<()>
Verify that this (older) checkpoint is consistent with a newer one —
i.e. the newer tree is an append-only extension — using the Slice-1
RFC 6962/9162 consistency verifier. This is the anti-equivocation walk a
monitor performs across checkpoints.
§Errors
Propagates crate::proof::verify_consistency errors, including a root
mismatch if the proof does not bind both tree heads.
Trait Implementations§
Source§impl Clone for Checkpoint
impl Clone for Checkpoint
Source§fn clone(&self) -> Checkpoint
fn clone(&self) -> Checkpoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Checkpoint
impl Debug for Checkpoint
impl Eq for Checkpoint
Source§impl PartialEq for Checkpoint
impl PartialEq for Checkpoint
Source§fn eq(&self, other: &Checkpoint) -> bool
fn eq(&self, other: &Checkpoint) -> bool
self and other values to be equal, and is used by ==.