atlas_cli/storage/
rekor.rs

1use crate::error::{Error, Result};
2use crate::storage::traits::{ManifestMetadata, StorageBackend};
3use atlas_c2pa_lib::manifest::Manifest;
4use reqwest;
5
6#[allow(dead_code)]
7pub struct RekorStorage {
8    client: reqwest::blocking::Client,
9    base_url: String,
10}
11
12impl RekorStorage {
13    pub fn new() -> Result<Self> {
14        Self::new_with_url("https://rekor.sigstore.dev".to_string())
15    }
16
17    pub fn new_with_url(url: String) -> Result<Self> {
18        Ok(RekorStorage {
19            client: reqwest::blocking::Client::new(),
20            base_url: url,
21        })
22    }
23}
24
25impl StorageBackend for RekorStorage {
26    fn store_manifest(&self, _manifest: &Manifest) -> Result<String> {
27        // TODO: Implement actual storage
28        println!("Would store manifest at: {}", self.base_url);
29        Ok("dummy-manifest-id".to_string()) // Return a dummy manifest ID for now
30    }
31
32    fn retrieve_manifest(&self, _id: &str) -> Result<Manifest> {
33        todo!("Implement manifest retrieval")
34    }
35
36    fn list_manifests(&self) -> Result<Vec<ManifestMetadata>> {
37        todo!("Implement manifest listing")
38    }
39    fn delete_manifest(&self, _id: &str) -> Result<()> {
40        // Implement deletion for Rekor if supported, or return error
41        Err(Error::Storage(
42            "Delete operation not supported for Rekor storage".to_string(),
43        ))
44    }
45    fn as_any(&self) -> &dyn std::any::Any {
46        self
47    }
48}