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
@@ -18,7 +18,7 @@
|
||||
// vectors need the AIP-23 reference verifier (AERE_VERIFY_PROOF=<verify-proof.mjs>, with `npm install` done beside it); --online
|
||||
// reads testnet 28001 (nothing is sent).
|
||||
import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { spawn, spawnSync } from 'node:child_process'; import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { deriva, hartaPublica, VERIFICATOARE, MODULE, VERIFY_PROOF, FINALITY_SITES, NEJUDECATE_IDENTITY, incarca, marcajul } from './reguli.mjs';
|
||||
import { deriva, hartaPublica, VERIFICATOARE, MODULE, VERIFY_PROOF, FINALITY_SITES, NEJUDECATE_IDENTITY, NEJUDECATE_COMPLIANCE, incarca, marcajul } from './reguli.mjs';
|
||||
import { incarcaVectorii, ruleazaSuita } from './conformance.mjs';
|
||||
import { aplica, plicuriKinds } from './genereaza-vectori.mjs';
|
||||
import { PLANTARI as PLANTARI_DEVICE } from '../device-identity/plantari-device.mjs';
|
||||
@@ -180,12 +180,15 @@ const ramase = () => [...Object.values(MODULE).map((m) => path.dirname(fileURLTo
|
||||
* to the module verifiers directly. Left out, and said: the policy of a payment (a policy that cannot be defined is refused by
|
||||
* definePolicy by throwing, by design: nothing is judged under it), the configuration of an identity verifier (the issuers it trusts,
|
||||
* and the two lists themselves: a configuration that cannot be read makes it throw, by design; the entries of the lists are damaged like
|
||||
* everything else), the public task of a market job (each replay costs seconds), and
|
||||
* everything else), the public task of a market job (each replay costs seconds), the configuration of the Travel Rule verifier (the
|
||||
* registries it trusts, its own KEM key file, which importKemKeys refuses to read when damaged, by design, and the status list argument
|
||||
* itself), the configuration of the compliance verifier (its policy, which definePolicy refuses by throwing, its audience and nonce, which it
|
||||
* requires, and the two list arguments themselves), and
|
||||
* the ai-trust bundle (its verifier runs the reference verifier, a program, several times per case).
|
||||
* @returns {{ cazuri: number, aruncate: string[], acceptate: string[] }} acceptate = the paths (without array positions) whose damage was accepted
|
||||
*/
|
||||
async function malformate() {
|
||||
const R = await incarca('risc'), C = await incarca('chitanta'), P = await incarca('piata'), B = await incarca('baza'), SC = await incarca('sidecar'), AR = await incarca('arbore'), L = await incarca('ledger'), ID = await incarca('identity'), DV = await incarca('device'), SJ = await incarca('sdjwt'), SV = await incarca('sdjwtvc'); const clona = (x) => JSON.parse(JSON.stringify(x));
|
||||
const R = await incarca('risc'), C = await incarca('chitanta'), P = await incarca('piata'), B = await incarca('baza'), SC = await incarca('sidecar'), AR = await incarca('arbore'), L = await incarca('ledger'), ID = await incarca('identity'), DV = await incarca('device'), SJ = await incarca('sdjwt'), SV = await incarca('sdjwtvc'), TRm = await incarca('travelrule'), CF = await incarca('compliance'); const clona = (x) => JSON.parse(JSON.stringify(x));
|
||||
// the SD-JWT verifiers (2026-10-18), called the way the adapter calls them; a VC whose status was waived and not judged is PARTIAL, not accepted
|
||||
const optSd = (i) => { const o = { now: i.now }; for (const k of ['issuerKey', 'issuerAlg', 'audience', 'nonce', 'expectedIssuer', 'requireKeyBinding', 'requireExp', 'maxAgeS', 'expectedTyp', 'expectedVct', 'statusListJwt', 'statusListKey', 'statusListAlg', 'requireStatus']) if (i[k] !== undefined) o[k] = i[k]; return o; };
|
||||
const J = { 'payment-risk': (i) => R.judeca(i.policy, i.inputs).decision === 'ALLOW', 'payment-receipt': (i) => C.verificaChitanta(i.receipt, { policy: i.policy, inputs: i.inputs, tx: i.tx, receipt: i.txReceipt }).verdict === 'VALID', 'market-timeline': (i) => P.judeca(i).verdict === 'VALID',
|
||||
@@ -200,7 +203,13 @@ async function malformate() {
|
||||
// a device bundle (2026-10-05) and everything handed with it; the verifier's own configuration (its clock, the manufacturers it trusts, the lists themselves) is left out below
|
||||
'device-bundle': (i) => { const o = { now: i.now }; for (const k of ['nonce', 'audience', 'trustedManufacturers', 'statusLists', 'firmwarePolicies', 'statusRecords', 'softwareAttestation', 'anchors', 'maxAgeS']) if (i[k] !== undefined) o[k] = i[k]; return DV.verifyDevice(i.bundle, o).verdict === 'VALID'; },
|
||||
'sdjwt-presentation': (i) => SJ.verifySdJwt(i.sdJwt, optSd(i)).valid,
|
||||
'sdjwt-vc-presentation': (i) => { const r = SV.verifySdJwtVc(i.sdJwt, optSd(i)); return r.valid && !(r.status && r.status.present && !r.status.judged); } };
|
||||
'sdjwt-vc-presentation': (i) => { const r = SV.verifySdJwtVc(i.sdJwt, optSd(i)); return r.valid && !(r.status && r.status.present && !r.status.judged); },
|
||||
// the Travel Rule (2026-10-18), called the way the adapter calls it; a replay store that is not a list of ids is handed as it is
|
||||
'travel-rule-binding': (i) => TRm.acceptBeneficiary({ binding: i.binding, presentation: i.presentation, registries: i.registries, originatorId: i.originatorId, nonce: i.nonce, now: i.now, statusLists: i.statusLists || [], ...(i.maxAgeS !== undefined ? { maxAgeS: i.maxAgeS } : {}) }).ok,
|
||||
'travel-rule-message': (i) => TRm.openMessage(i.message, { me: i.me, kem: TRm.importKemKeys(i.kem), registries: i.registries, now: i.now, statusLists: i.statusLists || [], seen: i.seen === undefined ? null : Array.isArray(i.seen) ? new Set(i.seen) : i.seen, ...(i.maxAgeS !== undefined ? { maxAgeS: i.maxAgeS } : {}) }).ok,
|
||||
'travel-rule-receipt': (i) => TRm.verifyReceipt(i.receipt, { message: i.message, beneficiaryId: i.beneficiaryId }).ok,
|
||||
// compliance (2026-10-18): accepted = what the suite would call VALID, not PARTIAL (a status the policy waived and nobody read)
|
||||
'compliance-presentation': (i) => { const o = { audience: i.audience, nonce: i.nonce, now: i.now }; for (const k of ['statusLists', 'revocations']) if (i[k] !== undefined) o[k] = i[k]; const r = CF.checkCompliance(i.presentation, i.policy, o); return r.compliant && !r.unjudged.some((c) => NEJUDECATE_COMPLIANCE[c]); } };
|
||||
const cai = (x, p = []) => (x !== null && typeof x === 'object' ? [p, ...Object.keys(x).flatMap((k) => cai(x[k], [...p, Array.isArray(x) ? Number(k) : k]))] : [p]).filter((q) => q.length);
|
||||
const VAL = [null, 'x', 7, [], {}]; let cazuri = 0; const aruncate = [], acceptate = [], sarite = [];
|
||||
// a vector whose input is larger than MARE characters is not damaged path by path: thousands of paths, each judged over the whole input
|
||||
@@ -213,6 +222,8 @@ async function malformate() {
|
||||
for (const p of cai(inp)) { if (p[0] === 'policy' && v.artifact.startsWith('payment-')) continue;
|
||||
if (v.artifact === 'identity-presentation' && (p[0] === 'trustedIssuers' || (p.length === 1 && (p[0] === 'statusLists' || p[0] === 'revocations')))) continue;
|
||||
if (v.artifact === 'device-bundle' && (['trustedManufacturers', 'now', 'maxAgeS'].includes(p[0]) || (p.length === 1 && ['statusLists', 'firmwarePolicies', 'statusRecords', 'anchors'].includes(p[0])))) continue;
|
||||
if (v.artifact.startsWith('travel-rule-') && (['registries', 'kem'].includes(p[0]) || (p.length === 1 && p[0] === 'statusLists'))) continue;
|
||||
if (v.artifact === 'compliance-presentation' && (p[0] === 'policy' || (p.length === 1 && ['audience', 'nonce', 'statusLists', 'revocations'].includes(p[0])))) continue;
|
||||
for (const op of ['remove', 0, 1, 2, 3, 4]) { const c = clona(inp); let o = c; for (const k of p.slice(0, -1)) o = o[k]; const k = p[p.length - 1];
|
||||
if (op === 'remove') { if (Array.isArray(o)) o.splice(k, 1); else delete o[k]; } else { if (JSON.stringify(o[k]) === JSON.stringify(VAL[op])) continue; o[k] = clona(VAL[op]); }
|
||||
cazuri++; try { if (J[v.artifact](c)) acceptate.push(v.artifact + ':' + p.filter((x) => typeof x !== 'number').join('.')); } catch (e) { aruncate.push(v.id + ' ' + p.join('.') + ' <- ' + (op === 'remove' ? 'removed' : JSON.stringify(VAL[op])) + ': ' + String(e.message).slice(0, 60)); } } }
|
||||
|
||||
Reference in new issue
Block a user