use std::sync::Arc;
use super::error::StorageResult;
use super::paths::StoragePaths;
#[cfg_attr(not(target_arch = "wasm32"), uniffi::export(with_foreign))]
pub trait DeviceKeystore: Send + Sync {
fn seal(
&self,
associated_data: Vec<u8>,
plaintext: Vec<u8>,
) -> StorageResult<Vec<u8>>;
fn open_sealed(
&self,
associated_data: Vec<u8>,
ciphertext: Vec<u8>,
) -> StorageResult<Vec<u8>>;
}
#[cfg_attr(not(target_arch = "wasm32"), uniffi::export(with_foreign))]
pub trait AtomicBlobStore: Send + Sync {
fn read(&self, path: String) -> StorageResult<Option<Vec<u8>>>;
fn write_atomic(&self, path: String, bytes: Vec<u8>) -> StorageResult<()>;
fn delete(&self, path: String) -> StorageResult<()>;
}
#[cfg_attr(not(target_arch = "wasm32"), uniffi::export(with_foreign))]
pub trait StorageProvider: Send + Sync {
fn keystore(&self) -> Arc<dyn DeviceKeystore>;
fn blob_store(&self) -> Arc<dyn AtomicBlobStore>;
fn paths(&self) -> Arc<StoragePaths>;
}