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

Function compute_verifies

atomic-cli/src/commands/intent/list.rs:296–315  ·  view source on GitHub ↗

The DID-match-then-verify rule for an intent. Pure over its inputs so it can be unit-tested without a global `IdentityStore`. - `attested` None ⇒ `Na`. - `attested` Stale ⇒ `Na` (staleness is surfaced by the attested column; there is nothing fresh to cryptographically verify — do NOT feed a Stale node to `verify`, which would report `✗` on a changed-but-validly-signed node). - `attested` Fresh: -

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

Source from the content-addressed store, hash-verified

294/// would be a false negative);
295/// - same signer ⇒ run `verify`: `Ok` ⇒ `Yes`, `Err` ⇒ `No`.
296fn compute_verifies(attested: &bridge::Attestation, verifier: Option<&Verifier>) -> Verifies {
297 let node = match attested {
298 bridge::Attestation::Fresh(node) => node,
299 bridge::Attestation::Stale(_) | bridge::Attestation::None => return Verifies::Na,
300 };
301 let verifier = match verifier {
302 Some(v) => v,
303 None => return Verifies::Na,
304 };
305 // DID pre-check FIRST: a different (or absent) signer is `–`, not `✗`.
306 match node.attributed_to.as_deref() {
307 Some(signer) if signer == verifier.did => {}
308 _ => return Verifies::Na,
309 }
310 // Same signer ⇒ the only path that can yield `✗` is a real hash/sig failure.
311 match atomic_canonical::verify(node, &verifier.public_key) {
312 Ok(()) => Verifies::Yes,
313 Err(_) => Verifies::No,
314 }
315}
316
317/// Classify a loaded attestation into the `attested` column token.
318fn classify(attested: &bridge::Attestation) -> Attested {

Callers 1

compute_rowFunction · 0.70

Calls 1

verifyFunction · 0.50

Tested by

no test coverage detected