| 340 | } |
| 341 | |
| 342 | async fn save_verification_reports( |
| 343 | &self, |
| 344 | id: &str, |
| 345 | reports: &[VerificationReport], |
| 346 | ) -> Result<()> { |
| 347 | let path = self.verification_path(id); |
| 348 | if let Some(parent) = path.parent() { |
| 349 | fs::create_dir_all(parent).await.with_context(|| { |
| 350 | format!( |
| 351 | "Failed to create verification report directory: {}", |
| 352 | parent.display() |
| 353 | ) |
| 354 | })?; |
| 355 | } |
| 356 | |
| 357 | let json = serde_json::to_string_pretty(reports).with_context(|| { |
| 358 | format!("Failed to serialize verification reports for session {id}") |
| 359 | })?; |
| 360 | fs::write(&path, json).await.with_context(|| { |
| 361 | format!("Failed to write verification reports to {}", path.display()) |
| 362 | })?; |
| 363 | Ok(()) |
| 364 | } |
| 365 | |
| 366 | async fn load_verification_reports(&self, id: &str) -> Result<Option<Vec<VerificationReport>>> { |
| 367 | let path = self.verification_path(id); |