22 lines
1.6 KiB
Markdown
22 lines
1.6 KiB
Markdown
# proof-kinds: one builder for every AIP-23 proof kind
|
|
|
|
A generic builder of AERE Proof Protocol envelopes (AIP-23) for the standard proof kinds: `data`, `execution`, `identity`,
|
|
`compliance`, `runtime`, `location`, `device`, `payment`, `ownership`, `time`, `block`, `authorization`, `settlement` and
|
|
`provenance`. Every kind produces the same envelope (`statement` plus `statementHash`, the SHA-256 of the canonical statement
|
|
text), so the same AIP-23 reference verifier checks all of them with no kind-specific verification code.
|
|
|
|
```
|
|
import { buildProof, KINDS } from './proof-kinds.mjs';
|
|
const envelope = buildProof('runtime', { host, artifactContent, attested, matches: true, createdAt });
|
|
```
|
|
|
|
A kind is a schema: its required fields, some of them digests, plus `createdAt`. Raw content given for a digest field is hashed
|
|
(bytes as they are, strings as UTF-8, other values as their JSON text), and a value that is already a 32-byte digest is kept, so
|
|
an envelope carries digests, never the raw content. A missing required field stops the build with an error instead of producing
|
|
an incomplete envelope. Notarization and post-quantum finality come from AIP-23, not from this builder.
|
|
|
|
Test: `node proba-proof-kinds.mjs` (24 checks: every kind built and found `VALID` by the reference verifier, six negative
|
|
controls such as content changed after hashing or a required field missing, no raw content in any envelope, bytes hashed as
|
|
bytes). It needs the AIP-23 reference verifier: `AERE_VERIFY_PROOF=<path to verify-proof.mjs>` (from the `aere-node`
|
|
repository, after `npm install` there); without it the test reports that it did not measure and exits with 2. Node.js 24.
|