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

Method get

atomic-cli/src/commands/intent/key_cache.rs:130–147  ·  view source on GitHub ↗

Look up a cached, unexpired, active key for (server, identity name). Returns `None` when the (server, name) pair is unknown, the entry is expired, or the identity is not `active` — in all cases the caller should fall back to the server.

(&self, server_url: &str, name: &str)

Source from the content-addressed store, hash-verified

128 /// expired, or the identity is not `active` — in all cases the caller
129 /// should fall back to the server.
130 pub fn get(&self, server_url: &str, name: &str) -> Option<CachedKey> {
131 if let Some(entry) = self.entries.get(name) {
132 if entry.server_url != server_url {
133 return None;
134 }
135 if entry.status != "active" {
136 return None;
137 }
138 if Utc::now() >= entry.expires_at {
139 return None;
140 }
141 return Some(CachedKey {
142 public_key: entry.public_key.clone(),
143 resolved_at: entry.resolved_at,
144 });
145 }
146 None
147 }
148
149 /// Store a resolution and persist it.
150 ///

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
cloneMethod · 0.45

Tested by

no test coverage detected