Specification · v2

Canonicalization v2

v1 made the hash recomputable only by someone holding the full record, and the full record contains the amount. v2 commits to that amount instead of carrying it, so the hash is recomputable from the public response while the value stays private until you choose to release it.

01

What v1 could not do

Under v1 the hash covered the action amount, target, data classes and risk score in the clear. The public verification response could not publish them without disclosing a client's commercial detail, so it published a verdict instead: verified: true. That is Aprve asserting the record is intact, not a third party checking it. The proof was real; the ability to check it was not transferable.

Publishing the values was the obvious fix and the wrong one. Amounts, targets and data classes are the part a client will not put on a public page, and an insurance reviewer is exactly the party you would not want to expose them to.

02

The commitment

Each sensitive value is replaced by a commitment: sha256(salt + ":" + field + ":" + stableStringify(value)). The salt is 32 random bytes generated per field, so releasing one value does not hand over the means to search the others. The commitments go into the canonical payload; the salts do not.

That single choice is what makes both properties hold at once. Anyone can recompute the record hash from the published payload, because the commitments are in it. Nobody can read the amount from the commitment, because the salt is not published, and a 32-byte salt puts brute force out of reach even for an amount that can only be one of a few thousand values.

Note the difference from publishing the salt alongside the record: that would let anyone enumerate plausible amounts and match the commitment. The salt travels with the value, not with the record, so disclosure is a deliberate act by the operator rather than a side effect of verification.

03

The v2 field set

Still 24 fields, so a reader compares the two versions field by field. Four change name and content: action_amount_usd → action_amount_usd_commit, action_data_classes → action_data_classes_commit, action_target → action_target_commit, risk_score → risk_score_commit. Everything else is byte-identical to v1.

client_idproject_idseqdecision_iddecided_atagent_idagent_nameaction_toolaction_amount_usd_commitaction_data_classes_commitaction_target_commitrisk_score_commitdecisiondecision_sourcematched_rule_idmatched_rule_namepolicy_idpolicy_versionexplanationrecord_typecorrection_ofhandoff_fromtraining_excludedprev_hash

Serialization, digest and the chain rule are unchanged from v1.

04

The published record

This is the live v2 demo record, seq 2 of the demo chain. Its salt and cleartext are published here on purpose: it is the one record where you can check the commitment and the hash from the same page.

canonical preimage · 24 v2 fields
{"action_amount_usd_commit":"7b412531a132790bc6bfa5d74a061b8dd0540fea57c53021817d75d5c376c8ce","action_data_classes_commit":"eb2b759eb6be53130ceba9080310eda03b975022e9c4bbfe8dcc976fca95565d","action_target_commit":"18d4660f9e10905f36a6d2eba8757b2250337298a6885ed75ca0c4b3c86e72c7","action_tool":"refund.create","agent_id":"demo-agent-01","agent_name":"Demo agent","client_id":"6b048d50f944cb895b485f90","correction_of":null,"decided_at":"2026-11-24T18:05:00.000Z","decision":"allow","decision_id":"dec_demo_v2","decision_source":"policy","explanation":"The refund is under the automated ceiling and touches no restricted data class.","handoff_from":null,"matched_rule_id":"spend-under-250","matched_rule_name":"Refunds up to 250 USD","policy_id":"6b048d51fa85c086cf641ff1","policy_version":1,"prev_hash":"078506dc868d5413af74db8267801c4bf602dea47d0446ef97ca517d5e8a5948","project_id":null,"record_type":"authorization","risk_score_commit":"414436afbf18b3d5dff72e4e710c68dd263ab4e6301a303e58b45cbd53f55120","seq":2,"training_excluded":false}
sha-256 of the preimage (utf-8)
4fae5603ba18b3f8bc8eaa88f05e9b59ceb79c4a3d2852e639561412967ff4f4
commitment construction
import { createHash } from "node:crypto";

// sha256(salt + ":" + field + ":" + canonical JSON of the value)
const commit = (salt, field, value) =>
  createHash("sha256").update(salt + ":" + field + ":" + stable(value), "utf8").digest("hex");

// The published demo: salt, value, and the commitment it produces.
commit(
  "9f2c41d7a8b3e650c14d92fa77b03e5188c6ad4f2e91b7d3c50a68f417e2bd09",
  "action_amount_usd",
  240,
); // → 7b412531a132790bc6bfa5d74a061b8dd0540fea57c53021817d75d5c376c8ce

The record resolves at the public verification page, which returns this same payload and withholds the salt.

05

Disclosure, when you want it

An auditor, a broker or a court can be given the salt and the value. verifyCommitment({ salt, field, value, commit }) recomputes the commitment and returns whether it matches the one inside the hash. A wrong value fails, so a disclosure cannot be fudged: the value is either the one the record committed to or it is not.

That is the whole selective-disclosure story. Integrity is public by default; the values are disclosed per record, per field, to the party who needs them, and each disclosure is checkable against a hash that was fixed before anyone asked.

06

Conformance

The v2 vectors are frozen constants at /api/v1/conformance, and /verifier.js carries both rules. A conforming verifier reproduces every published vector exactly, rejects both tampered records, rejects a mismatched disclosure, and accepts the published head while rejecting one that does not match the records.

Run it here, in your browser

Downloads the published verifier and checks v1 and v2 against the published vectors. No server flag is trusted.

07

Migration

v1 is frozen, not retired. A record carries the version it was written under, in hash_version, and verification applies the rule that record declares. Chains cross the boundary without special handling: a v1 record's hash is the next v2 record's prev_hash, so the demo chain is v1 at seq 1 and v2 at seq 2 and 3. Everything written from now on is v2.

The decision path is untouched by any of this: four salts and four extra hashes per record, on the same write it already performed.

08

Chain heads

A hash proves a record. A head proves the set: one sequence number and hash per client, refreshed hourly and published at /api/v1/heads. Hold one today and a chain that ends earlier tomorrow has been truncated, whatever the records individually say. Each head carries its age, so a stale head reads as stale rather than as current.

v1 is documented at /docs/canonicalization and is not edited again.

09

Embed the head

A client can carry the head on their own site instead of citing a screenshot. One SVG, public data only, no record values, and it visibly goes stale if publishing stops.

html
<a href="https://aprve.com/api/v1/heads">
  <img src="https://aprve.com/api/v1/head/demo" alt="Aprve chain head" width="480" height="132" />
</a>

The head is the whole integrity claim in one line, and it is what an insurance brief cites.

secured by Aprve · hash-chained, append-only

A decision you can verify right now
permanent demo decisionALLOW
action
refund.create · $180
rule
Refunds up to 250 USD
record
seq 1
sha-256
078506dc86…8a5948
statement
anchored
receipt
moment-j5xx23u1
dec_demo_permanent

Cite: Aprve decision dec_demo_permanent, seq 1, sha-256 078506dc868d5413af74db8267801c4bf602dea47d0446ef97ca517d5e8a5948