pub use vti_common::backup_transfer::chunked::*;
use vti_common::auth::AuthClaims;
use vti_common::error::AppError;
use super::descriptors::DescriptorDeps;
pub async fn initiate_export(
deps: &DescriptorDeps<'_>,
auth: &AuthClaims,
password: &str,
include_audit: bool,
max_chunk_size: Option<u64>,
) -> Result<ChunkedBundle, ChunkedError> {
check_initiate(deps.bundles_ks, auth).await?;
let envelope = {
let config_guard = deps.config.read().await;
super::export_backup(
&deps.target,
deps.seed_store.as_ref(),
&config_guard,
auth,
password,
include_audit,
)
.await?
};
let bytes = serde_json::to_vec(&envelope)
.map_err(|e| AppError::Internal(format!("serialize backup envelope: {e}")))?;
stage_export(
deps.bundles_ks,
deps.blob_dir,
&auth.did,
&bytes,
max_chunk_size,
)
.await
}