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

Method verify

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

Verify an attestation under this policy, failing closed on every refusal path (see the type docs).

(&self, attestation: &Attestation)

Source from the content-addressed store, hash-verified

1133 /// Verify an attestation under this policy, failing closed on every
1134 /// refusal path (see the type docs).
1135 pub fn verify(&self, attestation: &Attestation) -> Result<(), AttestationError> {
1136 let Some(_signature) = &attestation.signature else {
1137 return Err(AttestationError::Unsigned);
1138 };
1139 let Some(signer) = attestation.signer.as_deref() else {
1140 return Err(AttestationError::Unsigned);
1141 };
1142
1143 if signer.starts_with("session-mac:") {
1144 return Err(AttestationError::SessionMacSignerNotTrusted {
1145 signer: signer.to_string(),
1146 });
1147 }
1148
1149 let Some(public_key) = self.trusted.get(signer) else {
1150 return Err(AttestationError::SignerNotTrusted {
1151 signer: signer.to_string(),
1152 });
1153 };
1154
1155 if !attestation.verify_with_did(public_key) {
1156 return Err(AttestationError::SignatureVerificationFailed {
1157 signer: signer.to_string(),
1158 });
1159 }
1160
1161 Ok(())
1162 }
1163}
1164
1165// Error Type

Callers 7

parse_remote_manifestFunction · 0.45
parse_remote_manifestFunction · 0.45
runMethod · 0.45
verify_with_didMethod · 0.45
verify_change_signatureFunction · 0.45
deserializeMethod · 0.45

Calls 2

verify_with_didMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected