pub struct AuditCheckpoint {
pub checkpoint_id: Uuid,
pub head: [u8; 32],
pub entry_count: u64,
pub head_event_id: Uuid,
pub checkpoint_at: DateTime<Utc>,
pub prev_checkpoint: Option<[u8; 32]>,
pub verification_method: String,
pub signature: Vec<u8>,
}Expand description
A signed commitment to the audit chain’s state at a point in time.
Stored in the audit_checkpoint keyspace keyed by <rfc3339>:<uuid>,
matching the audit keyspace’s convention so an ascending walk is
chronological.
Fields§
§checkpoint_id: UuidStable identifier for this checkpoint.
head: [u8; 32]entry_hash of the newest chainable envelope at checkpoint time.
entry_count: u64Total chainable (v2+) envelopes written up to and including
Self::head.
This is the field that makes truncation detectable: a log holding fewer chainable entries than a signed checkpoint claims has lost entries, and no amount of restamping fixes that without the signing key. Counting only chainable envelopes matters — pre-v2 rows are skipped by the verifier, so including them would make the count disagree with what verification can actually recount.
head_event_id: Uuidevent_id of the envelope at Self::head, so a verifier can locate
the anchor point directly instead of recomputing the whole chain.
checkpoint_at: DateTime<Utc>Wall-clock at checkpoint time.
prev_checkpoint: Option<[u8; 32]>The previous checkpoint’s own Self::link_hash, or None for the
first. Checkpoints chain too, so deleting a checkpoint is itself
detectable — otherwise an adversary would simply drop the
checkpoints that contradict a truncated log.
verification_method: StringverificationMethod URI of the key that signed this checkpoint (e.g.
did:webvh:…#key-0). Recorded so a checkpoint stays verifiable across
a key rotation: a verifier resolves this key from the community’s DID
document history rather than assuming the current one.
signature: Vec<u8>Ed25519 signature over [Self::signing_payload].
Implementations§
Source§impl AuditCheckpoint
impl AuditCheckpoint
Sourcepub fn sign(claim: CheckpointClaim, signing_key: &SigningKey) -> Self
pub fn sign(claim: CheckpointClaim, signing_key: &SigningKey) -> Self
Build and sign a checkpoint with signing_key.
verification_method must name the public key corresponding to
signing_key in the community’s DID document — a verifier resolves it
to check the signature.
Sourcepub fn claim(&self) -> CheckpointClaim
pub fn claim(&self) -> CheckpointClaim
The claim this checkpoint carries — the signed half of it.
Sourcepub fn verify_signature(&self, public_key: &[u8]) -> bool
pub fn verify_signature(&self, public_key: &[u8]) -> bool
Verify the signature against public_key (32 raw Ed25519 bytes).
Returns false for a malformed key or signature as well as a genuine
mismatch — from the verifier’s point of view those are the same
finding: this checkpoint does not prove anything.
Sourcepub fn link_hash(&self) -> [u8; 32]
pub fn link_hash(&self) -> [u8; 32]
This checkpoint’s own hash — what the next one’s
Self::prev_checkpoint points at.
Covers the signature as well as the claim, so swapping a valid signature for a different valid signature over the same claim still breaks the link.
Sourcepub fn storage_key(&self) -> Vec<u8> ⓘ
pub fn storage_key(&self) -> Vec<u8> ⓘ
Storage key: <rfc3339>:<checkpoint_id>, so an ascending prefix walk
is chronological (matching the audit keyspace’s convention).
Trait Implementations§
Source§impl Clone for AuditCheckpoint
impl Clone for AuditCheckpoint
Source§fn clone(&self) -> AuditCheckpoint
fn clone(&self) -> AuditCheckpoint
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 AuditCheckpoint
impl Debug for AuditCheckpoint
Source§impl<'de> Deserialize<'de> for AuditCheckpoint
impl<'de> Deserialize<'de> for AuditCheckpoint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AuditCheckpoint
Source§impl PartialEq for AuditCheckpoint
impl PartialEq for AuditCheckpoint
Source§impl Serialize for AuditCheckpoint
impl Serialize for AuditCheckpoint
impl StructuralPartialEq for AuditCheckpoint
Auto Trait Implementations§
impl Freeze for AuditCheckpoint
impl RefUnwindSafe for AuditCheckpoint
impl Send for AuditCheckpoint
impl Sync for AuditCheckpoint
impl Unpin for AuditCheckpoint
impl UnsafeUnpin for AuditCheckpoint
impl UnwindSafe for AuditCheckpoint
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.