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

Function verifies_token

libatomic/src/daemon/services_agent.rs:1037–1057  ·  view source on GitHub ↗

The DID-match-then-verify rule (the lists' `verifies` column): "na" when there is no fresh attestation, no resolvable identity, or a different signer; "yes"/"no" only for a same-signer fresh node. The same rule the CLI bodies apply, ported so the handler owns it.

(
    node: Option<&N>,
    attributed_to: Option<&str>,
    verifier: Option<&ListingVerifier>,
    verify: impl FnOnce(&N, &atomic_identity::keypair::PublicKey) -> bool,
)

Source from the content-addressed store, hash-verified

1035/// different signer; "yes"/"no" only for a same-signer fresh node. The
1036/// same rule the CLI bodies apply, ported so the handler owns it.
1037fn verifies_token<N>(
1038 node: Option<&N>,
1039 attributed_to: Option<&str>,
1040 verifier: Option<&ListingVerifier>,
1041 verify: impl FnOnce(&N, &atomic_identity::keypair::PublicKey) -> bool,
1042) -> &'static str {
1043 let (Some(node), Some(verifier)) = (node, verifier) else {
1044 return "na";
1045 };
1046 // DID pre-check FIRST: a different (or absent) signer is "na", not
1047 // "no" (a merely-unresolvable signer is NOT a failure).
1048 if attributed_to != Some(verifier.did.as_str()) {
1049 return "na";
1050 }
1051 // Same signer ⇒ the only path to "no" is a real hash/signature failure.
1052 if verify(node, &verifier.public_key) {
1053 "yes"
1054 } else {
1055 "no"
1056 }
1057}
1058
1059/// One loaded attestation artifact, classified against the current source
1060/// (the fresh/stale/none trichotomy the listings render).

Callers 1

list_vault_entriesMethod · 0.85

Calls 2

verifyFunction · 0.50
as_strMethod · 0.45

Tested by

no test coverage detected