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

Function validate_conflicts_pack

atomic-repository/src/git_binding/privacy.rs:121–134  ·  view source on GitHub ↗

Verify conflict-pack bytes against the claimed conflict-set identity. The pack is the canonical [`crate::repository::ConflictSetObject`] bytes (not a family bag): its identity is re-derived here so a forged or stale pack cannot ride alongside a binding commit. Conflict objects carry graph facts only — identities, base/sides, modes, claimants — so they may enter Git; provenance/attestation payload

(
    bytes: &[u8],
    claimed_hash: &atomic_core::Hash,
)

Source from the content-addressed store, hash-verified

119/// facts only — identities, base/sides, modes, claimants — so they may enter
120/// Git; provenance/attestation payloads still never do.
121pub fn validate_conflicts_pack(
122 bytes: &[u8],
123 claimed_hash: &atomic_core::Hash,
124) -> Result<(), ConflictPackError> {
125 use atomic_core::types::Base32;
126 let actual = conflicts_pack_self_validates(bytes)?;
127 if actual != *claimed_hash {
128 return Err(ConflictPackError::HashMismatch {
129 claimed: claimed_hash.to_base32(),
130 actual: actual.to_base32(),
131 });
132 }
133 Ok(())
134}
135
136/// Errors from conflict-pack admission into a binding tree.
137#[derive(Debug, thiserror::Error)]

Callers 1

runMethod · 0.85

Calls 2

to_base32Method · 0.45

Tested by

no test coverage detected