identity: the Travel Rule and compliance-policy verifiers name their rules; a missing originator id or nonce is now a refusal in acceptBeneficiary; conformance: Travel Rule and compliance presentations enrolled (239 rules, 15 verifiers, 21 kinds, 619 vectors), nothing of identity left out
This commit is contained in:
1 parent
e1bb4e25d8
commit
ea695dcf32
81 files changed
+17246
-127
No files matched your search
@@ -2,7 +2,9 @@
|
||||
// implementare-aere.mjs: the published verifiers behind the one verdict form (verdict.mjs). This file holds NO verification rule of
|
||||
// its own: an AIP-23 envelope is judged by the reference verifier (verify-proof.mjs, run as the program it is), a payment by the
|
||||
// risk module, a receipt by the receipt verifier, a market timeline by the market judge, a dataset record, answer, consistency proof
|
||||
// or sample by the dataset module, a presentation of a credential by the identity verifier, a device bundle by the device verifier. What it adds is the translation: the rule ids those verifiers name -> the public rule ids and
|
||||
// or sample by the dataset module, a presentation of a credential by the identity verifier, a device bundle by the device verifier, an
|
||||
// SD-JWT or SD-JWT VC presentation by the SD-JWT verifiers, a Travel Rule binding, message or receipt by the Travel Rule verifier, a
|
||||
// compliance presentation by the compliance verifier. What it adds is the translation: the rule ids those verifiers name -> the public rule ids and
|
||||
// the level of each (reguli.mjs), and the composition (a receipt or a timeline that carries an AIP-23 envelope gets that envelope
|
||||
// judged too, so one verdict covers the artifact).
|
||||
//
|
||||
@@ -14,7 +16,7 @@
|
||||
// verdict says so (PARTIAL: claim-not-checked). With --online the envelope goes to the reference verifier with the chain's endpoint.
|
||||
// Exit: 0 VALID, 1 INVALID, 2 PARTIAL, 3 the artifact could not be judged at all (not a verdict).
|
||||
import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { spawn } from 'node:child_process';
|
||||
import { VERIFICATOARE, FINALITY_SITES, VERIFY_PROOF, NEJUDECATE_IDENTITY, NEJUDECATE_DEVICE, incarca } from './reguli.mjs';
|
||||
import { VERIFICATOARE, FINALITY_SITES, VERIFY_PROOF, NEJUDECATE_IDENTITY, NEJUDECATE_DEVICE, NEJUDECATE_COMPLIANCE, incarca } from './reguli.mjs';
|
||||
import { acumulator, pica, trece, nemasurat, verdictUnic } from './verdict.mjs';
|
||||
|
||||
const RPC = { 2800: process.env.AERE_CONFORMANCE_RPC_2800 || 'https://rpc.aere.network', 28001: process.env.AERE_CONFORMANCE_RPC_28001 || 'https://testnet-rpc.aere.network' };
|
||||
@@ -192,6 +194,54 @@ async function judeca(artifact, input, online) {
|
||||
if (vc && r.status && r.status.present && !r.status.judged) nemasurat(acc, 'integrity', 'claim-not-checked', `the credential names a status (${r.status.mechanism}${r.status.uri ? ' at ' + r.status.uri : ''}) and no list was judged: the verifier waived it`);
|
||||
}
|
||||
for (const l of ['anchoring', 'finality']) nemasurat(acc, l, 'not-judged', 'an SD-JWT is anchored by notarizing an AIP-23 envelope of it, judged as the artifact `envelope`');
|
||||
} else if (artifact === 'travel-rule-binding' || artifact === 'travel-rule-message' || artifact === 'travel-rule-receipt') {
|
||||
// the Travel Rule between VASPs (2026-10-18), each artifact judged by the party that receives it, with what THAT party brings: the
|
||||
// beneficiary's KEM key binding and VASP presentation by the originator (its id, its nonce, its clock, the registries it trusts, the
|
||||
// status lists it holds); the sealed message by the beneficiary (its id, its own KEM key pair in the module's key-file form, which is
|
||||
// what decrypts, its clock, its registries and lists, its replay store: the ids already received); the receipt by the originator
|
||||
// (the message it sent, the beneficiary it accepted). The verifier makes every check of a header and names every rule that refused;
|
||||
// at any refusal a message is not opened, so its encapsulation and ciphertext are then not reached
|
||||
const M = await incarca('travelrule'); const R = VERIFICATOARE['travel-rule'].reguli; let r;
|
||||
if (artifact === 'travel-rule-receipt') r = M.verifyReceipt(input.receipt, { message: input.message, beneficiaryId: input.beneficiaryId });
|
||||
else {
|
||||
if (typeof input.now !== 'string') throw new Error('a Travel Rule artifact is judged on the verifier\'s clock: input.now (an RFC 3339 time) is required');
|
||||
if (!Array.isArray(input.registries)) throw new Error('a Travel Rule artifact is judged against the VASP registries the verifier trusts: input.registries (ids or public keys) is required');
|
||||
const o = { registries: input.registries, now: input.now, statusLists: input.statusLists || [] }; if (input.maxAgeS !== undefined) o.maxAgeS = input.maxAgeS;
|
||||
if (artifact === 'travel-rule-binding') r = M.acceptBeneficiary({ binding: input.binding, presentation: input.presentation, originatorId: input.originatorId, nonce: input.nonce, ...o });
|
||||
else { const seen = input.seen === undefined ? null : Array.isArray(input.seen) ? new Set(input.seen) : input.seen; // a store that is not a list of ids is handed as it is: the verifier says what it is not
|
||||
r = M.openMessage(input.message, { me: input.me, kem: M.importKemKeys(input.kem), seen, ...o }); }
|
||||
}
|
||||
if (r.ok !== (r.rules.length === 0)) throw new Error('the Travel Rule verifier refused without naming a rule');
|
||||
for (const s of r.rules) { if (!R[s]) throw new Error('the Travel Rule verifier named a rule this suite does not map: ' + s); pica(acc, R[s][1], R[s][0], r.rows.filter((x) => !x.pass && x.rule === s).map((x) => x.detail).join('; ')); }
|
||||
const facute = (nivel) => r.rows.some((x) => x.pass && R[x.rule][1] === nivel);
|
||||
if (!r.rules.some((s) => R[s][1] === 'integrity')) {
|
||||
if (artifact === 'travel-rule-message' && !r.ok) nemasurat(acc, 'integrity', 'not-reached', 'the verifier does not open a message whose header it refused: the encapsulation and the ciphertext were not judged');
|
||||
else trece(acc, 'integrity', artifact === 'travel-rule-message' ? 'the message opened: the encapsulation (X25519 and ML-KEM-768, both) and the AES-256-GCM ciphertext hold under its header; it is for this VASP, fresh, not received before, and its originator\'s VASP status was judged'
|
||||
: artifact === 'travel-rule-binding' ? 'the binding is valid on the verifier\'s clock and the beneficiary\'s VASP credential says vasp: true, with its status judged' : 'the receipt names the message sent (id and hash)');
|
||||
}
|
||||
if (!r.rules.some((s) => R[s][1] === 'authenticity')) {
|
||||
// no authenticity row at all: the verifier stopped before a signature was looked at (under the suite's planting control the stopping
|
||||
// rule itself may be planted out, so no rule is named: the reason must not depend on one being there)
|
||||
if (!facute('authenticity')) { const oprit = r.rules.find((s) => M.OPRIRI.includes(s)) || r.rules[0]; nemasurat(acc, 'authenticity', 'not-reached', 'the verifier stopped' + (oprit ? ' at ' + R[oprit][0] : '') + ' before a signature was looked at'); }
|
||||
else trece(acc, 'authenticity', artifact === 'travel-rule-receipt' ? 'the receipt is signed by the accepted beneficiary (Ed25519 and ML-DSA-65, both), whose id is the id of its keys' : 'the ' + (artifact === 'travel-rule-binding' ? 'binding' : 'message') + ' is signed by the VASP it names (Ed25519 and ML-DSA-65, both), whose id is the id of its keys, and that VASP\'s credential presentation is valid for this verifier (judged by the identity verifier)'); }
|
||||
for (const l of ['anchoring', 'finality']) nemasurat(acc, l, 'not-judged', 'a Travel Rule exchange is anchored by notarizing its record (an AIP-23 compliance envelope without personal data), judged as the artifact `envelope`');
|
||||
} else if (artifact === 'compliance-presentation') {
|
||||
// compliance without surveillance (2026-10-18): a presentation judged against the verifier's policy with the verifier's audience, nonce
|
||||
// and clock (all required: without audience and nonce the module refuses to judge), the status lists and revocations it holds. The
|
||||
// policy is the verifier's own configuration: one that cannot be defined makes the module throw, by design, and is not a verdict
|
||||
const M = await incarca('compliance'); const R = VERIFICATOARE.compliance.reguli;
|
||||
if (typeof input.now !== 'string') throw new Error('a compliance judgement is made on the verifier\'s clock: input.now (an RFC 3339 time) is required');
|
||||
if (typeof input.audience !== 'string' || typeof input.nonce !== 'string') throw new Error('a compliance judgement needs the verifier\'s audience and nonce (input.audience, input.nonce)');
|
||||
const o = { audience: input.audience, nonce: input.nonce, now: input.now }; for (const k of ['statusLists', 'revocations']) if (input[k] !== undefined) o[k] = input[k];
|
||||
const r = M.checkCompliance(input.presentation, input.policy, o);
|
||||
if (r.compliant !== (r.rules.length === 0)) throw new Error('the compliance verifier refused without naming a rule');
|
||||
for (const s of r.rules) { if (!R[s]) throw new Error('the compliance verifier named a rule this suite does not map: ' + s); pica(acc, R[s][1], R[s][0], r.rows.filter((x) => !x.pass && x.rule === s).map((x) => x.detail).join('; ')); }
|
||||
if (!r.rules.some((s) => R[s][1] === 'integrity')) trece(acc, 'integrity', `every rule of policy ${r.policyId} (${r.policyHash.slice(0, 18)}..) holds on the claims the presentation establishes` + (r.rows.some((x) => x.rule === 'status' && x.pass) && input.policy && input.policy.requireStatus !== false ? '; the credential status was judged' : ''));
|
||||
if (!r.rules.includes('presentation')) trece(acc, 'authenticity', 'the presentation is valid for this verifier: judged by the identity verifier with the policy\'s trusted issuers, this audience and nonce (the credential and the presentation signed Ed25519 and ML-DSA-65, both)');
|
||||
// what the identity verifier inside left unjudged: a status the policy waived and nobody read is a claim not checked (PARTIAL)
|
||||
const NEJ = NEJUDECATE_COMPLIANCE;
|
||||
for (const c of r.unjudged) { if (!(c in NEJ)) throw new Error('the compliance verifier left unjudged for a cause this suite does not map: ' + c); if (NEJ[c]) nemasurat(acc, NEJ[c][0], NEJ[c][1], 'the credential names a status list and the verifier read none; the policy waived the status (requireStatus false)'); }
|
||||
for (const l of ['anchoring', 'finality']) nemasurat(acc, l, 'not-judged', 'a compliance judgement is anchored by notarizing its record (an AIP-23 compliance envelope without personal data), judged as the artifact `envelope`');
|
||||
} else if (artifact.startsWith('dataset-')) {
|
||||
const M = await incarca('baza'); let r;
|
||||
if (artifact === 'dataset-record') r = M.verificaInregistrare(input.record, input.commitment);
|
||||
|
||||
Reference in new issue
Block a user