conformance: the identity presentation verifier enrolled (134 rules of 10 verifiers, 273 vectors); the reference verifier instruction names all five files beside verify-proof.mjs; module READMEs point to aere.network/tools
This commit is contained in:
1 parent
c9798a0013
commit
5fb38c5d0b
88 files changed
+20246
-179
No files matched your search
@@ -8,7 +8,8 @@
|
||||
// node genereaza-vectori.mjs --proaspat completes surse-proaspete.json with what is MISSING from it (what is there stays, so the
|
||||
// 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), and the transaction of the recorded receipt READ from testnet 28001 (two
|
||||
// (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
|
||||
// eth_ calls; nothing is sent). With --tot everything is made anew
|
||||
//
|
||||
// A vector is { artifact, input, expected: { verdict, failed, levels } }. An INVALID vector names its `base` (a vector that is not
|
||||
@@ -29,6 +30,7 @@ import * as RISC from '../payments/risc.mjs';
|
||||
import * as BAZA from '../verifiable-data/baza.mjs';
|
||||
import { newAgentIdentity, openLedger, agentIdFromKey, sessionId, canonical as canonicLedger } from '../agents/agent-ledger.mjs';
|
||||
import { construieste as lantAI } from '../ai-trust/lant-de-incredere.mjs';
|
||||
import * as ID from '../identity/identity.mjs';
|
||||
import { hartaPublica, LEVELS } from './reguli.mjs';
|
||||
|
||||
const AICI = path.dirname(fileURLToPath(import.meta.url));
|
||||
@@ -167,6 +169,89 @@ const PROASPETE_IN_PLUS = {
|
||||
return lantAI({ ledger: ledger.export(), policy: { policy, policyHash }, proofOfAi, createdAt: iso(t1) }); };
|
||||
return { allowed: lant(['model:example-model'], t1), refused: lant(['model:another-model'], t1), lateEntry: lant(['model:example-model'], t1 - 7200) };
|
||||
},
|
||||
// presentations of ONE credential (issuer, holder, a phone, a session key, a stranger and an impostor issuer: six hybrid key pairs
|
||||
// that exist only in this call), made by the identity producers (issueCredential, createStatusList, delegate, revokeDelegation,
|
||||
// present) at a fixed time, with the verifier's audience, nonce and clock; and the forged siblings that only a key holder can make:
|
||||
// a statement changed and signed again by the issuer, the holder or a delegate, with the published formulas (the purpose-separated
|
||||
// hybrid signature over the canonical statement; the sha256 of the canonical JSON as the hash)
|
||||
identity: 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, phone, sess, strain, imp] = Array.from({ length: 6 }, () => ID.generateKeys());
|
||||
const AUD = 'https://verifier.example', NONCE = 'n-' + crypto.randomBytes(8).toString('hex'), LID = 'https://issuer.example/status/1', hashOf = ID.credentialHash;
|
||||
const afirmatii = { name: 'Ada Example', age_over_18: true, member_since: '2020', employer: 'Example Ltd' }, DZ = ['name', 'age_over_18', 'member_since'];
|
||||
const schimba = (c) => (c[0] === 'A' ? 'B' : 'A') + c.slice(1);
|
||||
const emite = (o = {}) => ID.issueCredential({ issuer: iss, holder: hol.public, type: 'ExampleMembership', claims: afirmatii, disclosable: DZ, validFrom: at(-zi), validUntil: at(1000 * zi), status: { list: LID, index: 42 }, decoys: 2, now: la(0), ...o });
|
||||
const { credential, disclosures } = emite();
|
||||
const cuCred = (c, dz = disclosures, o = {}) => ID.present({ credential: c, disclosures: dz, reveal: ['age_over_18', 'member_since'], presenter: hol, audience: AUD, nonce: NONCE, now: la(60), ...o });
|
||||
const resemneaza = (p, k, f) => { const q = clona(p); f(q); q.signature = ID.signText('presentation', ID.canonical(q.binding), k); return q; };
|
||||
const reemite = (c, k, f) => { const st = clona(c.statement); f(st); return { statement: st, signature: ID.signText('credential', ID.canonical(st), k) }; };
|
||||
const dzv = (nume, val, octeti = 16) => Buffer.from(JSON.stringify([crypto.randomBytes(octeti).toString('base64url'), nume, val]), 'utf8').toString('base64url');
|
||||
const direct = cuCred(credential); const cuDezvaluiri = (l) => resemneaza(direct, hol, (q) => { q.disclosures = l; q.binding.disclosuresHash = hashOf(l); });
|
||||
const lista = (o = {}) => ID.createStatusList({ issuer: iss, id: LID, validFrom: at(-3600), validUntil: at(zi), now: la(0), ...o });
|
||||
const curata = lista(); const fals = 'aere-id:' + '11'.repeat(20); const altId = 'urn:uuid:' + ['00000000', '0000', '4000', '8000', '000000000000'].join('-'); // the id of a credential that is not this one
|
||||
// the same claims from an issuer that names no status list (the impostor, and the issuer with a classical key)
|
||||
const faraStare = ID.issueCredential({ issuer: imp, holder: hol.public, type: 'ExampleMembership', claims: afirmatii, disclosable: DZ, validFrom: at(-zi), validUntil: at(1000 * zi), now: la(0) });
|
||||
const clasic = (() => { const a = crypto.generateKeyPairSync('ed25519'), b = crypto.generateKeyPairSync('ed25519'); const spki = (k) => k.publicKey.export({ type: 'spki', format: 'der' }).toString('base64');
|
||||
const pub = { alg: ID.ALG, ed25519: spki(a), mldsa65: spki(b) }; const id = 'aere-id:' + crypto.createHash('sha256').update(Buffer.from(ID.canonical(pub), 'utf8')).digest('hex').slice(0, 40);
|
||||
const st = clona(faraStare.credential.statement); st.issuer = { id, keys: pub }; const m = Buffer.from('aere-identity/v1/credential\n' + ID.canonical(st), 'utf8');
|
||||
const c = { statement: st, signature: { alg: ID.ALG, ed25519: crypto.sign(null, m, a.privateKey).toString('base64'), mldsa65: crypto.sign(null, m, b.privateKey).toString('base64') } };
|
||||
return { issuerId: id, presentation: cuCred(c, faraStare.disclosures) }; })();
|
||||
const listaNecitibila = (() => { const st = clona(curata.statement); st.encodedList = Buffer.from('not gzip', 'utf8').toString('base64url'); return { statement: st, signature: ID.signText('status-list', ID.canonical(st), iss) }; })();
|
||||
const inClar = (() => { const enc = dzv('employer', 'Another Ltd'); const c = reemite(credential, iss, (st) => { st.sd = [...st.sd, ID.digestOf(enc)].sort(); });
|
||||
return resemneaza(cuCred(c), hol, (q) => { q.disclosures = [...q.disclosures, enc]; q.binding.disclosuresHash = hashOf(q.disclosures); }); })();
|
||||
const expirat = emite({ validFrom: at(-3 * zi), validUntil: at(-zi) }), inca = emite({ validFrom: at(zi), validUntil: at(2 * zi) });
|
||||
// delegation: the holder to a phone, the phone to a session key of ten minutes
|
||||
// the scope of a link: which credential ids, which disclosable claims, which audiences (built by position: the field is named in one place)
|
||||
const scopul = (iduri, afirm, publicuri) => Object.fromEntries([['credentials', iduri], ['claims', afirm], ['audiences', publicuri]]);
|
||||
const scop = scopul([credential.statement.id], ['age_over_18', 'member_since'], [AUD]), ingust = { ...scop, claims: ['age_over_18'] };
|
||||
const d1 = ID.delegate({ from: hol, to: phone.public, scope: scop, notBefore: at(0), notAfter: at(zi), maxDepth: 1, now: la(0) });
|
||||
const d2 = ID.delegate({ from: phone, to: sess.public, scope: ingust, notBefore: at(30), notAfter: at(600), maxDepth: 0, parent: d1, now: la(30) });
|
||||
const prezD = (lant, cheie, o = {}) => ID.present({ credential, disclosures, reveal: ['age_over_18'], presenter: cheie, delegations: lant, audience: AUD, nonce: NONCE, now: la(60), ...o });
|
||||
const una = (o = {}) => ID.delegate({ from: hol, to: phone.public, scope: scop, notBefore: at(0), notAfter: at(zi), maxDepth: 0, now: la(0), ...o });
|
||||
const veriga = (k, st0, f) => { const st = clona(st0); f(st); return { statement: st, signature: ID.signText('delegation', ID.canonical(st), k) }; };
|
||||
const delegat = prezD([d1, d2], sess); const d1z = una();
|
||||
const lung = (() => { const chei = [phone, sess]; let de = hol; const l = []; for (let i = 0; i < 9; i++) { const catre = chei[i % 2]; l.push(ID.delegate({ from: de, to: catre.public, scope: scop, notBefore: at(0), notAfter: at(zi), maxDepth: 0, now: la(0) })); de = catre; } return prezD(l, de); })();
|
||||
const semnaturaVerigii = (() => { const d = clona(una()); d.signature.mldsa65 = schimba(d.signature.mldsa65); return prezD([d], phone); })();
|
||||
return { at: at(0), audience: AUD, nonce: NONCE, now: at(65), later: at(3665), muchLater: at(4000 * zi), trusted: [iss.id], strangerId: strain.id,
|
||||
lists: { clean: curata, revoked: lista({ revoked: [42] }), unreadable: listaNecitibila, short: lista({ size: 8 }), otherIssuer: ID.createStatusList({ issuer: imp, id: LID, revoked: [42], validFrom: at(-3600), validUntil: at(zi), now: la(0) }), expired: lista({ revoked: [42], validFrom: at(-2 * zi), validUntil: at(-zi) }) },
|
||||
undisclosed: disclosures.find((e) => ID.decodeDisclosure(e).name === 'name'),
|
||||
direct, delegated: delegat,
|
||||
revocations: { byHolder: ID.revokeDelegation({ by: hol, delegation: d1, at: at(10), now: la(10) }), byGiver: ID.revokeDelegation({ by: phone, delegation: d2, at: at(40), now: la(40) }),
|
||||
byStranger: ID.revokeDelegation({ by: strain, delegation: d1, at: at(10), now: la(10) }), inTheFuture: ID.revokeDelegation({ by: hol, delegation: d1, at: at(zi), now: la(10) }) },
|
||||
forged: {
|
||||
issuerImpostor: cuCred(reemite(faraStare.credential, imp, (st) => { st.issuer.id = iss.id; }), faraStare.disclosures),
|
||||
issuerClassicalKey: clasic,
|
||||
holderId: resemneaza(cuCred(reemite(credential, iss, (st) => { st.holder.id = fals; })), hol, (q) => { q.binding.presenter.id = fals; }),
|
||||
credentialSignatureMlDsa: cuCred((() => { const c = clona(credential); c.signature.mldsa65 = schimba(c.signature.mldsa65); return c; })()),
|
||||
credentialSignatureEd25519: cuCred((() => { const c = clona(credential); c.signature.ed25519 = schimba(c.signature.ed25519); return c; })()),
|
||||
claimEdited: cuCred((() => { const c = clona(credential); c.statement.claims.employer = 'Another Ltd'; return c; })()),
|
||||
expired: cuCred(expirat.credential, expirat.disclosures), notYetValid: cuCred(inca.credential, inca.disclosures),
|
||||
sdTwice: cuCred(reemite(credential, iss, (st) => { st.sd = [...st.sd, st.sd[0]].sort(); })),
|
||||
disclosureShortSalt: cuDezvaluiri([...direct.disclosures, dzv('nickname', 'x', 8)]),
|
||||
disclosureFabricated: cuDezvaluiri([...direct.disclosures, dzv('age_over_21', true)]),
|
||||
disclosureTwice: cuDezvaluiri([direct.disclosures[0], direct.disclosures[0], direct.disclosures[1]]),
|
||||
disclosureOverPlain: inClar,
|
||||
claimName: cuCred(reemite(credential, iss, (st) => { st.claims['bad name'] = 'x'; })),
|
||||
otherCredential: resemneaza(direct, hol, (q) => { q.binding.credentialHash = hashOf(emite().credential); }),
|
||||
stranger: cuCred(credential, disclosures, { presenter: strain }),
|
||||
createdAt: resemneaza(direct, hol, (q) => { q.binding.createdAt = 'yesterday'; }),
|
||||
chainUnsigned: resemneaza(delegat, sess, (q) => { q.binding.delegations = []; }),
|
||||
chainNine: lung,
|
||||
linkForm: prezD([veriga(hol, d1z.statement, (st) => { st.kind = 'aere-delegation-v0'; })], phone),
|
||||
linkIds: resemneaza(prezD([veriga(hol, d1z.statement, (st) => { st.to.id = fals; })], phone), phone, (q) => { q.binding.presenter.id = fals; }),
|
||||
linkFromStranger: prezD([ID.delegate({ from: strain, to: phone.public, scope: scop, notBefore: at(0), notAfter: at(zi), now: la(0) })], phone),
|
||||
linkNoParent: prezD([d1, ID.delegate({ from: phone, to: sess.public, scope: ingust, notBefore: at(30), notAfter: at(600), maxDepth: 0, now: la(30) })], sess),
|
||||
linkSignature: semnaturaVerigii,
|
||||
linkScopeUnknownField: prezD([veriga(hol, d1z.statement, (st) => { st.scope.extra = ['x']; })], phone),
|
||||
linkScopeUnsorted: prezD([veriga(hol, d1z.statement, (st) => { st.scope.claims = ['member_since', 'age_over_18']; })], phone),
|
||||
linkExpired: prezD([una({ notBefore: at(-7200), notAfter: at(-3600) })], phone),
|
||||
linkDepthZero: prezD([d1z, veriga(phone, d2.statement, (st) => { st.parent = ID.delegationHash(d1z); })], sess),
|
||||
linkDepthNegative: prezD([d1z, veriga(phone, d2.statement, (st) => { st.parent = ID.delegationHash(d1z); st.maxDepth = -1; })], sess),
|
||||
linkWidens: prezD([d1, veriga(phone, d2.statement, (st) => { st.scope.claims = '*'; })], sess),
|
||||
linkOtherCredential: prezD([una({ scope: scopul([altId], scop.claims, scop.audiences) })], phone),
|
||||
linkOtherClaims: prezD([una({ scope: ingust })], phone, { reveal: ['age_over_18', 'name'] }),
|
||||
linkOtherAudience: prezD([una({ scope: { ...scop, audiences: ['https://other.example'] } })], phone) } };
|
||||
},
|
||||
};
|
||||
|
||||
// ---------- fixed inputs of the AIP-23 kinds (the inputs of the published AIP-23 kind vectors) ----------
|
||||
@@ -372,6 +457,11 @@ function construieste() {
|
||||
sg('head-key', 'the public key of the head signature is not a key', { op: 'set', path: ['head', 'signature', 'publicKey'], value: 'AAAA' }, 'auditlog.head-key');
|
||||
sg('head-signature', 'the head signature has one character changed', { op: 'set', path: ['head', 'signature', 'signature'], value: (b64[0] === 'A' ? 'B' : 'A') + b64.slice(1) }, 'auditlog.head-signature');
|
||||
sg('head-signer', 'the head is signed, by another key than the signer expected', { op: 'set', path: ['signer'], value: AH.otherSignerPem }, 'auditlog.head-signer');
|
||||
// the same signed head with NO signer expected (2026-10-05): the scheme rule is then all that stands between a classical key and acceptance
|
||||
const bn = 'audit-log/signed-head-any-signer.valid';
|
||||
valid(bn, 'audit-log', 'the same log against its signed head, with no signer expected: the head must still be signed with a key of the scheme it declares', src + '; operator key made and discarded at generation', { log: patru, head: AH.signed }, { exercises: LK, levels: { authenticity: 'PASSED' } });
|
||||
invalid('audit-log/signed-head-any-signer.head-scheme-classical-key', 'the head is signed with an Ed25519 key that declares ml-dsa-65, and no signer is expected: without the scheme rule this head is accepted', bn, null, ['auditlog.head-scheme'],
|
||||
{ levels: NA, producer: { note: 'the signer used a classical key (made and discarded at generation) and declared the scheme ml-dsa-65', input: { log: patru, head: AH.classical }, changed: [['head', 'signature', 'publicKey'], ['head', 'signature', 'signature']] } });
|
||||
// the tree: inclusion of entry 2 under the head of six, consistency from the head of four to the head of six
|
||||
const t6 = capDeArbore(log, { host: 'conformance', createdAt: '2026-10-03T00:00:00Z' }), t4 = capDeArbore(patru, { host: 'conformance', createdAt: '2026-10-03T00:00:00Z' }); const inc = dovadaIncludere(log, 2);
|
||||
const bi = 'audit-inclusion/entry-2.valid'; const INC = TK.filter((r) => !r.includes('consistency'));
|
||||
@@ -416,6 +506,91 @@ function construieste() {
|
||||
al4('approvals', 'the fourth entry carries an empty approvals list', G.approvalsEmpty, 'agents.approvals', 'the agent signed an entry with an approvals field that is an empty list');
|
||||
al4('decision', 'the fourth entry writes a refusal for a payment the policy allows', G.falseDecision, 'agents.decision', 'the agent signed an entry whose decision is not the one the policy gives');
|
||||
al4('revocation', 'the fourth entry is a revocation entry that carries no revocation', G.revocationWithout, 'agents.revocation', 'the agent signed a revocation entry without the owner\'s revocation'); }
|
||||
// (I) a presentation of a post-quantum credential (identity): judged with what the verifier brings (audience, nonce, clock, trusted
|
||||
// issuers, status lists, revocations). One credential, shown by its holder and by a session key at the end of a delegation chain
|
||||
{ const IK = Object.keys(HARTA).filter((r) => r.startsWith('identity.')); const X = P.identity; const A = 'identity-presentation'; const F = X.forged;
|
||||
const intrare = (prez, o = {}) => ({ presentation: prez, audience: X.audience, nonce: X.nonce, now: X.now, trustedIssuers: X.trusted, statusLists: [X.lists.clean], ...o });
|
||||
const AP = { authenticity: 'PASSED' }, OPRIT = { authenticity: 'NOT_MEASURED' }, NI = { integrity: 'NOT_MEASURED' }; const schimba = (c) => (c[0] === 'A' ? 'B' : 'A') + c.slice(1);
|
||||
const src = 'producers (identity: issueCredential, createStatusList, delegate, present), six hybrid key pairs made and discarded at generation';
|
||||
const bd = 'identity-presentation/direct.valid', bl = 'identity-presentation/delegated.valid';
|
||||
valid(bd, A, 'a holder shows two of three disclosable claims to a verifier that brings its audience, its nonce, its clock, the issuer it trusts and the issuer\'s current status list', src, intrare(X.direct), { exercises: IK, levels: AP });
|
||||
valid(bl, A, 'the same credential shown by a session key: the holder delegated to a phone, the phone to the session key for ten minutes and one claim', src, intrare(X.delegated), { exercises: IK, levels: AP });
|
||||
// what the verifier did not bring: nothing fails, and the verdict is not VALID
|
||||
const fara = (nume, titlu, baza, op, levels) => valid('identity-presentation/' + nume, A, titlu, src, aplica(V.find((x) => x.id === baza).input, op), { exercises: IK, verdict: 'PARTIAL', levels: { ...AP, ...levels }, base: baza, mutation: op });
|
||||
fara('direct.no-audience.partial', 'the verifier gives no audience: a presentation made for another verifier would be accepted, so this one is not VALID', bd, { op: 'remove', path: ['audience'] }, NI);
|
||||
fara('direct.no-nonce.partial', 'the verifier gives no nonce: an old presentation could be replayed', bd, { op: 'remove', path: ['nonce'] }, NI);
|
||||
fara('direct.no-trusted-issuers.partial', 'the verifier names no issuer it trusts: anyone can issue a credential with their own keys', bd, { op: 'remove', path: ['trustedIssuers'] }, { authenticity: 'NOT_MEASURED' });
|
||||
fara('direct.no-status-list.partial', 'the credential names a status list and the verifier was not handed it: a revocation cannot be seen', bd, { op: 'remove', path: ['statusLists'] }, NI);
|
||||
fara('direct.status-list-other-issuer.partial', 'the list handed has the right id and another issuer\'s signature (and revokes): ignored, the status is not read', bd, { op: 'set', path: ['statusLists', 0], value: X.lists.otherIssuer }, NI);
|
||||
fara('direct.status-list-expired.partial', 'the issuer\'s list handed is no longer valid on the verifier\'s clock: the status is not read', bd, { op: 'set', path: ['statusLists', 0], value: X.lists.expired }, NI);
|
||||
// revocations that do not take effect leave the delegated presentation VALID
|
||||
const ramane = (nume, titlu, rev) => { const op = { op: 'add', path: ['revocations'], value: [rev] }; valid('identity-presentation/' + nume, A, titlu, src, aplica(V.find((x) => x.id === bl).input, op), { exercises: IK, levels: AP, base: bl, mutation: op }); };
|
||||
ramane('delegated.revocation-by-stranger.valid', 'a revocation of the first link signed by a stranger is ignored', X.revocations.byStranger);
|
||||
ramane('delegated.revocation-in-the-future.valid', 'a revocation by the holder dated a day ahead has not taken effect on the verifier\'s clock', X.revocations.inTheFuture);
|
||||
// one operation on the direct presentation
|
||||
const d = (nume, titlu, op, r, o = {}) => invalid('identity-presentation/direct.' + nume, titlu, bd, op, r, o); const sg = X.direct.signature;
|
||||
d('form', 'the file is of another kind', { op: 'set', path: ['presentation', 'kind'], value: 'aere-credential' }, ['identity.form'], { levels: OPRIT });
|
||||
d('form-null', 'the presentation is the JSON value null', { op: 'set', path: ['presentation'], value: null }, ['identity.form'], { levels: OPRIT });
|
||||
d('form-credential', 'the credential inside is of another kind', { op: 'set', path: ['presentation', 'credential', 'statement', 'kind'], value: 'aere-status-list' }, ['identity.form'], { levels: OPRIT });
|
||||
d('form-binding', 'the binding is of another kind', { op: 'set', path: ['presentation', 'binding', 'kind'], value: 'aere-delegation' }, ['identity.form'], { levels: OPRIT });
|
||||
d('issuer-trusted', 'the verifier trusts another issuer', { op: 'set', path: ['trustedIssuers'], value: [X.strangerId] }, ['identity.issuer-trusted']);
|
||||
d('credential-revoked', 'the issuer\'s current status list has the bit of this credential set', { op: 'set', path: ['statusLists', 0], value: X.lists.revoked }, ['identity.credential-revoked']);
|
||||
d('credential-revoked-second-list', 'two current lists of the issuer, one of them revokes: a revocation is not lifted by another list', { op: 'add', path: ['statusLists', 1], value: X.lists.revoked }, ['identity.credential-revoked']);
|
||||
d('status-list', 'the issuer signed a status list that does not decompress', { op: 'set', path: ['statusLists', 0], value: X.lists.unreadable }, ['identity.status-list']);
|
||||
d('status-list-index', 'the issuer\'s list is shorter than the index the credential names', { op: 'set', path: ['statusLists', 0], value: X.lists.short }, ['identity.status-list']);
|
||||
d('binding-disclosures-removed', 'a disclosure taken out after the presenter signed', { op: 'remove', path: ['presentation', 'disclosures', 0] }, ['identity.binding-disclosures']);
|
||||
d('binding-disclosures-added', 'a disclosure the issuer signed, added after the presenter signed (the holder did not choose to show it)', { op: 'add', path: ['presentation', 'disclosures', 2], value: X.undisclosed }, ['identity.binding-disclosures']);
|
||||
d('presentation-signature', 'the ML-DSA-65 half of the presenter\'s signature has one character changed', { op: 'set', path: ['presentation', 'signature', 'mldsa65'], value: schimba(sg.mldsa65) }, ['identity.presentation-signature']);
|
||||
d('presentation-signature-ed25519', 'the Ed25519 half of the presenter\'s signature has one character changed', { op: 'set', path: ['presentation', 'signature', 'ed25519'], value: schimba(sg.ed25519) }, ['identity.presentation-signature']);
|
||||
d('presentation-signature-no-ml-dsa', 'the ML-DSA-65 half of the presenter\'s signature removed: the classical half alone is not a signature here', { op: 'remove', path: ['presentation', 'signature', 'mldsa65'] }, ['identity.presentation-signature']);
|
||||
d('presentation-signature-alg', 'the signature declares ed25519 alone', { op: 'set', path: ['presentation', 'signature', 'alg'], value: 'ed25519' }, ['identity.presentation-signature']);
|
||||
d('audience', 'the presentation was made for this verifier and is shown to another', { op: 'set', path: ['audience'], value: 'https://another-verifier.example' }, ['identity.audience']);
|
||||
d('nonce', 'the verifier gave another nonce (a replay)', { op: 'set', path: ['nonce'], value: 'n-another' }, ['identity.nonce']);
|
||||
d('freshness', 'the verifier\'s clock is an hour after the presentation was made', { op: 'set', path: ['now'], value: X.later }, ['identity.freshness']);
|
||||
d('clock-years-later', 'the verifier\'s clock is years later: the credential has expired and the presentation is old', { op: 'set', path: ['now'], value: X.muchLater }, ['identity.credential-window', 'identity.freshness']);
|
||||
// one change at a producer: only who holds the key can make these
|
||||
const p = (baza) => (nume, titlu, prez, r, nota, o = {}) => invalid(`${baza.replace(/\.valid$/, '')}.${nume}`, titlu, baza, null, r, { levels: o.levels, producer: { note: nota, input: intrare(prez, o.input || {}), changed: [['presentation'], ...(o.changed || [])] } });
|
||||
const pd = p(bd), pl = p(bl);
|
||||
pd('issuer-id-impostor', 'an impostor issues the credential with its own keys under the id of the issuer the verifier trusts', F.issuerImpostor, ['identity.issuer-id'], 'another issuer wrote the trusted issuer\'s id beside its own keys and signed with them (this credential names no status list)');
|
||||
pd('issuer-classical-key', 'the issuer\'s "ML-DSA-65" key is an Ed25519 key, the id is the hash of those keys and both halves of the signature are Ed25519: a classical key is not a post-quantum one because of the field it sits in', F.issuerClassicalKey.presentation, ['identity.credential-signature', 'identity.issuer-id'],
|
||||
'an issuer with two Ed25519 keys (made and discarded at generation) put the second in the mldsa65 field, derived its id with the published formula and signed with both', { input: { trustedIssuers: [F.issuerClassicalKey.issuerId] }, changed: [['trustedIssuers']] });
|
||||
pd('holder-id', 'the credential and the presenter name a holder id that the holder keys do not derive', F.holderId, ['identity.holder-id'], 'the issuer signed another holder id beside the holder\'s keys, and the holder presented under that id');
|
||||
pd('credential-signature', 'the ML-DSA-65 half of the issuer\'s signature has one character changed, and the holder presents the credential so', F.credentialSignatureMlDsa, ['identity.credential-signature'], 'the holder presented a credential whose issuer signature was changed (ML-DSA-65 half)');
|
||||
pd('credential-signature-ed25519', 'the Ed25519 half of the issuer\'s signature has one character changed', F.credentialSignatureEd25519, ['identity.credential-signature'], 'the holder presented a credential whose issuer signature was changed (Ed25519 half)');
|
||||
pd('credential-signature-claim-edited', 'the holder edited a plain claim of the credential and presents it', F.claimEdited, ['identity.credential-signature'], 'the holder changed the plain claim employer after issuance and signed a presentation of the changed credential');
|
||||
pd('credential-window-expired', 'the credential expired the day before', F.expired, ['identity.credential-window'], 'the issuer issued the same claims valid until the day before the presentation');
|
||||
pd('credential-window-not-yet', 'the credential is valid only from the next day', F.notYetValid, ['identity.credential-window'], 'the issuer issued the same claims valid from the day after the presentation');
|
||||
pd('sd-distinct', 'the issuer signed the same digest twice', F.sdTwice, ['identity.sd-distinct'], 'the issuer signed a credential whose sd list repeats a digest');
|
||||
pd('disclosure-readable', 'a disclosure with a salt of eight bytes among those shown', F.disclosureShortSalt, ['identity.disclosure-readable'], 'the holder added a disclosure with an eight-byte salt and signed for the list');
|
||||
pd('disclosure-signed', 'a disclosure the holder made up (age_over_21), signed for by the holder and not by the issuer', F.disclosureFabricated, ['identity.disclosure-signed'], 'the holder added a disclosure whose digest the issuer never signed and signed for the list');
|
||||
pd('disclosure-once', 'the same disclosure shown twice', F.disclosureTwice, ['identity.disclosure-once'], 'the holder listed one disclosure twice and signed for the list');
|
||||
pd('disclosure-plain', 'the issuer signed a disclosure for a claim the credential also has in the clear, with another value', F.disclosureOverPlain, ['identity.disclosure-plain'], 'the issuer added to sd the digest of a disclosure named like the plain claim employer; the holder shows it');
|
||||
pd('claim-name', 'the issuer signed a plain claim whose name is not allowed', F.claimName, ['identity.claim-name'], 'the issuer signed a credential with a plain claim named "bad name"');
|
||||
pd('binding-credential', 'the presenter signed for another credential than the one shown', F.otherCredential, ['identity.binding-credential'], 'the holder signed a binding that names the hash of another credential');
|
||||
pd('presenter', 'a stranger presents the holder\'s credential with the holder\'s disclosures, signed with the stranger\'s keys', F.stranger, ['identity.presenter'], 'someone who is not the holder made and signed the presentation');
|
||||
pd('unreadable', 'the presenter signed a binding whose time is not a time', F.createdAt, ['identity.unreadable'], 'the holder signed a binding with createdAt "yesterday"', { levels: OPRIT });
|
||||
// the delegated presentation: one operation
|
||||
const l = (nume, titlu, op, r, o = {}) => invalid('identity-presentation/delegated.' + nume, titlu, bl, op, r, o);
|
||||
l('delegation-revoked', 'the holder revoked the first link before the presentation', { op: 'add', path: ['revocations'], value: [X.revocations.byHolder] }, ['identity.delegation-revoked']);
|
||||
l('delegation-revoked-by-giver', 'the phone revoked the link it gave to the session key', { op: 'add', path: ['revocations'], value: [X.revocations.byGiver] }, ['identity.delegation-revoked']);
|
||||
l('chain-cut', 'the last link taken out after the session key signed: the chain is not the one signed, and the presenter is not its last delegate', { op: 'remove', path: ['presentation', 'delegations', 1] }, ['identity.binding-delegations', 'identity.presenter']);
|
||||
// the delegated presentation: one change at a producer
|
||||
pl('binding-delegations', 'the session key signed for no chain and shows one', F.chainUnsigned, ['identity.binding-delegations'], 'the delegate signed a binding with an empty delegation list and attached the chain');
|
||||
pl('chain-length', 'a chain of nine links', F.chainNine, ['identity.chain-length'], 'the holder, the phone and the session key delegated to one another nine times', { levels: OPRIT });
|
||||
pl('delegation-form', 'the only link is of another kind, signed so by the holder', F.linkForm, ['identity.delegation-form'], 'the holder signed a link of kind aere-delegation-v0 to the phone, and the phone presents', { levels: OPRIT });
|
||||
pl('delegation-ids', 'the link and the presenter name a delegate id that the delegate keys do not derive', F.linkIds, ['identity.delegation-ids'], 'the holder signed another delegate id beside the phone\'s keys, and the phone presented under that id');
|
||||
pl('delegation-from', 'a stranger delegates the holder\'s credential to the phone', F.linkFromStranger, ['identity.delegation-from'], 'someone who is not the holder gave the first link');
|
||||
pl('delegation-parent', 'the second link names no parent', F.linkNoParent, ['identity.delegation-parent'], 'the phone gave the session key a link that does not name the link it comes from');
|
||||
pl('delegation-signature', 'the ML-DSA-65 half of the link\'s signature has one character changed, and the phone presents the chain so', F.linkSignature, ['identity.delegation-signature'], 'the phone presented a link whose signature was changed (ML-DSA-65 half)');
|
||||
pl('delegation-scope-field', 'the scope of the link has a field the verifier does not know', F.linkScopeUnknownField, ['identity.delegation-scope'], 'the holder signed a link whose scope carries an extra field');
|
||||
pl('delegation-scope-unsorted', 'the scope of the link is not in its normal form', F.linkScopeUnsorted, ['identity.delegation-scope'], 'the holder signed a link whose claims are not sorted');
|
||||
pl('delegation-window', 'the link expired an hour before the presentation', F.linkExpired, ['identity.delegation-window'], 'the holder gave a link valid from two hours to one hour before');
|
||||
pl('delegation-depth-zero', 'the first link allows no further delegation and the phone delegated anyway', F.linkDepthZero, ['identity.delegation-depth', 'identity.delegation-narrows'], 'the holder gave the phone a link of depth 0; the phone signed a second link under it');
|
||||
pl('delegation-depth-negative', 'the second link is given a negative depth, so that it "narrows" a first link of depth 0', F.linkDepthNegative, ['identity.delegation-depth'], 'the holder gave the phone a link of depth 0; the phone signed a second link of depth -1 under it');
|
||||
pl('delegation-narrows', 'the phone widens the claims the holder allowed it', F.linkWidens, ['identity.delegation-narrows'], 'the phone signed a second link whose claims are "*"');
|
||||
pl('delegation-credential', 'the link is for another credential', F.linkOtherCredential, ['identity.delegation-credential'], 'the holder gave a link scoped to another credential id');
|
||||
pl('delegation-claims', 'the phone shows a claim outside the scope of its link', F.linkOtherClaims, ['identity.delegation-claims'], 'the holder gave a link for one claim; the phone disclosed two');
|
||||
pl('delegation-audience', 'the link is for another verifier', F.linkOtherAudience, ['identity.delegation-audience'], 'the holder gave a link scoped to another audience'); }
|
||||
// (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 });
|
||||
|
||||
Reference in new issue
Block a user