agent-passport-system 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/dist/src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.d.ts +2 -0
  3. package/dist/src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.d.ts.map +1 -0
  4. package/dist/src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.js +392 -0
  5. package/dist/src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.js.map +1 -0
  6. package/dist/src/v2/read_fidelity_receipt/index.d.ts +4 -0
  7. package/dist/src/v2/read_fidelity_receipt/index.d.ts.map +1 -0
  8. package/dist/src/v2/read_fidelity_receipt/index.js +16 -0
  9. package/dist/src/v2/read_fidelity_receipt/index.js.map +1 -0
  10. package/dist/src/v2/read_fidelity_receipt/receipt.d.ts +45 -0
  11. package/dist/src/v2/read_fidelity_receipt/receipt.d.ts.map +1 -0
  12. package/dist/src/v2/read_fidelity_receipt/receipt.js +283 -0
  13. package/dist/src/v2/read_fidelity_receipt/receipt.js.map +1 -0
  14. package/dist/src/v2/read_fidelity_receipt/sampler.d.ts +35 -0
  15. package/dist/src/v2/read_fidelity_receipt/sampler.d.ts.map +1 -0
  16. package/dist/src/v2/read_fidelity_receipt/sampler.js +110 -0
  17. package/dist/src/v2/read_fidelity_receipt/sampler.js.map +1 -0
  18. package/dist/src/v2/read_fidelity_receipt/types.d.ts +139 -0
  19. package/dist/src/v2/read_fidelity_receipt/types.d.ts.map +1 -0
  20. package/dist/src/v2/read_fidelity_receipt/types.js +17 -0
  21. package/dist/src/v2/read_fidelity_receipt/types.js.map +1 -0
  22. package/dist/src/v2/read_fidelity_receipt/vectors/generate.d.ts +2 -0
  23. package/dist/src/v2/read_fidelity_receipt/vectors/generate.d.ts.map +1 -0
  24. package/dist/src/v2/read_fidelity_receipt/vectors/generate.js +261 -0
  25. package/dist/src/v2/read_fidelity_receipt/vectors/generate.js.map +1 -0
  26. package/dist/src/v2/word_handles/__tests__/word_handles.test.d.ts +2 -0
  27. package/dist/src/v2/word_handles/__tests__/word_handles.test.d.ts.map +1 -0
  28. package/dist/src/v2/word_handles/__tests__/word_handles.test.js +312 -0
  29. package/dist/src/v2/word_handles/__tests__/word_handles.test.js.map +1 -0
  30. package/dist/src/v2/word_handles/codec.d.ts +54 -0
  31. package/dist/src/v2/word_handles/codec.d.ts.map +1 -0
  32. package/dist/src/v2/word_handles/codec.js +334 -0
  33. package/dist/src/v2/word_handles/codec.js.map +1 -0
  34. package/dist/src/v2/word_handles/index.d.ts +4 -0
  35. package/dist/src/v2/word_handles/index.d.ts.map +1 -0
  36. package/dist/src/v2/word_handles/index.js +13 -0
  37. package/dist/src/v2/word_handles/index.js.map +1 -0
  38. package/dist/src/v2/word_handles/lexicon.d.ts +7 -0
  39. package/dist/src/v2/word_handles/lexicon.d.ts.map +1 -0
  40. package/dist/src/v2/word_handles/lexicon.js +276 -0
  41. package/dist/src/v2/word_handles/lexicon.js.map +1 -0
  42. package/dist/src/v2/word_handles/types.d.ts +58 -0
  43. package/dist/src/v2/word_handles/types.d.ts.map +1 -0
  44. package/dist/src/v2/word_handles/types.js +13 -0
  45. package/dist/src/v2/word_handles/types.js.map +1 -0
  46. package/package.json +2 -2
package/README.md CHANGED
@@ -257,7 +257,7 @@ The test count is one number derived from the suite, not three guesses. The badg
257
257
 
258
258
  ## Links
259
259
 
260
- - [aeoess.com](https://aeoess.com) -- Protocol home
260
+ - [aeoess.com](https://agent-passport.org) -- Protocol home
261
261
  - [llms-full.txt](https://aeoess.com/llms-full.txt) -- Complete reference for AI agents
262
262
  - [Dev log](https://aeoess.com/blog.html) -- Day-by-day build record
263
263
  - [npm](https://www.npmjs.com/package/agent-passport-system) · [PyPI](https://pypi.org/project/agent-passport-system/) · [MCP](https://www.npmjs.com/package/agent-passport-system-mcp)
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=read_fidelity_receipt.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read_fidelity_receipt.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,392 @@
1
+ // Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
2
+ // ══════════════════════════════════════════════════════════════════
3
+ // read_fidelity_receipt (v2): tests
4
+ // ══════════════════════════════════════════════════════════════════
5
+ // Deterministic throughout: every digest, nonce, seed, and source
6
+ // text is a fixed string or derived from sha256 over a fixed label.
7
+ // No wall clock, no randomness. The shared parity vectors file
8
+ // (vectors/read-fidelity-receipt-v0.1-vectors.json, written by
9
+ // vectors/generate.ts) is loaded and replayed here; the Python SDK
10
+ // asserts the same values against a byte-identical copy.
11
+ // ══════════════════════════════════════════════════════════════════
12
+ import { describe, it } from 'node:test';
13
+ import assert from 'node:assert/strict';
14
+ import { createHash } from 'node:crypto';
15
+ import { readFileSync } from 'node:fs';
16
+ import { canonicalizeJCS } from '../../../core/canonical-jcs.js';
17
+ import { verify as edVerify, publicKeyFromPrivate, sign } from '../../../crypto/keys.js';
18
+ import { decodeProfile, encodeProfile } from '../../word_handles/index.js';
19
+ import { canonicalNoSig, commitSpans, createReadFidelityReceipt, deriveSeed, sampleSpans, scoreResponses, verifyAgainstSource, verifyReadFidelityReceipt, verifyResponses, } from '../index.js';
20
+ function sha256hex(s) {
21
+ return createHash('sha256').update(s, 'utf8').digest('hex');
22
+ }
23
+ const VECTORS = JSON.parse(readFileSync(new URL('../vectors/read-fidelity-receipt-v0.1-vectors.json', import.meta.url), 'utf8'));
24
+ /** Build a fresh, internally consistent signed record for mutation tests. */
25
+ function buildRecord(overrides) {
26
+ const privateKey = sha256hex('rf-test key v1');
27
+ const source = 'A deterministic test source with enough characters to sample ' +
28
+ 'several spans from, none of them overlapping the ends badly.';
29
+ const contentDigest = `sha256:${sha256hex('rf-test content v1')}`;
30
+ const presentationDigest = overrides?.presentationDigest ?? null;
31
+ const nonce = 'rf-test-nonce-1';
32
+ const version = '1';
33
+ const seed = deriveSeed(contentDigest, presentationDigest, nonce, version);
34
+ const n = 4;
35
+ const spanLen = 10;
36
+ const spans = sampleSpans(source, seed, n, spanLen);
37
+ const spanTexts = spans.map((s) => s.text);
38
+ const responses = overrides?.responses ?? spanTexts;
39
+ const k = overrides?.k ?? scoreResponses(spanTexts, responses).k;
40
+ const record = createReadFidelityReceipt({
41
+ content_digest: contentDigest,
42
+ presentation_digest: presentationDigest,
43
+ challenge: {
44
+ nonce,
45
+ seed,
46
+ algorithm: 'span_sample_v1',
47
+ version,
48
+ span_len: spanLen,
49
+ span_commitments: commitSpans(spanTexts),
50
+ },
51
+ response_digest: `sha256:${sha256hex(canonicalizeJCS(responses))}`,
52
+ k,
53
+ n,
54
+ scoring_method: 'exact_match_v1',
55
+ model_claim: 'test-model-v1',
56
+ runtime_claim: 'test-runtime-v1',
57
+ verification_method: 'asserted',
58
+ challenge_issued_at: '2026-07-04T00:00:00Z',
59
+ response_observed_at: '2026-07-04T00:00:01Z',
60
+ receipt_issued_at: '2026-07-04T00:00:02Z',
61
+ }, privateKey);
62
+ return { record, source, spanTexts, privateKey };
63
+ }
64
+ /** Re-sign a mutated record body with the given key (sig excluded from preimage). */
65
+ function resign(record, privateKey) {
66
+ return { ...record, sig: sign(canonicalNoSig(record), privateKey) };
67
+ }
68
+ describe('seed derivation', () => {
69
+ it('matches an independent JCS recompute with presentation_digest present', () => {
70
+ const content = `sha256:${sha256hex('rf-seed-check:content')}`;
71
+ const presentation = `sha256:${sha256hex('rf-seed-check:presentation')}`;
72
+ const nonce = 'rf-seed-check-nonce';
73
+ // Hand-built RFC 8785 preimage, keys sorted, presentation a distinct member.
74
+ const preimage = `{"content_digest":${JSON.stringify(content)},` +
75
+ `"nonce":${JSON.stringify(nonce)},` +
76
+ `"presentation_digest":${JSON.stringify(presentation)},` +
77
+ `"version":"1"}`;
78
+ const expected = createHash('sha256').update(preimage, 'utf8').digest('hex');
79
+ assert.equal(deriveSeed(content, presentation, nonce, '1'), expected);
80
+ });
81
+ it('renders a null presentation_digest as a JSON null member, not the empty string', () => {
82
+ const content = `sha256:${sha256hex('rf-seed-check:content-null')}`;
83
+ const nonce = 'rf-seed-check-nonce-null';
84
+ const preimage = `{"content_digest":${JSON.stringify(content)},` +
85
+ `"nonce":${JSON.stringify(nonce)},` +
86
+ `"presentation_digest":null,` +
87
+ `"version":"1"}`;
88
+ const expected = createHash('sha256').update(preimage, 'utf8').digest('hex');
89
+ assert.equal(deriveSeed(content, null, nonce, '1'), expected);
90
+ assert.notEqual(deriveSeed(content, null, nonce, '1'), deriveSeed(content, `sha256:${'0'.repeat(64)}`, nonce, '1'));
91
+ });
92
+ it('closes the demonstrated null-vs-present splice collision', () => {
93
+ // Adversarial repro (scratchpad/adv/splice.ts): under the old
94
+ // concatenation preimage, a null-presentation record with
95
+ // nonce = P || N derived the SAME seed as a P-presentation record with
96
+ // nonce N, so a verifier that pinned only the seed could not tell them
97
+ // apart. The JCS preimage makes presentation_digest a distinct member,
98
+ // so the two now derive different seeds.
99
+ const content = `sha256:${'11'.repeat(32)}`;
100
+ const P = `sha256:${'22'.repeat(32)}`;
101
+ const N = 'verifier-nonce-xyz';
102
+ const seedSpliced = deriveSeed(content, null, P + N, '1');
103
+ const seedHonest = deriveSeed(content, P, N, '1');
104
+ assert.notEqual(seedSpliced, seedHonest);
105
+ // v6/v7-style: plant the other case's seed into a record and re-sign.
106
+ // Verification recomputes the seed from (content, presentation, nonce)
107
+ // and rejects the mismatch even though the signature is valid.
108
+ const { record, privateKey } = buildRecord();
109
+ assert.deepEqual(verifyReadFidelityReceipt(record), { valid: true });
110
+ const wrongSeed = record.challenge.seed === seedSpliced ? seedHonest : seedSpliced;
111
+ const planted = resign({ ...record, challenge: { ...record.challenge, seed: wrongSeed } }, privateKey);
112
+ const res = verifyReadFidelityReceipt(planted);
113
+ assert.equal(res.valid, false);
114
+ assert.equal(res.reason, 'SEED_MISMATCH');
115
+ });
116
+ it('reproduces both seed KATs from the shared vectors', () => {
117
+ assert.equal(VECTORS.seed_kats.length, 2);
118
+ const withPresentation = VECTORS.seed_kats.find((s) => s.presentation_digest !== null);
119
+ const withNull = VECTORS.seed_kats.find((s) => s.presentation_digest === null);
120
+ assert.ok(withPresentation);
121
+ assert.ok(withNull);
122
+ for (const kat of VECTORS.seed_kats) {
123
+ assert.equal(deriveSeed(kat.content_digest, kat.presentation_digest, kat.nonce, kat.version), kat.seed, `seed KAT ${kat.name}`);
124
+ }
125
+ });
126
+ });
127
+ describe('sampler', () => {
128
+ it('is deterministic for identical inputs', () => {
129
+ const seed = sha256hex('rf-sampler-det:seed');
130
+ const source = 'determinism check source text, long enough to sample from';
131
+ const a = sampleSpans(source, seed, 5, 8);
132
+ const b = sampleSpans(source, seed, 5, 8);
133
+ assert.deepEqual(a, b);
134
+ });
135
+ it('reproduces every sampler case in the shared vectors', () => {
136
+ assert.equal(VECTORS.sampler_cases.length, 3);
137
+ for (const c of VECTORS.sampler_cases) {
138
+ const spans = sampleSpans(c.source, c.seed, c.n, c.span_len);
139
+ assert.deepEqual(spans, c.spans, `sampler case ${c.name}`);
140
+ }
141
+ });
142
+ it('returns distinct positions, exhausting the range when n equals it', () => {
143
+ const seed = sha256hex('rf-sampler-distinct:seed');
144
+ const source = 'abcdefghijklmnop'; // 16 code points
145
+ const spanLen = 5;
146
+ const range = source.length - spanLen + 1; // 12
147
+ const spans = sampleSpans(source, seed, range, spanLen);
148
+ const positions = spans.map((s) => s.pos);
149
+ assert.equal(new Set(positions).size, range);
150
+ for (const pos of positions) {
151
+ assert.ok(pos >= 0 && pos < range);
152
+ }
153
+ });
154
+ it('throws when n exceeds the position range', () => {
155
+ const seed = sha256hex('rf-sampler-range:seed');
156
+ assert.throws(() => sampleSpans('abcdefghij', seed, 7, 5), /n 7 exceeds the position range 6/);
157
+ assert.throws(() => sampleSpans('abc', seed, 1, 5), /need at least spanLen 5/);
158
+ assert.throws(() => sampleSpans('abcdef', seed, 0, 2), /positive integer/);
159
+ assert.throws(() => sampleSpans('abcdef', seed, 1, 0), /positive integer/);
160
+ });
161
+ it('slices by unicode code points, never splitting surrogate pairs', () => {
162
+ const seed = sha256hex('rf-sampler-unicode:seed');
163
+ const source = 'аб🔐вг🙂дежз🌍ийкл'; // cyrillic plus astral emoji
164
+ const cps = Array.from(source);
165
+ const spanLen = 3;
166
+ const range = cps.length - spanLen + 1;
167
+ const spans = sampleSpans(source, seed, range, spanLen);
168
+ for (const span of spans) {
169
+ assert.equal(Array.from(span.text).length, spanLen);
170
+ assert.equal(span.text, cps.slice(span.pos, span.pos + spanLen).join(''));
171
+ // No unpaired surrogate at either boundary.
172
+ const first = span.text.charCodeAt(0);
173
+ const last = span.text.charCodeAt(span.text.length - 1);
174
+ assert.ok(first < 0xdc00 || first > 0xdfff, 'starts on a lone low surrogate');
175
+ assert.ok(last < 0xd800 || last > 0xdbff, 'ends on a lone high surrogate');
176
+ }
177
+ // The emoji-bearing vector case double-checks against the fixture.
178
+ const c = VECTORS.sampler_cases[1];
179
+ assert.equal(c.name, 'case2_emoji_cyrillic');
180
+ for (const s of c.spans) {
181
+ assert.equal(Array.from(s.text).length, s.len);
182
+ }
183
+ });
184
+ it('scores responses by exact string equality only', () => {
185
+ const spanTexts = ['alpha', 'beta', 'gamma'];
186
+ const { k, results } = scoreResponses(spanTexts, ['alpha', 'Beta', 'gamma']);
187
+ assert.equal(k, 2);
188
+ assert.deepEqual(results, [true, false, true]);
189
+ assert.throws(() => scoreResponses(spanTexts, ['alpha']), /does not match span count/);
190
+ });
191
+ });
192
+ describe('create and verify round trip', () => {
193
+ it('creates a record that verifies, with attester set from the key', () => {
194
+ const { record, privateKey } = buildRecord();
195
+ assert.equal(record.type, 'read_fidelity_receipt');
196
+ assert.equal(record.attester, publicKeyFromPrivate(privateKey));
197
+ assert.match(record.sig, /^[0-9a-f]{128}$/);
198
+ assert.deepEqual(verifyReadFidelityReceipt(record), { valid: true });
199
+ });
200
+ it('fails the signature when content_digest is tampered after signing', () => {
201
+ const { record } = buildRecord();
202
+ const tampered = {
203
+ ...record,
204
+ content_digest: `sha256:${sha256hex('rf-tampered content')}`,
205
+ };
206
+ const res = verifyReadFidelityReceipt(tampered);
207
+ assert.equal(res.valid, false);
208
+ assert.equal(res.reason, 'SIGNATURE_INVALID');
209
+ });
210
+ it('fails on the seed derivation for a replayed nonce, even re-signed', () => {
211
+ const { record, privateKey } = buildRecord();
212
+ // Replay: same commitments and responses under a NEW nonce. The
213
+ // attacker re-signs, so the signature is valid; the seed no longer
214
+ // matches the derivation and the reason names the seed.
215
+ const replayed = resign({
216
+ ...record,
217
+ challenge: { ...record.challenge, nonce: 'rf-replayed-nonce-2' },
218
+ }, privateKey);
219
+ assert.equal(edVerify(canonicalNoSig(replayed), replayed.sig, replayed.attester), true);
220
+ const res = verifyReadFidelityReceipt(replayed);
221
+ assert.equal(res.valid, false);
222
+ assert.match(String(res.reason), /SEED/);
223
+ });
224
+ it('fails on the seed derivation for a swapped presentation_digest, even re-signed', () => {
225
+ const { record, privateKey } = buildRecord({
226
+ presentationDigest: `sha256:${sha256hex('rf-presentation v1')}`,
227
+ });
228
+ assert.deepEqual(verifyReadFidelityReceipt(record), { valid: true });
229
+ const swapped = resign({
230
+ ...record,
231
+ presentation_digest: `sha256:${sha256hex('rf-presentation v2')}`,
232
+ }, privateKey);
233
+ assert.equal(edVerify(canonicalNoSig(swapped), swapped.sig, swapped.attester), true);
234
+ const res = verifyReadFidelityReceipt(swapped);
235
+ assert.equal(res.valid, false);
236
+ assert.match(String(res.reason), /SEED/);
237
+ });
238
+ it('rejects an n mismatch with span_commitments at create', () => {
239
+ const { record } = buildRecord();
240
+ const { type: _t, attester: _a, sig: _s, ...fields } = record;
241
+ assert.throws(() => createReadFidelityReceipt({ ...fields, n: fields.n + 1 }, sha256hex('rf-test key v1')), /n \(5\) must equal challenge\.span_commitments\.length \(4\)/);
242
+ });
243
+ it('rejects an n mismatch with span_commitments at verify', () => {
244
+ const { record, privateKey } = buildRecord();
245
+ const mismatched = resign({ ...record, n: record.n + 1 }, privateKey);
246
+ const res = verifyReadFidelityReceipt(mismatched);
247
+ assert.equal(res.valid, false);
248
+ assert.equal(res.reason, 'N_MISMATCH');
249
+ });
250
+ it('rejects a seed that does not match the derivation at create', () => {
251
+ const { record } = buildRecord();
252
+ const { type: _t, attester: _a, sig: _s, ...fields } = record;
253
+ assert.throws(() => createReadFidelityReceipt({
254
+ ...fields,
255
+ challenge: { ...fields.challenge, seed: sha256hex('rf-wrong-seed') },
256
+ }, sha256hex('rf-test key v1')), /seed/);
257
+ });
258
+ });
259
+ describe('verifyAgainstSource', () => {
260
+ it('fully passes on the fixture record over the fixture source', () => {
261
+ const { record } = VECTORS.record_case;
262
+ const source = VECTORS.sampler_cases[0].source;
263
+ const res = verifyAgainstSource(record, source);
264
+ assert.equal(res.valid, true);
265
+ assert.equal(res.reason, undefined);
266
+ assert.equal(res.signature_valid, true);
267
+ assert.equal(res.seed_valid, true);
268
+ assert.equal(res.commitment_matches.length, record.n);
269
+ assert.deepEqual(res.commitment_matches, Array.from({ length: record.n }, () => true));
270
+ });
271
+ it('reports commitment mismatches against a different source', () => {
272
+ const { record } = VECTORS.record_case;
273
+ const wrongSource = 'An entirely different source text that still has enough length ' +
274
+ 'for the sampler to draw all of its spans from without throwing.';
275
+ const res = verifyAgainstSource(record, wrongSource);
276
+ assert.equal(res.valid, false);
277
+ assert.equal(res.reason, 'COMMITMENT_MISMATCH');
278
+ assert.equal(res.signature_valid, true);
279
+ assert.equal(res.seed_valid, true);
280
+ assert.ok(res.commitment_matches.some((m) => m === false));
281
+ });
282
+ it('reports SPAN_RECOMPUTE_FAILED when the source cannot produce the spans', () => {
283
+ const { record } = VECTORS.record_case;
284
+ const res = verifyAgainstSource(record, 'too short');
285
+ assert.equal(res.valid, false);
286
+ assert.equal(res.reason, 'SPAN_RECOMPUTE_FAILED');
287
+ assert.deepEqual(res.commitment_matches, []);
288
+ });
289
+ });
290
+ describe('verifyResponses', () => {
291
+ it('recomputes k = n for the fixture record with faithful responses', () => {
292
+ const { record } = VECTORS.record_case;
293
+ const source = VECTORS.sampler_cases[0].source;
294
+ const responses = VECTORS.sampler_cases[0].spans.map((s) => s.text);
295
+ const res = verifyResponses(record, source, responses);
296
+ assert.equal(res.k_recomputed, record.n);
297
+ assert.equal(res.matches_claimed_k, true);
298
+ assert.equal(res.response_digest_ok, true);
299
+ });
300
+ it('recomputes an honest k < n for a record with one missed span', () => {
301
+ const base = buildRecord();
302
+ const degraded = base.spanTexts.slice();
303
+ degraded[2] = `${degraded[2]}!`;
304
+ const { record, source } = buildRecord({ responses: degraded });
305
+ assert.equal(record.k, base.spanTexts.length - 1);
306
+ assert.deepEqual(verifyReadFidelityReceipt(record), { valid: true });
307
+ const res = verifyResponses(record, source, degraded);
308
+ assert.equal(res.k_recomputed, record.n - 1);
309
+ assert.equal(res.matches_claimed_k, true);
310
+ assert.equal(res.response_digest_ok, true);
311
+ });
312
+ it('flags a claimed k that the responses do not support', () => {
313
+ const base = buildRecord();
314
+ const degraded = base.spanTexts.slice();
315
+ degraded[0] = `${degraded[0]} `;
316
+ const res = verifyResponses(base.record, base.source, degraded);
317
+ assert.equal(res.k_recomputed, base.record.n - 1);
318
+ assert.equal(res.matches_claimed_k, false);
319
+ assert.equal(res.response_digest_ok, false);
320
+ });
321
+ });
322
+ describe('record_case fixture parity', () => {
323
+ it('reproduces canonical_no_sig_sha256 and the signature verifies', () => {
324
+ const { record, canonical_no_sig_sha256, signature_valid, private_key_hex } = VECTORS.record_case;
325
+ const canonical = canonicalNoSig(record);
326
+ assert.equal(sha256hex(canonical), canonical_no_sig_sha256);
327
+ assert.equal(signature_valid, true);
328
+ assert.equal(edVerify(canonical, record.sig, record.attester), true);
329
+ assert.equal(record.attester, publicKeyFromPrivate(private_key_hex));
330
+ assert.deepEqual(verifyReadFidelityReceipt(record), { valid: true });
331
+ });
332
+ it('re-signing the record body with the fixture key yields the identical sig', () => {
333
+ const { record, private_key_hex } = VECTORS.record_case;
334
+ assert.equal(sign(canonicalNoSig(record), private_key_hex), record.sig);
335
+ });
336
+ it('binds the record to the fixture constants from the build contract', () => {
337
+ const { record, private_key_hex } = VECTORS.record_case;
338
+ assert.equal(private_key_hex, sha256hex('read-fidelity fixture key v1'));
339
+ assert.equal(record.content_digest, `sha256:${sha256hex('read-fidelity fixture content v1')}`);
340
+ assert.equal(record.presentation_digest, null);
341
+ assert.equal(record.challenge.nonce, 'fixture-nonce-1');
342
+ assert.equal(record.challenge.version, '1');
343
+ assert.equal(record.k, record.n);
344
+ assert.equal(record.n, record.challenge.span_commitments.length);
345
+ // The fixture commitments are the commitments of sampler case 1 texts.
346
+ assert.deepEqual(record.challenge.span_commitments, commitSpans(VECTORS.sampler_cases[0].spans.map((s) => s.text)));
347
+ });
348
+ });
349
+ describe('shared vectors file integrity', () => {
350
+ it('replays every jcs_kat, including the unicode case', () => {
351
+ assert.ok(VECTORS.jcs_kats.length >= 4);
352
+ assert.ok(VECTORS.jcs_kats.some((k) => k.name === 'unicode_emoji_cyrillic'));
353
+ for (const kat of VECTORS.jcs_kats) {
354
+ assert.equal(canonicalizeJCS(kat.value), kat.canonical, `jcs KAT ${kat.name}`);
355
+ assert.equal(sha256hex(kat.canonical), kat.sha256, `jcs KAT ${kat.name}`);
356
+ }
357
+ });
358
+ it('replays the word handle round trips', () => {
359
+ assert.equal(VECTORS.word_handle_cases.round_trips.length, 12);
360
+ for (const c of VECTORS.word_handle_cases.round_trips) {
361
+ assert.deepEqual(encodeProfile(c.digest, c.profile), c.words);
362
+ const res = decodeProfile(c.words, c.profile);
363
+ assert.equal(res.checksumOk, true);
364
+ assert.equal(res.prefixHex, c.prefix_hex);
365
+ assert.equal(res.prefixBits, c.prefix_bits);
366
+ }
367
+ });
368
+ it('replays the word handle negatives, including the transposition', () => {
369
+ const { substitution_negative, transposition_negative, out_of_lexicon_negative } = VECTORS.word_handle_cases;
370
+ const sub = decodeProfile(substitution_negative.words, substitution_negative.profile);
371
+ assert.equal(sub.checksumOk, substitution_negative.checksum_ok);
372
+ assert.equal(sub.checksumOk, false);
373
+ const subBase = encodeProfile(substitution_negative.digest, substitution_negative.profile);
374
+ assert.notEqual(substitution_negative.words[substitution_negative.substituted_index], subBase[substitution_negative.substituted_index]);
375
+ const tr = decodeProfile(transposition_negative.words, transposition_negative.profile);
376
+ assert.equal(tr.checksumOk, transposition_negative.checksum_ok);
377
+ assert.equal(tr.checksumOk, false);
378
+ const trBase = encodeProfile(transposition_negative.digest, transposition_negative.profile);
379
+ const [i, j] = transposition_negative.swapped_indices;
380
+ assert.equal(transposition_negative.words[i], trBase[j]);
381
+ assert.equal(transposition_negative.words[j], trBase[i]);
382
+ const ol = decodeProfile(out_of_lexicon_negative.words, out_of_lexicon_negative.profile);
383
+ assert.deepEqual([...ol.outOfLexicon], out_of_lexicon_negative.out_of_lexicon);
384
+ assert.equal(ol.checksumOk, false);
385
+ assert.equal(ol.prefixHex, null);
386
+ });
387
+ it('pins the lexicon identifiers', () => {
388
+ assert.equal(VECTORS.lexicon_id, 'sha256:2a9c4de3b5457154e6bde9d40af0da552c2556d8e80a2dec8b82dee4bca74510');
389
+ assert.equal(VECTORS.lexicon_profile, 'single-list-v1');
390
+ });
391
+ });
392
+ //# sourceMappingURL=read_fidelity_receipt.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read_fidelity_receipt.test.js","sourceRoot":"","sources":["../../../../../src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,oCAAoC;AACpC,qEAAqE;AACrE,kEAAkE;AAClE,oEAAoE;AACpE,+DAA+D;AAC/D,+DAA+D;AAC/D,mEAAmE;AACnE,yDAAyD;AACzD,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAA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,GAAG,sBAAsB,CAAC,eAAe,CAAA;QACrD,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAExD,MAAM,EAAE,GAAG,aAAa,CAAC,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAA;QACxF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC,cAAc,CAAC,CAAA;QAC9E,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;QAClC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,KAAK,CACV,OAAO,CAAC,UAAU,EAClB,yEAAyE,CAC1E,CAAA;QACD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { deriveSeed, sampleSpans, commitSpans, scoreResponses, } from './sampler.js';
2
+ export { canonicalNoSig, createReadFidelityReceipt, verifyReadFidelityReceipt, verifyAgainstSource, verifyResponses, } from './receipt.js';
3
+ export type { ReadFidelityReceipt, ReadFidelityReceiptType, ReadFidelityChallenge, ReadFidelitySamplingAlgorithm, ReadFidelityScoringMethod, ReadFidelityVerificationMethod, CreateReadFidelityReceiptInput, SampledSpan, ScoreResponsesResult, ReadFidelityVerifyReason, ReadFidelityVerifyResult, VerifyAgainstSourceResult, VerifyResponsesResult, } from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/read_fidelity_receipt/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,UAAU,EACV,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,GAChB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,yBAAyB,EACzB,8BAA8B,EAC9B,8BAA8B,EAC9B,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,YAAY,CAAA"}
@@ -0,0 +1,16 @@
1
+ // Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
2
+ // ══════════════════════════════════════════════════════════════════
3
+ // read_fidelity_receipt (v2): public surface
4
+ // ══════════════════════════════════════════════════════════════════
5
+ // A signed record of a sampled readback challenge over perceived
6
+ // content. It proves sampled readback fidelity at the stated n under
7
+ // the declared sampling assumptions; it does not prove every byte was
8
+ // read correctly, does not prove perception or comprehension, does
9
+ // not prove which channel was used, and carries no normative pass
10
+ // threshold. Pure functions: no I/O, no clock, no randomness. See
11
+ // README.md for the record shape, the seed derivation, and the
12
+ // verification order.
13
+ // ══════════════════════════════════════════════════════════════════
14
+ export { deriveSeed, sampleSpans, commitSpans, scoreResponses, } from './sampler.js';
15
+ export { canonicalNoSig, createReadFidelityReceipt, verifyReadFidelityReceipt, verifyAgainstSource, verifyResponses, } from './receipt.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v2/read_fidelity_receipt/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,6CAA6C;AAC7C,qEAAqE;AACrE,iEAAiE;AACjE,qEAAqE;AACrE,sEAAsE;AACtE,mEAAmE;AACnE,kEAAkE;AAClE,kEAAkE;AAClE,+DAA+D;AAC/D,sBAAsB;AACtB,qEAAqE;AAErE,OAAO,EACL,UAAU,EACV,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,GAChB,MAAM,cAAc,CAAA"}
@@ -0,0 +1,45 @@
1
+ import type { CreateReadFidelityReceiptInput, ReadFidelityReceipt, ReadFidelityVerifyResult, VerifyAgainstSourceResult, VerifyResponsesResult } from './types.js';
2
+ /**
3
+ * Canonical signing preimage: RFC 8785 JCS of the record with the
4
+ * `sig` key removed entirely. Accepts a signed record (sig dropped)
5
+ * or an unsigned draft (no sig key present).
6
+ */
7
+ export declare function canonicalNoSig(record: object): string;
8
+ /**
9
+ * Build and sign a read fidelity receipt. Validates the input
10
+ * (n MUST equal challenge.span_commitments.length, challenge.seed MUST
11
+ * equal the seed derivation, every digest MUST be
12
+ * "sha256:<64 lowercase hex>", timestamps MUST be ISO 8601), sets
13
+ * `attester` from the private key, and signs the JCS canonical form of
14
+ * the record with the sig key excluded. Throws on any validation
15
+ * failure; nothing is signed unless the record is internally
16
+ * consistent.
17
+ */
18
+ export declare function createReadFidelityReceipt(fields: CreateReadFidelityReceiptInput, privateKeyHex: string): ReadFidelityReceipt;
19
+ /**
20
+ * Verify a read fidelity receipt: shape checks, n consistency against
21
+ * challenge.span_commitments, Ed25519 signature against the embedded
22
+ * attester, and the seed derivation recompute. Accepts unknown and
23
+ * never throws on malformed input; failures carry a reason code.
24
+ */
25
+ export declare function verifyReadFidelityReceipt(record: unknown): ReadFidelityVerifyResult;
26
+ /**
27
+ * Verify a receipt against the source text it claims to sample:
28
+ * everything verifyReadFidelityReceipt checks, plus a recompute of the
29
+ * spans from challenge.seed / n / span_len over `sourceText`, a sha256
30
+ * commitment of each recomputed span, and a positionwise comparison
31
+ * against challenge.span_commitments. ALL commitments must match.
32
+ * `signature_valid` and `seed_valid` are reported independently.
33
+ */
34
+ export declare function verifyAgainstSource(record: unknown, sourceText: string): VerifyAgainstSourceResult;
35
+ /**
36
+ * Recompute k for a set of readback responses against the source text:
37
+ * resample the spans the record commits to, score `responses` under
38
+ * exact_match_v1, and compare the recomputed k with the recorded k and
39
+ * the responses JCS digest with the recorded response_digest. Throws
40
+ * when the source cannot produce the spans (wrong length) or when
41
+ * `responses` has the wrong length; use verifyAgainstSource first to
42
+ * establish that the record matches the source at all.
43
+ */
44
+ export declare function verifyResponses(record: ReadFidelityReceipt, sourceText: string, responses: readonly string[]): VerifyResponsesResult;
45
+ //# sourceMappingURL=receipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../../../../src/v2/read_fidelity_receipt/receipt.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,8BAA8B,EAC9B,mBAAmB,EAEnB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAYnB;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGrD;AAsHD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,8BAA8B,EACtC,aAAa,EAAE,MAAM,GACpB,mBAAmB,CA0DrB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,wBAAwB,CAWnF;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,GACjB,yBAAyB,CA2C3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,mBAAmB,EAC3B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,qBAAqB,CAiBvB"}