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

Function domain_separation

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

Source from the content-addressed store, hash-verified

207
208 #[test]
209 fn domain_separation() {
210 // A signature made over the raw hash must NOT verify as a change
211 // signature (domain separation).
212 let (signing_key, _seed) = test_keypair();
213 let hash = Hash::of(b"content");
214 let raw_sig = signing_key.sign(hash.as_bytes()).to_bytes();
215
216 let sig = ChangeSignature::new("did:atomic:x", raw_sig, *hash.as_bytes(), 0);
217 let public = signing_key.verifying_key().to_bytes();
218 let err = verify_change_signature(&sig, &public, &hash).unwrap_err();
219 assert!(matches!(
220 err,
221 ChangeSignatureError::SignatureVerificationFailed { .. }
222 ));
223 }
224}

Callers

nothing calls this directly

Calls 5

verify_change_signatureFunction · 0.85
test_keypairFunction · 0.70
to_bytesMethod · 0.45
signMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected