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

Function vault_entry_revision_hash

atomic-cli/src/commands/vault/mod.rs:79–86  ·  view source on GitHub ↗

Identify the exact stored Vault revision, including entry type, frontmatter, and body rather than only the body content hash.

(entry: &VaultEntry)

Source from the content-addressed store, hash-verified

77/// Identify the exact stored Vault revision, including entry type,
78/// frontmatter, and body rather than only the body content hash.
79fn vault_entry_revision_hash(entry: &VaultEntry) -> String {
80 let mut hasher = Hasher::new();
81 hasher.update(b"atomic-vault-revision-v1");
82 append_revision_field(&mut hasher, entry.entry_type.as_str().as_bytes());
83 append_revision_field(&mut hasher, entry.frontmatter_json.as_bytes());
84 append_revision_field(&mut hasher, &entry.content_bytes);
85 hasher.finalize().to_base32()
86}
87
88fn append_revision_field(hasher: &mut Hasher, value: &[u8]) {
89 hasher.update(&(value.len() as u64).to_be_bytes());

Callers 4

runMethod · 0.85
resolve_and_rankFunction · 0.85

Calls 6

append_revision_fieldFunction · 0.85
updateMethod · 0.80
as_bytesMethod · 0.45
as_strMethod · 0.45
to_base32Method · 0.45
finalizeMethod · 0.45