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

Function sync_auth_headers

atomic-cli/src/commands/rpc.rs:5268–5279  ·  view source on GitHub ↗

The client-side auth headers: the SAME attach_identity resolution the local bodies run (identity store + config reads + token minting — none of it redb), extracted from the built config.

(remote_url: &str, identity: Option<&str>)

Source from the content-addressed store, hash-verified

5266/// local bodies run (identity store + config reads + token minting — none
5267/// of it redb), extracted from the built config.
5268fn sync_auth_headers(remote_url: &str, identity: Option<&str>) -> HashMap<String, String> {
5269 let rt = tokio::runtime::Runtime::new()
5270 .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e)))
5271 .ok();
5272 let Some(rt) = rt else { return HashMap::new() };
5273 let config = rt.block_on(atomic_remote::auth::attach_identity(
5274 atomic_remote::HttpRemoteConfig::new(),
5275 remote_url,
5276 identity,
5277 ));
5278 config.extra_headers.into_iter().collect()
5279}
5280
5281/// Map the handler's structured sync error (stage + variant + the local
5282/// body's composed message) back to the exact CLI error the local body

Callers 3

pushFunction · 0.85
pullFunction · 0.85
query_reindexFunction · 0.85

Calls 4

attach_identityFunction · 0.85
okMethod · 0.45
collectMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected