Skip to main content

ReceiptLog

Struct ReceiptLog 

Source
pub struct ReceiptLog { /* private fields */ }
Expand description

An append-only, hash-chained receipt log.

Implementations§

Source§

impl ReceiptLog

Source

pub fn new() -> Self

Create a new empty receipt log.

Source

pub fn from_entries(entries: Vec<Receipt>) -> Self

Create a log from existing entries (e.g., loaded from disk).

Source

pub fn append(&mut self, receipt: Receipt)

Append a receipt to the log.

Source

pub fn last_hash(&self) -> String

Get the hash of the last receipt (for chain linking).

Source

pub fn next_sequence(&self) -> u64

Get the next sequence number.

Source

pub fn verify_integrity(&self) -> Result<()>

Verify the integrity of the hash chain (sequence numbers + previous_hash linkage).

This does NOT verify receipt signatures — use verify_integrity_with_key() for full cryptographic verification including signature checks.

Source

pub fn verify_integrity_with_key( &self, public_key_bytes: &[u8; 32], ) -> Result<()>

Verify full cryptographic integrity: hash chain linkage AND each receipt’s signature.

§Security: fix S2 (receipt signatures were never verified)

Without signature verification, an attacker with write access can forge receipts with correct hash chaining — invalidating the entire compliance audit trail.

public_key_bytes is the Ed25519 public key of the agent that signed the receipts. For multi-agent logs, use verify_integrity_with_resolver() (future).

Source

pub fn entries(&self) -> &[Receipt]

Get all entries.

Source

pub fn len(&self) -> usize

Get the number of entries.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Default for ReceiptLog

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V