Skip to main content

pedant_types/
attestation.rs

1use std::sync::Arc;
2
3use serde::{Deserialize, Serialize};
4
5use crate::CapabilityProfile;
6
7/// The depth of analysis performed.
8#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash)]
9#[serde(rename_all = "snake_case")]
10pub enum AnalysisTier {
11    /// Pattern-based detection on syntax trees.
12    Syntactic,
13    /// Type-aware analysis with resolved names.
14    Semantic,
15    /// Full data-flow tracking through the program.
16    DataFlow,
17}
18
19/// The content of a capability attestation for a crate.
20#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
21pub struct AttestationContent {
22    /// Schema version for forward compatibility.
23    pub spec_version: Arc<str>,
24    /// Hash of the analyzed source.
25    pub source_hash: Arc<str>,
26    /// Name of the analyzed crate.
27    pub crate_name: Arc<str>,
28    /// Version of the analyzed crate.
29    pub crate_version: Arc<str>,
30    /// Depth of the analysis performed.
31    pub analysis_tier: AnalysisTier,
32    /// Seconds since Unix epoch (UTC).
33    pub timestamp: u64,
34    /// The capability profile produced by analysis.
35    pub profile: CapabilityProfile,
36}