MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse_remote_manifest

Function parse_remote_manifest

atomic-cli/src/commands/clone/helpers.rs:372–394  ·  view source on GitHub ↗

Parse and verify a view manifest downloaded from the remote. Validates three things before the manifest is trusted: 1. The text parses structurally (header + base32 change log). 2. The header names the view that was requested. 3. The declared merkle state equals the fold of the change log. # Arguments `view` - The view name that was requested from the remote `text` - The raw manifest text retu

(view: &str, text: &str, url: &str)

Source from the content-addressed store, hash-verified

370/// * `text` - The raw manifest text returned by the server
371/// * `url` - The remote URL (for error context)
372pub fn parse_remote_manifest(view: &str, text: &str, url: &str) -> CliResult<ViewManifest> {
373 let manifest = ViewManifest::parse(text).map_err(|e| CliError::RemoteError {
374 message: format!("Corrupt manifest for view '{}': {}", view, e),
375 url: Some(url.to_string()),
376 })?;
377
378 if manifest.name != view {
379 return Err(CliError::RemoteError {
380 message: format!(
381 "Manifest name mismatch: requested view '{}', server sent '{}'",
382 view, manifest.name
383 ),
384 url: Some(url.to_string()),
385 });
386 }
387
388 manifest.verify().map_err(|e| CliError::RemoteError {
389 message: format!("Corrupt manifest for view '{}': {}", view, e),
390 url: Some(url.to_string()),
391 })?;
392
393 Ok(manifest)
394}
395
396/// Order manifests so every parent is applied before its children.
397///

Calls 2

parseFunction · 0.85
verifyMethod · 0.45