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

Method verify_mac

atomic-core/src/change/attestation.rs:533–545  ·  view source on GitHub ↗

Verify the signature. Any edited covered field — operations, changes, chain link, agent, counters — fails; so does a missing signature.

(&self, key_hex: &str)

Source from the content-addressed store, hash-verified

531 /// Verify the signature. Any edited covered field — operations, changes,
532 /// chain link, agent, counters — fails; so does a missing signature.
533 pub fn verify_mac(&self, key_hex: &str) -> bool {
534 let Some(signature) = &self.signature else {
535 return false;
536 };
537 let input = self.signature_input();
538 let key = blake3::derive_key("atomic-attestation v3 signature", key_hex.as_bytes());
539 blake3::Hasher::new_keyed(&key)
540 .update(&input)
541 .finalize()
542 .to_hex()
543 .as_str()
544 == signature.as_str()
545 }
546
547 /// Whether this attestation was signed by a session MAC key (V3 signer
548 /// class `session-mac:<session_id>`).

Callers 4

runMethod · 0.80

Calls 6

signature_inputMethod · 0.80
as_bytesMethod · 0.45
as_strMethod · 0.45
to_hexMethod · 0.45
finalizeMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected