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

Function wrong_key_fails

atomic-core/src/change/signing.rs:190–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188
189 #[test]
190 fn wrong_key_fails() {
191 let (_signing_key, seed) = test_keypair();
192 let (_other_key, other_seed) = test_keypair();
193 let hash = Hash::of(b"content");
194 let sig = sign_change("did:atomic:attacker", &seed, &hash, 0);
195
196 // Verify against a DIFFERENT (victim's) key — the forge scenario.
197 let victim_key = SigningKey::from_bytes(&other_seed)
198 .verifying_key()
199 .to_bytes();
200
201 let err = verify_change_signature(&sig, &victim_key, &hash).unwrap_err();
202 assert!(matches!(
203 err,
204 ChangeSignatureError::SignatureVerificationFailed { .. }
205 ));
206 }
207
208 #[test]
209 fn domain_separation() {

Callers

nothing calls this directly

Calls 4

sign_changeFunction · 0.85
verify_change_signatureFunction · 0.85
test_keypairFunction · 0.70
to_bytesMethod · 0.45

Tested by

no test coverage detected