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

Function delegation_for

atomic-cli/src/commands/client.rs:118–127  ·  view source on GitHub ↗

The encoded certificate this identity presents, if it is an agent. Management calls are normally made by a human and this returns `None`. It exists so the few paths an agent legitimately drives — reading its own project list, say — carry the certificate too, rather than failing with a puzzling 401 that says the request was delegated but presented nothing.

(identity: &atomic_identity::Identity, server: &str)

Source from the content-addressed store, hash-verified

116/// project list, say — carry the certificate too, rather than failing with a
117/// puzzling 401 that says the request was delegated but presented nothing.
118fn delegation_for(identity: &atomic_identity::Identity, server: &str) -> Option<String> {
119 if !identity.identity_type.is_delegated() {
120 return None;
121 }
122 let store = IdentityStore::open_default().ok()?;
123 let resolved = crate::commands::delegation::active_for(&store, identity, Some(server)).ok()?;
124 Some(atomic_canonical::delegation::encode_for_transport(
125 &resolved.document,
126 ))
127}
128
129/// Resolve just the apex server URL for a server override.
130///

Callers 2

build_apex_clientFunction · 0.85
build_apex_client_asFunction · 0.85

Calls 3

active_forFunction · 0.85
encode_for_transportFunction · 0.85
is_delegatedMethod · 0.80

Tested by

no test coverage detected