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

Function compute_verifies

atomic-cli/src/commands/intent/list.rs:200–219  ·  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

198/// would be a false negative);
199/// - same signer ⇒ run `verify`: `Ok` ⇒ `Yes`, `Err` ⇒ `No`.
200fn compute_verifies(attested: &bridge::Attestation, verifier: Option<&Verifier>) -> Verifies {
201 let node = match attested {
202 bridge::Attestation::Fresh(node) => node,
203 bridge::Attestation::Stale(_) | bridge::Attestation::None => return Verifies::Na,
204 };
205 let verifier = match verifier {
206 Some(v) => v,
207 None => return Verifies::Na,
208 };
209 // DID pre-check FIRST: a different (or absent) signer is `–`, not `✗`.
210 match node.attributed_to.as_deref() {
211 Some(signer) if signer == verifier.did => {}
212 _ => return Verifies::Na,
213 }
214 // Same signer ⇒ the only path that can yield `✗` is a real hash/sig failure.
215 match atomic_canonical::verify(node, &verifier.public_key) {
216 Ok(()) => Verifies::Yes,
217 Err(_) => Verifies::No,
218 }
219}
220
221/// Classify a loaded attestation into the `attested` column token.
222fn classify(attested: &bridge::Attestation) -> Attested {

Callers 1

compute_rowFunction · 0.70

Calls 1

verifyFunction · 0.50

Tested by

no test coverage detected