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:
Aere Network committed 2026-10-18 13:13:50 +03:00
1 parent e1bb4e25d8
commit ea695dcf32
81 files changed
+17246 -127

No files matched your search

+180 -1
View File
@@ -9,7 +9,9 @@
// vectors derived from it stay): keys made and discarded here sign a tree head (ML-DSA-65)
// and its classical impostor (Ed25519), a random envelope nobody notarized, a small dataset
// (random salts), the presentations of one identity credential with their forged siblings
// (six hybrid key pairs), and the transaction of the recorded receipt READ from testnet 28001 (two
// (six hybrid key pairs), the SD-JWT and SD-JWT VC tokens, one Travel Rule exchange (with the
// beneficiary's KEM key pair, test material declared at the scene) and one compliance exchange,
// and the transaction of the recorded receipt READ from testnet 28001 (two
// eth_ calls; nothing is sent). With --tot everything is made anew; with --refa <name>
// ONE source is made anew (its vectors change, the others stay byte for byte)
//
@@ -35,6 +37,7 @@ import * as ID from '../identity/identity.mjs';
import * as DV from '../device-identity/device.mjs';
import * as SJ from '../identity/sdjwt.mjs';
import * as SV from '../identity/sdjwt-vc.mjs';
import * as TR from '../identity/travel-rule.mjs';
import { hartaPublica, LEVELS } from './reguli.mjs';
const AICI = path.dirname(fileURLToPath(import.meta.url));
@@ -485,6 +488,85 @@ const PROASPETE_IN_PLUS = {
statusNotObject: jeton({ status: 'revoked' }),
vctIntegrityNumber: jeton({ 'vct#integrity': 7 }) } };
},
// the Travel Rule between two VASPs (2026-10-18): a registry, another registry, VASP A (pays), VASP B (receives), VASP C (another VASP)
// and a stranger (six hybrid key pairs that exist only in this call), and two hybrid KEM key pairs (B's and C's). B's KEM pair is written
// WHOLE, private half included, in the module's own key-file form: the beneficiary's private KEM keys are what opens a message, so a
// vector of the artifact travel-rule-message is judged with them. They were made here for these vectors and open nothing else. The
// exchange is made by the producers at a fixed time (bindKemKeys, acceptBeneficiary, sealMessage, openMessage, acknowledge; the VASP
// credentials and presentations by identity.mjs); the forged siblings only a key holder can make are signed again with the published
// formula (the purpose-separated hybrid signature over the canonical header and ciphertext), and each is checked here to be refused for
// exactly the rule it was made for (a forgery that trips another rule first would make a vector that says the wrong thing)
travelRule: async () => {
const T0 = Math.floor(Date.now() / 1000) * 1000 - 3600000, zi = 86400; const at = (s) => new Date(T0 + s * 1000).toISOString(), la = (s) => new Date(T0 + s * 1000);
const [reg, regStrain, A, B, C, strain] = Array.from({ length: 6 }, () => ID.generateKeys()); const kemB = TR.generateKemKeys(), kemC = TR.generateKemKeys();
const LID = 'https://registry.example/vasps/status/1', NONCE = 'n-' + crypto.randomBytes(8).toString('hex'), MID = 'urn:uuid:' + crypto.randomUUID();
const cred = (vasp, index, issuer = reg, claims = { vasp: true, name: 'Example VASP', lei: '5493001KJTIIGC8Y1R12' }) => ID.issueCredential({ issuer, holder: vasp.public, type: 'VaspCredential', claims, disclosable: [], validFrom: at(-zi), validUntil: at(365 * zi), status: { list: LID, index }, now: la(-zi) });
const lista = ID.createStatusList({ issuer: reg, id: LID, revoked: [7, 8], validFrom: at(-3600), validUntil: at(zi), now: la(-3600) });
const pres = (c, vasp, audience, nonce) => ID.present({ credential: c.credential, disclosures: c.disclosures, presenter: vasp, audience, nonce, now: la(0) });
const credA = cred(A, 1), credB = cred(B, 2), credC = cred(C, 3);
const binding = TR.bindKemKeys({ vasp: B, kem: kemB, validUntil: at(90 * zi), now: la(-600) }); const presB = pres(credB, B, A.id, NONCE);
const acc = TR.acceptBeneficiary({ binding, presentation: presB, registries: [reg.id], originatorId: A.id, nonce: NONCE, now: la(0), statusLists: [lista] });
if (!acc.ok) throw new Error('fresh travel rule: the beneficiary is not accepted: ' + acc.motive.join(' | '));
const IVMS = { originator: { originatorPersons: [{ naturalPerson: { name: { nameIdentifier: [{ primaryIdentifier: 'Example', secondaryIdentifier: 'Ada' }] } } }], accountNumber: ['0x' + 'aa'.repeat(20)] },
beneficiary: { beneficiaryPersons: [{ naturalPerson: { name: { nameIdentifier: [{ primaryIdentifier: 'Example', secondaryIdentifier: 'Dan' }] } } }], accountNumber: ['0x' + 'bb'.repeat(20)] } };
const TRANSFER = { chainId: 2800, asset: 'AERE', amount: '1500000000000000000000', beneficiaryAddress: '0x' + 'bb'.repeat(20) };
const presA = pres(credA, A, B.id, MID);
const M = TR.sealMessage({ from: A, beneficiary: acc.beneficiary, ivms101: IVMS, transfer: TRANSFER, presentation: presA, messageId: MID, now: la(0) });
const deschide = (m, o = {}) => TR.openMessage(clona(m), { me: B.id, kem: kemB, registries: [reg.id], now: la(30), statusLists: [lista], seen: new Set(), ...o });
const opened = deschide(M); if (!opened.ok) throw new Error('fresh travel rule: the message does not open: ' + opened.motive.join(' | '));
const receipt = TR.acknowledge({ opened, message: M, me: B, now: la(31) });
const antet = (m) => { const { ciphertext, signature, fromPresentation, ...h } = m; return h; };
const resemnat = (f, k = A) => { const q = clona(M); f(q); q.signature = ID.signText('travel-rule', ID.canonical({ ...antet(q), ciphertext: q.ciphertext }), k); return q; };
const bindingDe = (k, f) => { const st = clona(binding.statement); f(st); return { statement: st, signature: ID.signText('kem-binding', ID.canonical(st), k) }; };
const ct = Buffer.from(M.ciphertext, 'base64'); ct[5] ^= 1;
const forged = {
bindingExpired: TR.bindKemKeys({ vasp: B, kem: kemB, validUntil: at(-60), now: la(-600) }),
bindingStrangerKeys: bindingDe(strain, (st) => { st.vasp.keys = strain.public; }),
bindingKemNotKem: bindingDe(B, (st) => { st.kem = { ...st.kem, mlkem768: st.kem.x25519 }; }),
strangerAsOriginator: resemnat((q) => { q.from.keys = strain.public; }, strain),
forOtherVasp: resemnat((q) => { q.to.id = C.id; }),
createdEarlier: resemnat((q) => { q.createdAt = at(-400); }),
kemAlg: resemnat((q) => { q.kem.alg = 'x25519'; }),
kemCiphertextCut: resemnat((q) => { q.kem.mlkemCiphertext = Buffer.from(q.kem.mlkemCiphertext, 'base64').subarray(0, 1000).toString('base64'); }),
ciphertextByte: resemnat((q) => { q.ciphertext = ct.toString('base64'); }),
headerAmount: resemnat((q) => { q.transfer.amount = '1'; }),
receiptByOther: TR.acknowledge({ opened, message: M, me: C, now: la(31) }) };
// each forgery is refused for exactly the rule it was made for, measured here with the producers' verifier
const cere = (nume, r, reguli) => { if (r.ok || r.rules.join() !== reguli.join()) throw new Error(`fresh travel rule: ${nume} is refused for [${r.rules.join(', ')}], expected [${reguli.join(', ')}]`); };
const accepta = (b, p = presB) => TR.acceptBeneficiary({ binding: b, presentation: p, registries: [reg.id], originatorId: A.id, nonce: NONCE, now: la(0), statusLists: [lista] });
cere('bindingExpired', accepta(forged.bindingExpired), ['binding-window']); cere('bindingStrangerKeys', accepta(forged.bindingStrangerKeys), ['binding-id']); cere('bindingKemNotKem', accepta(forged.bindingKemNotKem), ['binding-form']);
for (const [n, r] of [['strangerAsOriginator', ['message-id']], ['forOtherVasp', ['message-recipient']], ['createdEarlier', ['message-freshness']], ['kemAlg', ['kem-alg']], ['kemCiphertextCut', ['kem-open']], ['ciphertextByte', ['ciphertext']], ['headerAmount', ['ciphertext']]]) cere(n, deschide(forged[n]), r);
cere('receiptByOther', TR.verifyReceipt(forged.receiptByOther, { message: M, beneficiaryId: B.id }), ['receipt-from']);
// the KEM key files carry their private half (it is what opens a message), declared test material at the scene: the secret gate
// (scripts/poarta-secrete.cjs) reads the AERE-SINTETIC marker on the line or the two lines above a private key in DER and reports
// it as seen, not blocking; without the marker a PKCS8 key in a public folder is BLOCANT, as it must be
const sintetic = (k) => ({ ...k, private: { 'AERE-SINTETIC': 'a hybrid KEM key pair (X25519 + ML-KEM-768) made at generation for these conformance vectors; test material that opens only the messages of these vectors', ...k.private } });
return { at: at(0), now: at(30), later: at(3700), nonce: NONCE, messageId: MID, registries: [reg.id], otherRegistries: [regStrain.id], ids: { originator: A.id, beneficiary: B.id, other: C.id, stranger: strain.id },
list: lista, kem: { beneficiary: sintetic(TR.exportKemKeys(kemB)), other: sintetic(TR.exportKemKeys(kemC)) }, binding, bindingPresentation: presB, message: M, receipt,
presentations: {
beneficiary: { otherAudience: pres(credB, B, C.id, NONCE), otherNonce: pres(credB, B, A.id, 'n-other'), otherVasp: pres(credC, C, A.id, NONCE), notVasp: pres(cred(B, 5, reg, { vasp: false, name: 'Not a VASP' }), B, A.id, NONCE), untrustedRegistry: pres(cred(B, 2, regStrain), B, A.id, NONCE), revoked: pres(cred(B, 8), B, A.id, NONCE) },
originator: { otherAudience: pres(credA, A, C.id, MID), otherNonce: pres(credA, A, B.id, 'n-other'), otherVasp: pres(credC, C, B.id, MID), notVasp: pres(cred(A, 4, reg, { vasp: false, name: 'Not a VASP' }), A, B.id, MID), untrustedRegistry: pres(cred(A, 1, regStrain), A, B.id, MID), revoked: pres(cred(A, 7), A, B.id, MID) } },
forged };
},
// compliance without surveillance (2026-10-18): an issuer, a holder and another issuer (three hybrid key pairs that exist only in this
// call); a KYC credential with six disclosable claims, the issuer's status list, a verifier's policy of four rules, and the presentations
// the holder makes at a fixed time for one verifier: enough claims, too few, a credential whose claims break every rule, a credential
// from another issuer, a revoked one
compliance: async () => {
const T0 = Math.floor(Date.now() / 1000) * 1000 - 3600000, zi = 86400; const at = (s) => new Date(T0 + s * 1000).toISOString(), la = (s) => new Date(T0 + s * 1000);
const [iss, hol, alt] = Array.from({ length: 3 }, () => ID.generateKeys());
const AUD = 'https://exchange.example', NONCE = 'n-' + crypto.randomBytes(8).toString('hex'), LID = 'https://issuer.example/kyc/status/1';
const CL = { name: 'Ada Example', birthdate: '1990-01-01', age_over_18: true, jurisdiction: 'RO', kyc_level: 2, kyc_provider: 'example-kyc' };
const emite = (o = {}) => ID.issueCredential({ issuer: iss, holder: hol.public, type: 'KycCredential', claims: CL, disclosable: Object.keys(CL), validFrom: at(-zi), validUntil: at(365 * zi), status: { list: LID, index: 3 }, now: la(-zi), ...o });
const E = emite(); const lista = ID.createStatusList({ issuer: iss, id: LID, revoked: [9], validFrom: at(-3600), validUntil: at(zi), now: la(-3600) });
const REVEAL = ['age_over_18', 'jurisdiction', 'kyc_level', 'kyc_provider'];
const prez = (c = E, reveal = REVEAL) => ID.present({ credential: c.credential, disclosures: c.disclosures, reveal, presenter: hol, audience: AUD, nonce: NONCE, now: la(0) });
const policy = { id: 'exchange-onboarding-v1', trustedIssuers: [iss.id], require: [{ claim: 'age_over_18', equals: true }, { claim: 'jurisdiction', notIn: ['KP', 'IR'] }, { claim: 'kyc_level', atLeast: 2 }, { claim: 'kyc_provider', in: ['example-kyc', 'other-kyc'] }] };
return { at: at(0), now: at(30), later: at(3700), audience: AUD, nonce: NONCE, issuerId: iss.id, otherIssuerId: alt.id, policy, policyNoStatus: { ...policy, requireStatus: false }, list: lista, direct: prez(),
presentations: { fewerClaims: prez(E, ['age_over_18', 'jurisdiction', 'kyc_provider']),
valuesOutsidePolicy: prez(emite({ claims: { ...CL, age_over_18: false, jurisdiction: 'KP', kyc_level: 1, kyc_provider: 'unknown-kyc' }, status: { list: LID, index: 4 } })),
otherIssuer: prez(emite({ issuer: alt })), revoked: prez(emite({ status: { list: LID, index: 9 } })) } };
},
};
// ---------- fixed inputs of the AIP-23 kinds (the inputs of the published AIP-23 kind vectors) ----------
@@ -1211,6 +1293,103 @@ function construieste() {
negIo('sdjwt-vc-presentation/sd-jwt-vc.status-list-expired', 'the list of @owf/token-status-list, expired', /^NEGATIV: lista LOR expirata/, 'sdjwtvc.status-list', '@owf/token-status-list wrote the list with exp before the verifier clock');
negIo('sdjwt-vc-presentation/sd-jwt-vc.vct-mismatch', 'the verifier expects another credential type than the @sd-jwt/sd-jwt-vc credential carries', /^NEGATIV: verificatorul asteapta alt vct/, 'sdjwtvc.vct-mismatch', 'the same credential and list, the verifier expecting urn:eudi:pid:2');
negIo('sdjwt-vc-presentation/sd-jwt-vc.status-unjudged', 'the @sd-jwt/sd-jwt-vc credential without its list, the status not waived', /^NEGATIV: fara lista, la noi implicit/, 'sdjwtvc.status-unjudged', 'the same credential, no list handed'); }
// (M) the Travel Rule between VASPs (2026-10-18): the beneficiary's KEM key binding judged by the originator, the sealed message judged by
// the beneficiary (with its own KEM key pair, which decrypts), the receipt judged by the originator. The header checks of a message are all
// made and named; at any refusal among them the message is not opened, so with only authenticity refused, integrity is not reached. A
// binding and a receipt have no second phase: their integrity is judged whenever the verifier could read them
{ const X = P.travelRule; const AP = { authenticity: 'PASSED' }, NI = { integrity: 'NOT_MEASURED' }, OPRIT = { authenticity: 'NOT_MEASURED' }; const F = X.forged, PR = X.presentations;
const reg = (pre) => Object.keys(HARTA).filter((r) => pre.some((p) => r.startsWith('travelrule.' + p)));
const TB = reg(['binding-', 'vasp-']), TM = reg(['message-', 'replay', 'kem-', 'ciphertext', 'vasp-']), TRc = reg(['receipt-']);
const schimba = (c) => (c[0] === 'A' ? 'B' : 'A') + c.slice(1);
const src = 'producers (travel-rule.mjs: bindKemKeys, acceptBeneficiary, sealMessage, openMessage, acknowledge; identity.mjs: issueCredential, createStatusList, present), six hybrid key pairs made and discarded at generation, two KEM key pairs made at generation (the beneficiary\'s kept whole in the vectors: it is what opens the message)';
const prod = (id, titlu, baza, camp, val, r, nota, levels = {}) => { const b = V.find((x) => x.id === baza); if (!b) throw new Error('no base ' + baza); const input = clona(b.input); input[camp] = val; invalid(id, titlu, baza, null, r, { levels, producer: { note: nota, input, changed: [[camp]] } }); };
// the binding, judged by the originator
const bb = 'travel-rule-binding/beneficiary.valid';
valid(bb, 'travel-rule-binding', 'the beneficiary\'s KEM keys (X25519 and ML-KEM-768) bound to its identity, signed, with a presentation of its VASP credential from the registry the originator trusts, made for the originator with its nonce; the originator brings its id, its nonce, its clock, the registry and the registry\'s current status list', src,
{ binding: X.binding, presentation: X.bindingPresentation, registries: X.registries, originatorId: X.ids.originator, nonce: X.nonce, now: X.now, statusLists: [X.list] }, { exercises: TB, levels: AP });
const b = (nume, titlu, op, r, o = {}) => invalid('travel-rule-binding/beneficiary.' + nume, titlu, bb, op, r, o);
b('binding-form', 'the binding is of another kind', { op: 'set', path: ['binding', 'statement', 'kind'], value: 'aere-travel-rule-message' }, ['travelrule.binding-form'], { levels: OPRIT });
b('binding-form-null', 'the binding is the JSON value null', { op: 'set', path: ['binding'], value: null }, ['travelrule.binding-form'], { levels: OPRIT });
b('binding-signature', 'the Ed25519 half of the binding signature has one character changed', { op: 'set', path: ['binding', 'signature', 'ed25519'], value: schimba(X.binding.signature.ed25519) }, ['travelrule.binding-signature']);
b('binding-signature-ml-dsa', 'the ML-DSA-65 half of the binding signature has one character changed', { op: 'set', path: ['binding', 'signature', 'mldsa65'], value: schimba(X.binding.signature.mldsa65) }, ['travelrule.binding-signature']);
b('vasp-presentation-audience', 'the beneficiary\'s VASP presentation was made for another originator', { op: 'set', path: ['presentation'], value: PR.beneficiary.otherAudience }, ['travelrule.vasp-presentation']);
b('vasp-presentation-nonce', 'the beneficiary\'s VASP presentation carries another nonce than the originator gave (a replay)', { op: 'set', path: ['presentation'], value: PR.beneficiary.otherNonce }, ['travelrule.vasp-presentation']);
b('vasp-presentation-registry', 'the originator trusts another registry than the one that issued the VASP credential', { op: 'set', path: ['registries'], value: X.otherRegistries }, ['travelrule.vasp-presentation']);
b('vasp-presentation-untrusted-registry', 'the VASP credential was issued by a registry the originator does not trust, whose status list the originator does not hold either: the presentation is refused and the status is not judged', { op: 'set', path: ['presentation'], value: PR.beneficiary.untrustedRegistry }, ['travelrule.vasp-presentation', 'travelrule.vasp-status']);
b('vasp-presentation-revoked', 'the registry revoked the beneficiary\'s VASP credential: the presentation is refused, and its status is not a clean one', { op: 'set', path: ['presentation'], value: PR.beneficiary.revoked }, ['travelrule.vasp-presentation', 'travelrule.vasp-status']);
b('vasp-status', 'the originator holds no status list of the registry: the VASP status is not judged, which is a refusal, not "not revoked"', { op: 'set', path: ['statusLists'], value: [] }, ['travelrule.vasp-status']);
b('vasp-identity', 'the KEM keys bound by one VASP, the VASP credential of another', { op: 'set', path: ['presentation'], value: PR.beneficiary.otherVasp }, ['travelrule.vasp-identity']);
b('vasp-claim', 'a credential from the registry that says vasp: false', { op: 'set', path: ['presentation'], value: PR.beneficiary.notVasp }, ['travelrule.vasp-claim']);
b('originator', 'the binding and the presentation shown to another originator (the presentation was made for the first)', { op: 'set', path: ['originatorId'], value: X.ids.other }, ['travelrule.vasp-presentation']);
// found by the malformed-input row of this suite on 2026-10-18: without the originator's id or nonce the identity verifier leaves the
// audience or the nonce of the VASP presentation unjudged, and the Travel Rule verifier accepted the beneficiary; it refuses since
b('vasp-presentation-no-originator', 'the originator gives no id of its own: the audience of the VASP presentation is not judged, and the verifier refuses rather than accepting on trust', { op: 'remove', path: ['originatorId'] }, ['travelrule.vasp-presentation']);
b('vasp-presentation-no-nonce', 'the originator gives no nonce: the nonce of the VASP presentation is not judged (a replay could not be seen), and the verifier refuses', { op: 'remove', path: ['nonce'] }, ['travelrule.vasp-presentation']);
prod('travel-rule-binding/beneficiary.binding-id', 'a stranger\'s keys under the beneficiary\'s id, the binding signed by the stranger', bb, 'binding', F.bindingStrangerKeys, ['travelrule.binding-id'], 'a stranger wrote the beneficiary\'s id beside its own keys and signed the binding with them (the beneficiary\'s own presentation is shown with it)');
prod('travel-rule-binding/beneficiary.binding-window', 'the binding expired a minute before the originator\'s clock', bb, 'binding', F.bindingExpired, ['travelrule.binding-window'], 'the beneficiary bound its KEM keys with validUntil in the past');
prod('travel-rule-binding/beneficiary.binding-form-kem', 'the beneficiary signed a binding whose ml-kem-768 key is an x25519 key: the id and the signature hold, the KEM keys cannot be read', bb, 'binding', F.bindingKemNotKem, ['travelrule.binding-form'], 'the beneficiary put its X25519 key in the ML-KEM-768 field and signed the binding');
// the message, judged by the beneficiary
const bm = 'travel-rule-message/sealed.valid';
valid(bm, 'travel-rule-message', 'the IVMS101 data sealed by the originator for the beneficiary (X25519 + ML-KEM-768, HKDF-SHA-256, AES-256-GCM; the transfer in the header, which is the additional authenticated data), signed, with the originator\'s VASP presentation for the beneficiary (nonce = the message id); the beneficiary brings its id, its KEM key pair, its clock, the registry, the status list and an empty replay store', src,
{ message: X.message, me: X.ids.beneficiary, kem: X.kem.beneficiary, registries: X.registries, now: X.now, statusLists: [X.list], seen: [] }, { exercises: TM, levels: AP });
const m = (nume, titlu, op, r, o = {}) => invalid('travel-rule-message/sealed.' + nume, titlu, bm, op, r, o);
m('message-form', 'the message is of another kind', { op: 'set', path: ['message', 'kind'], value: 'aere-travel-rule-receipt' }, ['travelrule.message-form'], { levels: OPRIT });
m('message-form-null', 'the message is the JSON value null', { op: 'set', path: ['message'], value: null }, ['travelrule.message-form'], { levels: OPRIT });
m('message-signature', 'the ML-DSA-65 half of the originator\'s signature has one character changed', { op: 'set', path: ['message', 'signature', 'mldsa65'], value: schimba(X.message.signature.mldsa65) }, ['travelrule.message-signature'], { levels: NI });
m('message-signature-ed25519', 'the Ed25519 half of the originator\'s signature has one character changed', { op: 'set', path: ['message', 'signature', 'ed25519'], value: schimba(X.message.signature.ed25519) }, ['travelrule.message-signature'], { levels: NI });
m('message-signature-ciphertext', 'one byte of the ciphertext changed: the originator\'s signature over the header and the ciphertext catches it before GCM would', { op: 'set', path: ['message', 'ciphertext'], value: F.ciphertextByte.ciphertext }, ['travelrule.message-signature'], { levels: NI });
m('message-recipient-me', 'the message opened by another VASP: it is not addressed to it, and the originator\'s presentation was not made for it', { op: 'set', path: ['me'], value: X.ids.other }, ['travelrule.message-recipient', 'travelrule.vasp-presentation']);
m('message-kem-keys', 'the beneficiary brings other KEM keys than the ones the message is sealed to', { op: 'set', path: ['kem'], value: X.kem.other }, ['travelrule.message-kem-keys']);
m('message-freshness-clock', 'the beneficiary\'s clock is an hour later: the message is old, and so is the originator\'s presentation', { op: 'set', path: ['now'], value: X.later }, ['travelrule.message-freshness', 'travelrule.vasp-presentation']);
m('replay-store', 'the beneficiary brings no replay store: nothing is opened', { op: 'remove', path: ['seen'] }, ['travelrule.replay-store']);
m('replay', 'the message id is already in the replay store (the same message received before)', { op: 'set', path: ['seen'], value: [X.messageId] }, ['travelrule.replay']);
m('vasp-presentation-audience', 'the originator\'s VASP presentation was made for another beneficiary', { op: 'set', path: ['message', 'fromPresentation'], value: PR.originator.otherAudience }, ['travelrule.vasp-presentation'], { levels: NI });
m('vasp-presentation-nonce', 'the originator\'s VASP presentation carries another nonce than the message id', { op: 'set', path: ['message', 'fromPresentation'], value: PR.originator.otherNonce }, ['travelrule.vasp-presentation'], { levels: NI });
m('vasp-presentation-registry', 'the beneficiary trusts another registry than the one that issued the originator\'s credential', { op: 'set', path: ['registries'], value: X.otherRegistries }, ['travelrule.vasp-presentation'], { levels: NI });
m('vasp-presentation-untrusted-registry', 'the originator\'s VASP credential was issued by a registry the beneficiary does not trust, whose status list the beneficiary does not hold either: the presentation is refused and the status is not judged', { op: 'set', path: ['message', 'fromPresentation'], value: PR.originator.untrustedRegistry }, ['travelrule.vasp-presentation', 'travelrule.vasp-status']);
m('vasp-presentation-revoked', 'the registry revoked the originator\'s VASP credential: the presentation is refused, and its status is not a clean one', { op: 'set', path: ['message', 'fromPresentation'], value: PR.originator.revoked }, ['travelrule.vasp-presentation', 'travelrule.vasp-status']);
m('vasp-status', 'the beneficiary holds no status list of the registry: the originator\'s VASP status is not judged, which is a refusal', { op: 'set', path: ['statusLists'], value: [] }, ['travelrule.vasp-status']);
m('vasp-identity', 'the message signed by one VASP, the VASP credential of another attached', { op: 'set', path: ['message', 'fromPresentation'], value: PR.originator.otherVasp }, ['travelrule.vasp-identity'], { levels: NI });
m('vasp-claim', 'the originator attached a credential from the registry that says vasp: false', { op: 'set', path: ['message', 'fromPresentation'], value: PR.originator.notVasp }, ['travelrule.vasp-claim']);
const pm = (nume, titlu, val, r, nota, levels) => prod('travel-rule-message/sealed.' + nume, titlu, bm, 'message', val, r, nota, levels);
pm('message-id', 'a stranger\'s keys under the originator\'s id, the message signed by the stranger', F.strangerAsOriginator, ['travelrule.message-id'], 'a stranger wrote the originator\'s id beside its own keys and signed the message with them (the originator\'s own presentation is attached)', NI);
pm('message-recipient', 'the header addresses the message to another VASP, signed again by the originator (the KEM keys and the presentation are still the beneficiary\'s)', F.forOtherVasp, ['travelrule.message-recipient'], 'the originator changed to.id to another VASP and signed the header again');
pm('message-freshness', 'the header says the message was made 400 seconds before the beneficiary\'s clock, signed again by the originator (the allowed age is 300)', F.createdEarlier, ['travelrule.message-freshness'], 'the originator wrote createdAt 400 s earlier and signed the header again');
pm('kem-alg', 'the encapsulation declares x25519 alone, signed again by the originator', F.kemAlg, ['travelrule.kem-alg'], 'the originator wrote kem.alg x25519 and signed the header again');
pm('kem-open', 'the ML-KEM-768 ciphertext cut to 1000 bytes, signed again by the originator: the decapsulation does not open', F.kemCiphertextCut, ['travelrule.kem-open'], 'the originator truncated the ML-KEM ciphertext and signed the header again');
pm('ciphertext', 'one byte of the ciphertext changed and the message signed again by the originator: GCM refuses', F.ciphertextByte, ['travelrule.ciphertext'], 'the originator flipped a bit of the ciphertext and signed the message again');
pm('ciphertext-header', 'the amount in the header changed and the message signed again by the originator: the header is the additional authenticated data of the cipher and is in the key derivation', F.headerAmount, ['travelrule.ciphertext'], 'the originator wrote another amount in the signed header; the ciphertext was made under the first');
// the receipt, judged by the originator
const br = 'travel-rule-receipt/acknowledged.valid';
valid(br, 'travel-rule-receipt', 'the beneficiary\'s signed receipt for the message (its id, the hash of its signed header and ciphertext, the hash of the clear text, accepted), judged by the originator with the message it sent and the beneficiary it accepted', src, { receipt: X.receipt, message: X.message, beneficiaryId: X.ids.beneficiary }, { exercises: TRc, levels: AP });
const rc = (nume, titlu, op, r, o = {}) => invalid('travel-rule-receipt/acknowledged.' + nume, titlu, br, op, r, o);
rc('receipt-form', 'the receipt is of another kind', { op: 'set', path: ['receipt', 'statement', 'kind'], value: 'aere-travel-rule-kem-binding' }, ['travelrule.receipt-form'], { levels: OPRIT });
rc('receipt-form-null', 'the receipt is the JSON value null', { op: 'set', path: ['receipt'], value: null }, ['travelrule.receipt-form'], { levels: OPRIT });
rc('receipt-from', 'a receipt for the same message signed by another VASP, not the beneficiary accepted', { op: 'set', path: ['receipt'], value: F.receiptByOther }, ['travelrule.receipt-from']);
rc('receipt-from-id', 'the originator accepted another beneficiary than the one that signed the receipt', { op: 'set', path: ['beneficiaryId'], value: X.ids.other }, ['travelrule.receipt-from']);
rc('receipt-signature', 'the ML-DSA-65 half of the receipt signature has one character changed', { op: 'set', path: ['receipt', 'signature', 'mldsa65'], value: schimba(X.receipt.signature.mldsa65) }, ['travelrule.receipt-signature']);
rc('receipt-signature-ed25519', 'the Ed25519 half of the receipt signature has one character changed', { op: 'set', path: ['receipt', 'signature', 'ed25519'], value: schimba(X.receipt.signature.ed25519) }, ['travelrule.receipt-signature']);
rc('receipt-message', 'the receipt is checked against a message with another id', { op: 'set', path: ['message', 'id'], value: 'urn:uuid:00000000-0000-4000-8000-000000000000' }, ['travelrule.receipt-message']);
rc('receipt-message-hash', 'the receipt is checked against the same message with another amount in its header: the hash it names is not this message\'s', { op: 'set', path: ['message', 'transfer', 'amount'], value: '1' }, ['travelrule.receipt-message']); }
// (N) compliance without surveillance (2026-10-18): a KYC credential shown to a verifier that brings its policy, its audience, its nonce, its
// clock and the issuer's status list. An invalid presentation establishes no claim: every rule of the policy is reported not met as well
{ const X = P.compliance; const CK = Object.keys(HARTA).filter((r) => r.startsWith('compliance.')); const A = 'compliance-presentation'; const AP = { authenticity: 'PASSED' }, NI = { integrity: 'NOT_MEASURED' }; const PR = X.presentations;
const src = 'producers (conformitate.mjs: checkCompliance, over identity.mjs: issueCredential, createStatusList, present), three hybrid key pairs made and discarded at generation';
const intrare = (prez, o = {}) => ({ presentation: prez, policy: X.policy, audience: X.audience, nonce: X.nonce, now: X.now, statusLists: [X.list], ...o });
const bc = 'compliance-presentation/kyc.valid'; const schimba = (c) => (c[0] === 'A' ? 'B' : 'A') + c.slice(1); const sg = X.direct.signature;
valid(bc, A, 'a KYC credential: four of six disclosable claims shown (age_over_18, jurisdiction, kyc_level, kyc_provider), judged against a policy of four rules (equals, notIn, atLeast, in) by a verifier that brings its audience, its nonce, its clock and the issuer\'s current status list', src, intrare(X.direct), { exercises: CK, levels: AP });
valid('compliance-presentation/kyc-status-waived.partial', A, 'the same presentation under a policy that waives the status (requireStatus false), with no status list handed: every rule holds, the status the credential names was not judged, so it is not VALID', src, intrare(X.direct, { policy: X.policyNoStatus, statusLists: [] }), { exercises: CK, verdict: 'PARTIAL', levels: { ...AP, ...NI } });
const c = (nume, titlu, op, r, o = {}) => invalid('compliance-presentation/kyc.' + nume, titlu, bc, op, r, o);
c('rule-claim-not-shown', 'the holder shows three claims and not kyc_level: the rule on it is not met', { op: 'set', path: ['presentation'], value: PR.fewerClaims }, ['compliance.rule']);
c('rule-values', 'a credential of the same issuer whose claims break every rule: age_over_18 false, jurisdiction KP, kyc_level 1, an unknown provider', { op: 'set', path: ['presentation'], value: PR.valuesOutsidePolicy }, ['compliance.rule']);
c('status', 'the verifier holds no status list of the issuer, and the policy requires the status judged', { op: 'set', path: ['statusLists'], value: [] }, ['compliance.status']);
c('presentation-issuer', 'the credential is from an issuer the policy does not trust, whose status list the verifier does not hold either: the presentation is refused, the status is not judged, and no claim is established', { op: 'set', path: ['presentation'], value: PR.otherIssuer }, ['compliance.presentation', 'compliance.rule', 'compliance.status']);
c('presentation-revoked', 'the issuer revoked the credential: the presentation is refused, its status is not a clean one, and it establishes no claim', { op: 'set', path: ['presentation'], value: PR.revoked }, ['compliance.presentation', 'compliance.status', 'compliance.rule']);
c('presentation-audience', 'the presentation was made for this verifier and is judged by another', { op: 'set', path: ['audience'], value: 'https://other.example' }, ['compliance.presentation', 'compliance.rule']);
c('presentation-nonce', 'the verifier gave another nonce (a replay)', { op: 'set', path: ['nonce'], value: 'n-other' }, ['compliance.presentation', 'compliance.rule']);
c('presentation-freshness', 'the verifier\'s clock is an hour after the presentation was made (the policy allows 300 s)', { op: 'set', path: ['now'], value: X.later }, ['compliance.presentation', 'compliance.rule']);
c('presentation-signature', 'the ML-DSA-65 half of the holder\'s signature has one character changed', { op: 'set', path: ['presentation', 'signature', 'mldsa65'], value: schimba(sg.mldsa65) }, ['compliance.presentation', 'compliance.rule']);
c('presentation-disclosure-removed', 'a disclosure taken out after the holder signed for the list', { op: 'remove', path: ['presentation', 'disclosures', 0] }, ['compliance.presentation', 'compliance.rule']); }
// (E) a dataset: a record, a range answer, a consistency proof, an availability sample
const DS = P.dataset; const REC = ['dataset.form', 'dataset.commitment', 'dataset.field', 'dataset.inclusion']; const src = 'producer (verifiable-data), random salts, generated ' + P.at;
valid('dataset-record/r5.valid', 'dataset-record', 'one record against the commitment of version 2, two fields disclosed', src, { record: DS.record, commitment: DS.newer }, { exercises: REC });