diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 08:06:31 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 08:06:31 +0000 |
| commit | d159ee92ec747e34846d8c3ac91c58558cb892d4 (patch) | |
| tree | 60055051dbbfd00cc40c601be0646f92953fecff /src/db | |
| parent | 04b40812f3366c71bf1c99779f880cc74b7f9efa (diff) | |
| download | aur-build-d159ee92ec747e34846d8c3ac91c58558cb892d4.tar.gz aur-build-d159ee92ec747e34846d8c3ac91c58558cb892d4.zip | |
db: identity_hash is a digest of the canonical identity tuple (ยง5.1a)
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.
Diffstat (limited to 'src/db')
| -rw-r--r-- | src/db/model.rs | 5 |
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())) } } |
