Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::AuditChainVerifier Class Reference

Verifies hash chain integrity. More...

#include <audit_chain.hpp>

Classes

struct  VerificationResult
 Result of a full chain verification. More...
 

Static Public Member Functions

static VerificationResult verify (const uint8_t *chain_data, size_t chain_size)
 Verify a chain from serialized bytes.
 
static VerificationResult verify (const std::vector< HashChainEntry > &entries)
 Verify a vector of HashChainEntry objects.
 
static bool verify_continuity (const std::array< uint8_t, 32 > &file1_last_hash, const std::vector< HashChainEntry > &file2_entries)
 Check that two chain segments link together across files.
 
static bool verify_entry (const HashChainEntry &entry, const std::array< uint8_t, 32 > &expected_prev_hash)
 Verify a single entry against an expected prev_hash.
 

Detailed Description

Verifies hash chain integrity.

Provides static methods for verifying:

  • An entire chain (from serialized bytes or a vector of entries)
  • Continuity between two files (cross-file chain linking)
  • A single entry against its expected previous hash

All methods are pure functions with no side effects.

Definition at line 531 of file audit_chain.hpp.

Member Function Documentation

◆ verify() [1/2]

static VerificationResult signet::forge::AuditChainVerifier::verify ( const std::vector< HashChainEntry > &  entries)
inlinestatic

Verify a vector of HashChainEntry objects.

Checks performed for each entry:

  1. sequence_number matches its position (0-indexed)
  2. entry_hash is self-consistent (recomputed and compared)
  3. prev_hash matches the entry_hash of the preceding entry (or is all zeros for the first entry)
  4. timestamp_ns is non-decreasing
Parameters
entriesThe chain entries to verify, in order.
Returns
A VerificationResult with details on the first failure (if any).

Definition at line 618 of file audit_chain.hpp.

◆ verify() [2/2]

static VerificationResult signet::forge::AuditChainVerifier::verify ( const uint8_t *  chain_data,
size_t  chain_size 
)
inlinestatic

Verify a chain from serialized bytes.

Deserializes the chain and then performs full verification. The input format must match AuditChainWriter::serialize_chain().

Parameters
chain_dataPointer to the serialized chain bytes.
chain_sizeSize of the serialized chain in bytes.
Returns
A VerificationResult describing the outcome.

Definition at line 559 of file audit_chain.hpp.

◆ verify_continuity()

static bool signet::forge::AuditChainVerifier::verify_continuity ( const std::array< uint8_t, 32 > &  file1_last_hash,
const std::vector< HashChainEntry > &  file2_entries 
)
inlinestatic

Check that two chain segments link together across files.

Verifies that the last entry_hash of one file matches the first prev_hash of the next file. This enables multi-file audit trails where each Parquet file contains a segment of the chain.

Parameters
file1_last_hashentry_hash of the last entry in the prior file.
file2_entriesEntries from the subsequent file.
Returns
True if the chain links correctly across files.

Definition at line 698 of file audit_chain.hpp.

◆ verify_entry()

static bool signet::forge::AuditChainVerifier::verify_entry ( const HashChainEntry entry,
const std::array< uint8_t, 32 > &  expected_prev_hash 
)
inlinestatic

Verify a single entry against an expected prev_hash.

Checks that:

  1. entry.prev_hash matches expected_prev_hash
  2. entry.entry_hash is self-consistent

Use this for streaming verification where you process entries one at a time without buffering the entire chain.

Parameters
entryThe entry to verify.
expected_prev_hashThe entry_hash of the preceding entry.
Returns
True if the entry's prev_hash and entry_hash are both valid.

Definition at line 721 of file audit_chain.hpp.


The documentation for this class was generated from the following file: