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

Function wire_hash

libatomic/src/daemon/services.rs:1075–1085  ·  view source on GitHub ↗

A wire Hash → the domain Merkle, refusing a malformed value.

(hash: &crate::atomic::Hash)

Source from the content-addressed store, hash-verified

1073
1074/// A wire Hash → the domain Merkle, refusing a malformed value.
1075fn wire_hash(hash: &crate::atomic::Hash) -> Result<atomic_core::types::Merkle, Status> {
1076 let mut bytes = [0u8; 32];
1077 if hash.value.len() != 32 {
1078 return Err(domain_status(
1079 ErrorCode::InvalidArgument,
1080 "hash must be 32 bytes",
1081 ));
1082 }
1083 bytes.copy_from_slice(&hash.value);
1084 Ok(atomic_core::types::Merkle(bytes))
1085}
1086
1087/// Resolve one raw change reference with the local insert bodies'
1088/// semantics: a full base32 hash parses directly; otherwise a

Callers 1

insert_changesMethod · 0.85

Calls 3

domain_statusFunction · 0.85
MerkleClass · 0.85
lenMethod · 0.45

Tested by

no test coverage detected