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

Function compute_verifies

atomic-cli/src/commands/memory/list.rs:156–173  ·  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

154/// unit-tested without a global `IdentityStore`. See the intent list's
155/// `compute_verifies` for the full rationale — identical rule, `verify_memory`.
156fn compute_verifies(attested: &bridge::Attestation, verifier: Option<&Verifier>) -> Verifies {
157 let node = match attested {
158 bridge::Attestation::Fresh(node) => node,
159 bridge::Attestation::Stale(_) | bridge::Attestation::None => return Verifies::Na,
160 };
161 let verifier = match verifier {
162 Some(v) => v,
163 None => return Verifies::Na,
164 };
165 match node.attributed_to.as_deref() {
166 Some(signer) if signer == verifier.did => {}
167 _ => return Verifies::Na,
168 }
169 match atomic_canonical::verify_memory(node, &verifier.public_key) {
170 Ok(()) => Verifies::Yes,
171 Err(_) => Verifies::No,
172 }
173}
174
175/// The `(kind, status, about)` display columns for a memory. Prefers the attested
176/// 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