![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Builds SHA-256 hash chains during Parquet writes. More...
#include <audit_chain.hpp>
Public Member Functions | |
| AuditChainWriter () | |
| Construct a new writer with an empty chain. | |
| HashChainEntry | append (const uint8_t *record_data, size_t record_size, int64_t timestamp_ns) |
| Append a record to the chain with an explicit timestamp. | |
| HashChainEntry | append (const uint8_t *record_data, size_t record_size) |
| Append a record with auto-generated timestamp from the system clock. | |
| int64_t | length () const |
| Return the number of entries in the chain. | |
| std::array< uint8_t, 32 > | last_hash () const |
| Return the entry_hash of the last entry in the chain. | |
| const std::vector< HashChainEntry > & | entries () const |
| Return a const reference to the internal entry list. | |
| std::vector< uint8_t > | serialize_chain () const |
| Serialize the entire chain to bytes. | |
| void | reset (std::array< uint8_t, 32 > initial_prev_hash={}, int64_t initial_seq=0) |
| Clear the chain and optionally set an initial prev_hash. | |
Builds SHA-256 hash chains during Parquet writes.
To continue a chain across files, save last_hash() from the previous file and pass it to the new writer's reset():
Definition at line 408 of file audit_chain.hpp.
|
inline |
Construct a new writer with an empty chain.
The first entry's prev_hash will be all zeros.
| std::runtime_error | if the commercial license is required but missing. |
Definition at line 413 of file audit_chain.hpp.
|
inline |
Append a record with auto-generated timestamp from the system clock.
| record_data | Raw bytes of the record being audited. |
| record_size | Size of record_data in bytes. |
Definition at line 453 of file audit_chain.hpp.
|
inline |
Append a record to the chain with an explicit timestamp.
Hashes record_data to produce data_hash, sets prev_hash from the last entry (or zeros for the first), computes entry_hash, and appends the new entry to the internal list.
| record_data | Raw bytes of the record being audited. |
| record_size | Size of record_data in bytes. |
| timestamp_ns | Nanosecond timestamp for this entry. |
Definition at line 430 of file audit_chain.hpp.
|
inline |
Return a const reference to the internal entry list.
Definition at line 470 of file audit_chain.hpp.
|
inline |
Return the entry_hash of the last entry in the chain.
If the chain is empty, returns all zeros (or the initial prev_hash if set via reset()).
Definition at line 465 of file audit_chain.hpp.
|
inline |
Return the number of entries in the chain.
Definition at line 458 of file audit_chain.hpp.
|
inline |
Clear the chain and optionally set an initial prev_hash.
Call this to start a new chain. If initial_prev_hash is provided, the first entry's prev_hash will be set to that value instead of all zeros. This is used to continue a chain from a previous file.
| initial_prev_hash | The prev_hash for the next appended entry (default: all zeros). |
Definition at line 511 of file audit_chain.hpp.
|
inline |
Serialize the entire chain to bytes.
Format: 4-byte entry count (uint32_t LE) followed by N * 112-byte entries. Total size = 4 + N * 112 bytes.
Definition at line 480 of file audit_chain.hpp.