truthlinked_sdk/
types.rs

1use serde::{Deserialize, Serialize};
2
3/// License tier
4#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
5#[serde(rename_all = "lowercase")]
6pub enum Tier {
7    Free,
8    Professional,
9    Enterprise,
10    Government,
11}
12
13/// Health check response
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct HealthResponse {
16    pub status: String,
17    pub version: String,
18}
19
20/// Token exchange request
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct TokenRequest {
23    pub sso_token: String,
24    pub requested_scope: Vec<String>,
25    pub nonce: String,
26    pub channel_binding: String,
27}
28
29/// Token exchange response
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct TokenResponse {
32    pub af_token: String,
33    pub granted_scope: Vec<String>,
34    pub expires_at: u64,
35    pub exchange_id: String,
36}
37
38/// Token validation response
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct ValidateResponse {
41    pub valid: bool,
42    pub subject: Option<String>,
43    pub scope: Option<Vec<String>>,
44}
45
46/// Shadow decision
47#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct ShadowDecision {
49    pub divergence_id: String,
50    pub iam_allowed: bool,
51    pub af_would_allow: bool,
52    pub breach_prevented: bool,
53}
54
55/// Shadow replay request
56#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct ReplayRequest {
58    pub logs: Vec<String>,
59    pub adapter: String,
60}
61
62/// Shadow replay response
63#[derive(Debug, Clone, Serialize, Deserialize)]
64pub struct ReplayResponse {
65    pub events_processed: u64,
66    pub breaches_prevented: u64,
67    pub false_positives_avoided: u64,
68}
69
70/// SOX compliance report
71#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct SoxReport {
73    pub period: String,
74    pub total_events: u64,
75    pub audit_trail_complete: bool,
76    pub no_gaps: bool,
77}
78
79/// PCI-DSS compliance report
80#[derive(Debug, Clone, Serialize, Deserialize)]
81pub struct PciReport {
82    pub period: String,
83    pub access_controls_enforced: bool,
84    pub encryption_verified: bool,
85    pub audit_complete: bool,
86}
87
88/// Audit log entry
89#[derive(Debug, Clone, Serialize, Deserialize)]
90pub struct AuditLog {
91    pub timestamp: u64,
92    pub event_type: String,
93    pub subject: String,
94    pub action: String,
95    pub result: String,
96}
97
98/// Usage statistics
99#[derive(Debug, Clone, Serialize, Deserialize)]
100pub struct UsageResponse {
101    pub tier: String,
102    pub usage: u32,
103    pub limit: u32,
104    pub percentage: f32,
105    pub days_remaining: i64,
106}