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

Function compute_verifies

atomic-cli/src/commands/memory/list.rs:230–247  ·  view source on GitHub ↗

The DID-match-then-verify rule for a memory. Pure over its inputs so it can be unit-tested without a global `IdentityStore`. See the intent list's `compute_verifies` for the full rationale — identical rule, `verify_memory`.

(attested: &bridge::Attestation, verifier: Option<&Verifier>)

Source from the content-addressed store, hash-verified

228/// unit-tested without a global `IdentityStore`. See the intent list's
229/// `compute_verifies` for the full rationale — identical rule, `verify_memory`.
230fn compute_verifies(attested: &bridge::Attestation, verifier: Option<&Verifier>) -> Verifies {
231 let node = match attested {
232 bridge::Attestation::Fresh(node) => node,
233 bridge::Attestation::Stale(_) | bridge::Attestation::None => return Verifies::Na,
234 };
235 let verifier = match verifier {
236 Some(v) => v,
237 None => return Verifies::Na,
238 };
239 match node.attributed_to.as_deref() {
240 Some(signer) if signer == verifier.did => {}
241 _ => return Verifies::Na,
242 }
243 match atomic_canonical::verify_memory(node, &verifier.public_key) {
244 Ok(()) => Verifies::Yes,
245 Err(_) => Verifies::No,
246 }
247}
248
249/// The `(kind, status, about)` display columns for a memory. Prefers the attested
250/// node when Fresh/Stale; falls back to a lenient lift of the raw memory when

Callers 1

compute_rowFunction · 0.70

Calls 1

verify_memoryFunction · 0.50

Tested by

no test coverage detected