summaryrefslogtreecommitdiffstats
path: root/src/db/model.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/model.rs')
-rw-r--r--src/db/model.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/db/model.rs b/src/db/model.rs
index 66674ab..07065c5 100644
--- a/src/db/model.rs
+++ b/src/db/model.rs
@@ -58,8 +58,11 @@ impl Identity {
/// The hash that makes I3 a fact: two byte-identical inputs never produce
/// two candidates, and any change to what becomes a byte in the artifact
/// produces a new one.
+ /// A digest of the canonical JSON of the identity tuple. This is the value
+ /// an approval must echo: two candidates share an `identity_hash` only if
+ /// every pin, digest and version in them is identical.
pub fn hash(&self) -> String {
- hash::canonical_json(self)
+ format!("sha256:{}", hash::hex(hash::canonical_json(self).as_bytes()))
}
}