tf-types 0.1.8

Core semantic types, traits, and schemas powering the TrustForge protocol.
Documentation
// GENERATED by `tf-schema codegen --target rust` — DO NOT EDIT BY HAND.

#![allow(unused_imports, non_camel_case_types, non_snake_case, clippy::all)]

use serde::{Deserialize, Serialize};
use super::*;

/// Adversary profile.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Adversary {
    /// Stable adversary identifier.
    pub id: String,
    /// Who this adversary is and what they want.
    pub description: String,
    /// Capabilities attributed to this adversary.
    pub capability_levels: Vec<Adversary_CapabilityLevels_Item>,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Adversary_CapabilityLevels_Item {
    #[serde(rename = "opportunistic")]
    Opportunistic,
    #[serde(rename = "targeted")]
    Targeted,
    #[serde(rename = "insider")]
    Insider,
    #[serde(rename = "nation-state")]
    NationState,
    #[serde(rename = "ai-assisted")]
    AiAssisted,
}

/// Asset under threat analysis.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Asset {
    /// Stable asset identifier.
    pub id: String,
    /// What this asset is and why it matters.
    pub description: String,
    /// Risk class describing asset-loss impact.
    pub criticality: RiskClass,
}

/// Mitigation applied to one or more assets or attack classes.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Mitigation {
    /// Stable mitigation identifier.
    pub id: String,
    /// Asset or attack-class identifiers this mitigation covers.
    pub applies_to: Vec<String>,
    /// What the mitigation does.
    pub description: String,
    /// Implementation status.
    pub status: Mitigation_Status,
}

/// Implementation status.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Mitigation_Status {
    #[serde(rename = "planned")]
    Planned,
    #[serde(rename = "implemented")]
    Implemented,
    #[serde(rename = "not-applicable")]
    NotApplicable,
}

/// Risk accepted after mitigations.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ResidualRisk {
    /// Nature of the residual risk.
    pub description: String,
    /// Actor who accepted this risk.
    pub accepted_by: ActorId,
    /// When the acceptance was recorded.
    pub accepted_at: Timestamp,
}

/// Declarative threat-model manifest referenced by TF-0006 and by agent-contract.references.threat_model.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ThreatModel {
    /// Version of the threat-model manifest schema itself.
    pub threat_model_version: ThreatModel_ThreatModelVersion,
    /// Project identifier this threat model applies to.
    pub project: String,
    /// Assets whose protection this threat model addresses.
    pub assets: Vec<Asset>,
    /// Adversary profiles this threat model considers.
    pub adversaries: Vec<Adversary>,
    /// Attack-class identifiers relevant to this project (open-ended taxonomy).
    pub attack_classes: Vec<String>,
    /// Mitigations implemented, planned, or deliberately not applicable.
    pub mitigations: Vec<Mitigation>,
    /// Risks explicitly accepted after mitigations.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub residual_risks: Option<Vec<ResidualRisk>>,
}

/// Version of the threat-model manifest schema itself.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum ThreatModel_ThreatModelVersion {
    #[serde(rename = "1")]
    V1,
}