From d159ee92ec747e34846d8c3ac91c58558cb892d4 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 08:06:31 +0000 Subject: =?UTF-8?q?db:=20identity=5Fhash=20is=20a=20digest=20of=20the=20ca?= =?UTF-8?q?nonical=20identity=20tuple=20(=C2=A75.1a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The identity is the tuple an approval pins. Rendering it as raw canonical JSON made the 'hash' a blob of unescaped JSON that no form field could carry faithfully; hash the canonical form instead and keep the JSON internal. --- src/db/model.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/db') 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())) } } -- cgit v1.2.3