pub struct Receipt {
pub version: String,
pub receipt_id: Option<String>,
pub timestamp: String,
pub content_hash: Hash,
pub verdict: Verdict,
pub provenance: Option<Provenance>,
pub metadata: Option<Value>,
}Expand description
Receipt for an attested execution (unsigned)
Fields§
§version: StringReceipt schema version
receipt_id: Option<String>Unique receipt identifier
timestamp: StringISO-8601 timestamp
content_hash: HashContent hash (what was executed/verified)
verdict: VerdictOverall verdict
provenance: Option<Provenance>Execution provenance
metadata: Option<Value>Additional metadata
Implementations§
Source§impl Receipt
impl Receipt
Sourcepub fn with_provenance(self, provenance: Provenance) -> Self
pub fn with_provenance(self, provenance: Provenance) -> Self
Set provenance
Sourcepub fn with_metadata(self, metadata: JsonValue) -> Self
pub fn with_metadata(self, metadata: JsonValue) -> Self
Set metadata
Sourcepub fn merge_metadata(self, metadata: JsonValue) -> Self
pub fn merge_metadata(self, metadata: JsonValue) -> Self
Merge metadata with existing metadata using deep object merge semantics.
- object + object: recursive key merge
- any other source value: replaces target
Sourcepub fn validate_version(&self) -> Result<()>
pub fn validate_version(&self) -> Result<()>
Validate that this receipt uses a supported schema version.
Sourcepub fn to_canonical_json(&self) -> Result<String>
pub fn to_canonical_json(&self) -> Result<String>
Serialize to canonical JSON (sorted keys, no extra whitespace)
Sourcepub fn hash_sha256(&self) -> Result<Hash>
pub fn hash_sha256(&self) -> Result<Hash>
Compute SHA-256 hash of canonical JSON
Sourcepub fn hash_keccak256(&self) -> Result<Hash>
pub fn hash_keccak256(&self) -> Result<Hash>
Compute Keccak-256 hash of canonical JSON (for Ethereum)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Receipt
impl<'de> Deserialize<'de> for Receipt
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Receipt
impl RefUnwindSafe for Receipt
impl Send for Receipt
impl Sync for Receipt
impl Unpin for Receipt
impl UnsafeUnpin for Receipt
impl UnwindSafe for Receipt
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
Mutably borrows from an owned value. Read more