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

Function compute_verifies

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

175/// would be a false negative);
176/// - same signer ⇒ run `verify`: `Ok` ⇒ `Yes`, `Err` ⇒ `No`.
177fn compute_verifies(attested: &bridge::Attestation, verifier: Option<&Verifier>) -> Verifies {
178 let node = match attested {
179 bridge::Attestation::Fresh(node) => node,
180 bridge::Attestation::Stale(_) | bridge::Attestation::None => return Verifies::Na,
181 };
182 let verifier = match verifier {
183 Some(v) => v,
184 None => return Verifies::Na,
185 };
186 // DID pre-check FIRST: a different (or absent) signer is `–`, not `✗`.
187 match node.attributed_to.as_deref() {
188 Some(signer) if signer == verifier.did => {}
189 _ => return Verifies::Na,
190 }
191 // Same signer ⇒ the only path that can yield `✗` is a real hash/sig failure.
192 match atomic_canonical::verify(node, &verifier.public_key) {
193 Ok(()) => Verifies::Yes,
194 Err(_) => Verifies::No,
195 }
196}
197
198/// Classify a loaded attestation into the `attested` column token.
199fn classify(attested: &bridge::Attestation) -> Attested {

Callers 1

compute_rowFunction · 0.70

Calls 1

verifyFunction · 0.50

Tested by

no test coverage detected