pedant_types/attestation.rs
1use serde::{Deserialize, Serialize};
2
3use crate::CapabilityProfile;
4
5/// How deeply the source was analyzed, affecting finding accuracy.
6#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash)]
7#[serde(rename_all = "snake_case")]
8pub enum AnalysisTier {
9 /// Pattern-based detection on unresolved syntax trees.
10 Syntactic,
11 /// Type-resolved analysis via rust-analyzer.
12 Semantic,
13 /// Full inter-procedural data-flow tracking.
14 DataFlow,
15}
16
17/// Signed attestation binding a source hash to its capability profile.
18#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
19pub struct AttestationContent {
20 /// Schema version for forward compatibility (e.g., `"0.1.0"`).
21 pub spec_version: Box<str>,
22 /// SHA-256 digest of the concatenated source files.
23 pub source_hash: Box<str>,
24 /// Crate name from `Cargo.toml`.
25 pub crate_name: Box<str>,
26 /// Crate version from `Cargo.toml`.
27 pub crate_version: Box<str>,
28 /// How deeply the source was analyzed.
29 pub analysis_tier: AnalysisTier,
30 /// UTC seconds since Unix epoch.
31 pub timestamp: u64,
32 /// Capability findings from the analysis.
33 pub profile: CapabilityProfile,
34}