pub struct ReceiptStore { /* private fields */ }Expand description
Storage and verification of ExperimentReceipts.
Each receipt is serialised to JSON on insertion so that the raw bytes remain stable. Verification deserialises and recomputes the binding digest.
Implementations§
Source§impl ReceiptStore
impl ReceiptStore
Sourcepub fn insert(&mut self, receipt: &ExperimentReceipt) -> Result<(), String>
pub fn insert(&mut self, receipt: &ExperimentReceipt) -> Result<(), String>
Insert a receipt, overwriting any existing entry for the same id.
§Errors
Returns an error string if serialisation fails (practically infallible for well-formed receipts).
Sourcepub fn verify(&self, id: &str) -> bool
pub fn verify(&self, id: &str) -> bool
Verify the receipt identified by id.
Returns true if the receipt passes verify_receipt.
Returns false if the id is unknown, deserialisation fails, or
verification fails (tampered fields).
Sourcepub fn verify_all(&self) -> HashMap<String, bool>
pub fn verify_all(&self) -> HashMap<String, bool>
Verify every stored receipt.
Returns a map from experiment id to verification outcome.
Sourcepub fn get_json(&self, id: &str) -> Option<&str>
pub fn get_json(&self, id: &str) -> Option<&str>
Retrieve the stored JSON string for an experiment id.
Sourcepub fn get(&self, id: &str) -> Option<ExperimentReceipt>
pub fn get(&self, id: &str) -> Option<ExperimentReceipt>
Retrieve and deserialise a receipt by experiment id.
Returns None if the id is unknown or deserialisation fails.