pub struct EvidenceExportV1 {
pub schema: String,
pub from: String,
pub to: String,
pub rows: Vec<Value>,
pub row_count: u64,
pub totals: EvidenceTotals,
pub rows_digest_blake3: String,
pub signer_public_key: Option<String>,
pub signature: Option<String>,
}Expand description
Signed, exportable usage evidence over a window.
Fields§
§schema: StringDiscriminator so a verifier can refuse unrelated signed JSON.
from: StringWindow bounds (inclusive), RFC 3339 UTC.
to: String§rows: Vec<Value>Daily aggregates: day × person × project × model × provider.
row_count: u64Row count (redundant with rows.len(), part of the signed payload).
totals: EvidenceTotalsWindow totals over the raw events (not the aggregates).
rows_digest_blake3: StringBLAKE3 hex digest of the canonical rows bytes.
signer_public_key: Option<String>Ed25519 public key (hex). None until signed.
signature: Option<String>Ed25519 signature over the canonical bytes (hex). None until signed.
Implementations§
Source§impl EvidenceExportV1
impl EvidenceExportV1
Sourcepub fn build(
from: DateTime<Utc>,
to: DateTime<Utc>,
rows: Vec<Value>,
totals: EvidenceTotals,
) -> Self
pub fn build( from: DateTime<Utc>, to: DateTime<Utc>, rows: Vec<Value>, totals: EvidenceTotals, ) -> Self
Builds the unsigned artifact from already-aggregated rows + totals.
Sourcepub fn canonical_bytes(&self) -> Result<Vec<u8>, String>
pub fn canonical_bytes(&self) -> Result<Vec<u8>, String>
Deterministic bytes that get signed/verified: the whole struct with the
two signature fields cleared (same convention as SignedSavingsBatchV1).
Sourcepub fn sign(&mut self, agent_id: &str) -> Result<(), String>
pub fn sign(&mut self, agent_id: &str) -> Result<(), String>
Signs with the persistent machine identity (agent_identity keystore).
Sourcepub fn sign_with_key(&mut self, key: &SigningKey) -> Result<(), String>
pub fn sign_with_key(&mut self, key: &SigningKey) -> Result<(), String>
Signs with an explicit key (hermetic tests).
Sourcepub fn verify(&self) -> EvidenceVerifyResult
pub fn verify(&self) -> EvidenceVerifyResult
Offline verification: digest over rows, then the Ed25519 signature
over the canonical bytes with the embedded public key.
Trait Implementations§
Source§impl Clone for EvidenceExportV1
impl Clone for EvidenceExportV1
Source§fn clone(&self) -> EvidenceExportV1
fn clone(&self) -> EvidenceExportV1
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EvidenceExportV1
impl Debug for EvidenceExportV1
Source§impl<'de> Deserialize<'de> for EvidenceExportV1
impl<'de> Deserialize<'de> for EvidenceExportV1
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>,
Auto Trait Implementations§
impl Freeze for EvidenceExportV1
impl RefUnwindSafe for EvidenceExportV1
impl Send for EvidenceExportV1
impl Sync for EvidenceExportV1
impl Unpin for EvidenceExportV1
impl UnsafeUnpin for EvidenceExportV1
impl UnwindSafe for EvidenceExportV1
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more