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

Function wire_hash

libatomic/src/daemon/services.rs:1074–1084  ·  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

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