@conarium-ai/core 0.2.20 → 0.2.22
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.
- package/CHANGELOG.md +68 -0
- package/LIMITATIONS.md +30 -0
- package/LIMITATIONS.tr.md +16 -0
- package/README.md +40 -5
- package/SECURITY.md +1 -1
- package/bin/conarium-docker-entry.mjs +62 -0
- package/bin/conarium-doctor.mjs +59 -2
- package/bin/conarium-reconcile.mjs +19 -5
- package/bin/conarium-verify.mjs +42 -7
- package/conformance/KNOWN-GAPS.md +20 -0
- package/conformance/README.md +85 -0
- package/conformance/adapters/README.md +59 -0
- package/conformance/adapters/conarium.mjs +17 -0
- package/conformance/cases/coverage/expect-count-pin.json +13 -0
- package/conformance/cases/coverage/tail-without-pin.json +15 -0
- package/conformance/cases/evidence/001-single-receipt.json +16 -0
- package/conformance/cases/evidence/002-chain-of-three.json +16 -0
- package/conformance/cases/evidence/003-tampered-field.json +16 -0
- package/conformance/cases/evidence/004-prevhash-break.json +16 -0
- package/conformance/cases/evidence/005-seq-gap.json +16 -0
- package/conformance/cases/evidence/006-bad-signature.json +16 -0
- package/conformance/cases/evidence/007-schema-invalid.json +16 -0
- package/conformance/cases/evidence/008-unsigned-no-pubkey.json +13 -0
- package/conformance/cases/evidence/009-unsigned-but-pubkey-given.json +16 -0
- package/conformance/cases/gate/deny-alias.json +13 -0
- package/conformance/cases/gate/deny-case-fold.json +13 -0
- package/conformance/cases/gate/deny-comment-between.json +13 -0
- package/conformance/cases/gate/deny-cte.json +13 -0
- package/conformance/cases/gate/deny-join.json +13 -0
- package/conformance/cases/gate/deny-plain.json +13 -0
- package/conformance/cases/gate/deny-quoted-lower.json +13 -0
- package/conformance/cases/gate/deny-schema-qualify.json +13 -0
- package/conformance/cases/gate/deny-string-agg.json +13 -0
- package/conformance/cases/gate/deny-subquery.json +13 -0
- package/conformance/cases/gate/deny-unqualified.json +13 -0
- package/conformance/cases/gate/deny-updlock.json +13 -0
- package/conformance/cases/gate/deny-user-fn.json +13 -0
- package/conformance/cases/gate/fail-empty.json +13 -0
- package/conformance/cases/gate/fail-garbage.json +13 -0
- package/conformance/cases/gate/fail-two-statements.json +13 -0
- package/conformance/cases/gate/write-copy.json +13 -0
- package/conformance/cases/gate/write-create.json +13 -0
- package/conformance/cases/gate/write-delete.json +13 -0
- package/conformance/cases/gate/write-drop.json +13 -0
- package/conformance/cases/gate/write-insert.json +13 -0
- package/conformance/cases/gate/write-merge.json +13 -0
- package/conformance/cases/gate/write-truncate.json +13 -0
- package/conformance/cases/gate/write-update.json +13 -0
- package/conformance/cases/inference/cohort-narrowing.json +13 -0
- package/conformance/cases/inference/count-channel.json +13 -0
- package/conformance/cases/inference/exists-channel.json +13 -0
- package/conformance/cases/inference/repeated-probe.json +13 -0
- package/conformance/cases/masking/mask-alias.json +14 -0
- package/conformance/cases/masking/mask-case.json +14 -0
- package/conformance/cases/masking/mask-concat.json +14 -0
- package/conformance/cases/masking/mask-subquery.json +14 -0
- package/conformance/cases/rowcap/cap-nested.json +14 -0
- package/conformance/cases/rowcap/cap-raise-limit.json +14 -0
- package/conformance/cases/rowcap/cap-union.json +14 -0
- package/conformance/claims/conarium.json +12 -0
- package/conformance/lib/status.mjs +48 -0
- package/conformance/policies/mask-email.json +5 -0
- package/conformance/policies/protected-email.json +6 -0
- package/conformance/policies/sql-gate.json +6 -0
- package/conformance/profiles.md +15 -0
- package/conformance/run.mjs +208 -0
- package/conformance/schema/case.json +42 -0
- package/dist/audit.d.ts +7 -0
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +6 -2
- package/dist/audit.js.map +1 -1
- package/dist/config.d.ts +22 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -2
- package/dist/config.js.map +1 -1
- package/dist/receipt-view.d.ts +5 -0
- package/dist/receipt-view.d.ts.map +1 -1
- package/dist/receipt-view.js +21 -0
- package/dist/receipt-view.js.map +1 -1
- package/dist/receipt.d.ts +49 -3
- package/dist/receipt.d.ts.map +1 -1
- package/dist/receipt.js +46 -3
- package/dist/receipt.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +12 -2
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/API-STABILITY.md +7 -6
- package/docs/CONTRIBUTING.md +7 -0
- package/docs/RECEIPT-SPEC.md +99 -17
- package/docs/dogfood/2026-08-06-reconcile.md +8 -0
- package/package.json +2 -1
- package/scripts/gacs-query-adapter.mjs +52 -0
- package/scripts/gen-test-vectors-04.mjs +115 -0
- package/scripts/gen-test-vectors.mjs +8 -0
- package/test-vectors/010-disclosure-commitment/receipts.jsonl +1 -0
- package/test-vectors/011-destination-declared/receipts.jsonl +1 -0
- package/test-vectors/012-mixed-chain/receipts.jsonl +2 -0
- package/test-vectors/013-disclosure-keys-omitted/receipts.jsonl +1 -0
- package/test-vectors/README.md +10 -5
- package/test-vectors/expected-hashes.json +24 -0
- package/test-vectors/manifest.json +37 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Append 0.4 conformance vectors. Does NOT rewrite 001–012.
|
|
4
|
+
* 010–012 were written by an earlier revision of this file and are frozen.
|
|
5
|
+
* This revision only adds 013 and merges the manifest.
|
|
6
|
+
*
|
|
7
|
+
* Usage: npm run build && node scripts/gen-test-vectors-04.mjs
|
|
8
|
+
*/
|
|
9
|
+
import { mkdirSync, writeFileSync, readFileSync, existsSync } from 'fs'
|
|
10
|
+
import { join } from 'path'
|
|
11
|
+
import { createPrivateKey } from 'crypto'
|
|
12
|
+
import { buildReceipt, RECEIPT_GENESIS_HASH, receiptHash } from '../dist/receipt.js'
|
|
13
|
+
import { signHash } from '../dist/keys.js'
|
|
14
|
+
|
|
15
|
+
const ROOT = 'test-vectors'
|
|
16
|
+
const KEY_DIR = join(ROOT, 'keys')
|
|
17
|
+
const KEY_ID = 'cnr-vectors'
|
|
18
|
+
const PRIV = join(KEY_DIR, 'vector-key.SECRET-TEST-ONLY.pem')
|
|
19
|
+
|
|
20
|
+
if (!existsSync(join(ROOT, '010-disclosure-commitment', 'receipts.jsonl'))) {
|
|
21
|
+
throw new Error('010–012 missing — this script no longer creates them')
|
|
22
|
+
}
|
|
23
|
+
if (existsSync(join(ROOT, '013-disclosure-keys-omitted', 'receipts.jsonl'))) {
|
|
24
|
+
throw new Error('013 already exists — refusing to overwrite a frozen vector')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const privatePem = readFileSync(PRIV, 'utf-8').replace(/^#[^\n]*\n/gm, '')
|
|
28
|
+
const key = { keyId: KEY_ID, privateKey: createPrivateKey(privatePem) }
|
|
29
|
+
|
|
30
|
+
function input04(n, overrides = {}) {
|
|
31
|
+
return {
|
|
32
|
+
id: `01JVECTOR00000000000000${String(n).padStart(3, '0')}`,
|
|
33
|
+
ts: `2026-08-16T00:00:0${n}.000Z`,
|
|
34
|
+
period: { start: `2026-08-16T00:00:0${n}.000Z`, end: `2026-08-16T00:00:0${n}.500Z` },
|
|
35
|
+
actor: { id: 'vector-service', type: 'service', assurance: 'shared-token' },
|
|
36
|
+
request: {
|
|
37
|
+
tool: 'query',
|
|
38
|
+
target: 'demo-db',
|
|
39
|
+
argsHash: `sha256:${'ab'.repeat(32)}`,
|
|
40
|
+
},
|
|
41
|
+
dataRefs: [{ source: 'vectors', object: 'public.demo', fieldsRequested: ['id'] }],
|
|
42
|
+
policy: {
|
|
43
|
+
id: 'conarium.policy/vectors',
|
|
44
|
+
version: '1',
|
|
45
|
+
decision: 'allow',
|
|
46
|
+
rulesApplied: ['mask:name'],
|
|
47
|
+
},
|
|
48
|
+
flags: [],
|
|
49
|
+
masking: { maskedCount: 0, byClass: {}, rowsReturned: 1, rowCapApplied: false },
|
|
50
|
+
outcome: { status: 'complete', denied: false },
|
|
51
|
+
...overrides,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const line = (r) => JSON.stringify(r) + '\n'
|
|
56
|
+
|
|
57
|
+
// Signed with hash/bytes omitted — not stripped after the fact. Otherwise the
|
|
58
|
+
// stored hash would fail first (exit 10) and the schema split would stay hidden.
|
|
59
|
+
const r013 = buildReceipt(input04(13), { seq: 1, prevHash: RECEIPT_GENESIS_HASH }, key)
|
|
60
|
+
if (r013.v !== 'conarium-receipt/0.4') throw new Error(`expected 0.4, got ${r013.v}`)
|
|
61
|
+
if (r013.disclosure.source !== 'undeclared' || r013.disclosure.hash !== null || r013.disclosure.bytes !== null) {
|
|
62
|
+
throw new Error('013 base must be undeclared with explicit nulls before keys are omitted')
|
|
63
|
+
}
|
|
64
|
+
delete r013.disclosure.hash
|
|
65
|
+
delete r013.disclosure.bytes
|
|
66
|
+
if ('hash' in r013.disclosure || 'bytes' in r013.disclosure) {
|
|
67
|
+
throw new Error('013 must omit disclosure.hash and disclosure.bytes')
|
|
68
|
+
}
|
|
69
|
+
const hash013 = receiptHash(r013)
|
|
70
|
+
r013.chain.hash = hash013
|
|
71
|
+
r013.sig = { alg: 'Ed25519', keyId: KEY_ID, value: signHash(key, hash013) }
|
|
72
|
+
|
|
73
|
+
const cases = [
|
|
74
|
+
{
|
|
75
|
+
name: '013-disclosure-keys-omitted',
|
|
76
|
+
description:
|
|
77
|
+
'0.4 receipt whose disclosure is undeclared but omits hash and bytes entirely. Absence is not explicit null; verify exits 20.',
|
|
78
|
+
exitCode: 20,
|
|
79
|
+
args: ['--pubkey', 'KEYS/vector-key.pub.pem'],
|
|
80
|
+
body: line(r013),
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
for (const c of cases) {
|
|
85
|
+
const dir = join(ROOT, c.name)
|
|
86
|
+
mkdirSync(dir, { recursive: true })
|
|
87
|
+
writeFileSync(join(dir, 'receipts.jsonl'), c.body)
|
|
88
|
+
console.log(` ${c.name} -> exit ${c.exitCode} ${hash013}`)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const manifestPath = join(ROOT, 'manifest.json')
|
|
92
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'))
|
|
93
|
+
const existing = new Set(manifest.cases.map((c) => c.name))
|
|
94
|
+
for (const c of cases) {
|
|
95
|
+
if (existing.has(c.name)) throw new Error(`manifest already has ${c.name}`)
|
|
96
|
+
manifest.cases.push({
|
|
97
|
+
name: c.name,
|
|
98
|
+
description: c.description,
|
|
99
|
+
exitCode: c.exitCode,
|
|
100
|
+
args: c.args,
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n')
|
|
104
|
+
|
|
105
|
+
const hashesPath = join(ROOT, 'expected-hashes.json')
|
|
106
|
+
const hashes = JSON.parse(readFileSync(hashesPath, 'utf-8'))
|
|
107
|
+
hashes.receipts.push({
|
|
108
|
+
case: '013-disclosure-keys-omitted',
|
|
109
|
+
seq: 1,
|
|
110
|
+
prevHash: r013.chain.prevHash,
|
|
111
|
+
hash: r013.chain.hash,
|
|
112
|
+
})
|
|
113
|
+
writeFileSync(hashesPath, JSON.stringify(hashes, null, 2) + '\n')
|
|
114
|
+
|
|
115
|
+
console.log('013 written. 001–012 untouched.')
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
* so a second implementation can reproduce byte-identical output.
|
|
12
12
|
*
|
|
13
13
|
* Usage: npm run build && node scripts/gen-test-vectors.mjs
|
|
14
|
+
*
|
|
15
|
+
* 001–009 are frozen. If they already exist, this script refuses to run —
|
|
16
|
+
* regenerating them would rewrite published 0.3 receipts. New 0.4 cases
|
|
17
|
+
* are produced by scripts/gen-test-vectors-04.mjs.
|
|
14
18
|
*/
|
|
15
19
|
import { mkdirSync, writeFileSync, existsSync, readFileSync } from 'fs'
|
|
16
20
|
import { join } from 'path'
|
|
@@ -19,6 +23,10 @@ import { generateKeyPair } from '../dist/keys.js'
|
|
|
19
23
|
import { buildReceipt, RECEIPT_GENESIS_HASH } from '../dist/receipt.js'
|
|
20
24
|
|
|
21
25
|
const ROOT = 'test-vectors'
|
|
26
|
+
if (existsSync(join(ROOT, '001-single-receipt', 'receipts.jsonl'))) {
|
|
27
|
+
console.error('001–009 are frozen. Refusing to regenerate. For 0.4 cases: node scripts/gen-test-vectors-04.mjs')
|
|
28
|
+
process.exit(2)
|
|
29
|
+
}
|
|
22
30
|
const KEY_DIR = join(ROOT, 'keys')
|
|
23
31
|
const KEY_ID = 'cnr-vectors'
|
|
24
32
|
const PRIV = join(KEY_DIR, 'vector-key.SECRET-TEST-ONLY.pem')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000010","ts":"2026-08-16T00:00:010.000Z","period":{"start":"2026-08-16T00:00:010.000Z","end":"2026-08-16T00:00:010.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":null,"source":"undeclared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"hash":"sha256:813b89d0684be97d866ae2c6f0e9902a25833c4f8921b694ccec17bf63d64d00","bytes":134,"source":"measured"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:a3dd969eea7eda0ae728cc994527e3f19f512d10ae655f85c58e8d5a31e25a88"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"yPnXtg/LMV9J/NzJ4AIdEAFfBms6alKxhZmyRti0IOCeslP679QlMo1WlSpQ9U9zVw3FN0IOhbE9OA/BAClRAA=="},"anchor":null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000011","ts":"2026-08-16T00:00:011.000Z","period":{"start":"2026-08-16T00:00:011.000Z","end":"2026-08-16T00:00:011.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":"openai/gpt-x","source":"operator-declared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"hash":null,"bytes":null,"source":"undeclared"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:7cdbfd0e131c1f5615c305f7908c136b19e25b7fbd96c7d48f0928f1df4c076e"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"FTpejMZCVHJVLLjxYr9CcAfv3+ozS7Mn+d59Xdc6To9cgGSKi13iGDk1JudvyJWgzR/2ElfzRuWNd5I3djPwCg=="},"anchor":null}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
{"v":"conarium-receipt/0.3","id":"01JVECTOR00000000000000001","ts":"2026-01-01T00:00:00.000Z","period":{"start":"2026-01-01T00:00:00.000Z","end":"2026-01-01T00:00:01.000Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"request":{"tool":"query","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fields":["id","name"]}],"policy":{"id":"conarium.policy/vectors","decision":"allow","rules":["mask:name"]},"flags":[],"masking":{"pii":1},"outcome":{"status":"complete","rows":2},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:dbbbd3139923cdf7f854283b495386526de0629a71dc4d5407a3a810ee3e1847"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"TVapCMZcuMJpg5IwxVmzU5MCH3c9qDZOTdyeW+HqCQ42tNzkEq1pnlVheI6KQoAZ+2BLYik69iEnFyXYydA9AQ=="},"anchor":null}
|
|
2
|
+
{"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000012","ts":"2026-08-16T00:00:012.000Z","period":{"start":"2026-08-16T00:00:012.000Z","end":"2026-08-16T00:00:012.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":"openai/gpt-x","source":"operator-declared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"hash":"sha256:813b89d0684be97d866ae2c6f0e9902a25833c4f8921b694ccec17bf63d64d00","bytes":134,"source":"measured"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":2,"prevHash":"sha256:dbbbd3139923cdf7f854283b495386526de0629a71dc4d5407a3a810ee3e1847","hash":"sha256:d34aba9928377dc233a90d8cb10c566ad0d35d0a05ef9e396a066e1b689426ee"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"fTIx4hUO0yCCGn+JgRw1ADWIYUZK3d9o3ZrbyCG/gX/NuFsOTR1/mBZQPWYq0ZVq/70794p+1P2SBbfMZxrBAA=="},"anchor":null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000013","ts":"2026-08-16T00:00:013.000Z","period":{"start":"2026-08-16T00:00:013.000Z","end":"2026-08-16T00:00:013.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":null,"source":"undeclared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"source":"undeclared"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:4c26d350a17659a4e1501a1c45e21dddae9833ffbc8bd8d335a6aa090fe85d49"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"ZcnAeriEleiUJ2ZHnqIS819TEubdfyXaXAHhkP9fJXM/VlDhC04kkhlsIxf8eKj5QvVZAeRnXohY1d55U1oFAQ=="},"anchor":null}
|
package/test-vectors/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Conarium Receipt — conformance vectors
|
|
2
2
|
|
|
3
3
|
Frozen inputs and expected results for anyone implementing or checking a
|
|
4
|
-
Conarium Receipt verifier.
|
|
4
|
+
Conarium Receipt verifier. Thirteen cases, one public key, one manifest.
|
|
5
5
|
|
|
6
6
|
A specification that cannot be implemented from the document alone is a blog
|
|
7
7
|
post. These vectors are the difference.
|
|
@@ -41,6 +41,10 @@ exit code. Nothing else is required — no network, no server, no account.
|
|
|
41
41
|
| 007-schema-invalid | `policy` removed — not a receipt at all | 20 |
|
|
42
42
|
| 008-unsigned-no-pubkey | Unsigned receipt, no `--pubkey` given | 13 |
|
|
43
43
|
| 009-unsigned-but-pubkey-given | Unsigned receipt, signature demanded | 13 |
|
|
44
|
+
| 010-disclosure-commitment | 0.4 receipt, `disclosure` measured over the payload that left | 0 |
|
|
45
|
+
| 011-destination-declared | 0.4 receipt, destination `operator-declared` | 0 |
|
|
46
|
+
| 012-mixed-chain | One 0.3 receipt then one 0.4 receipt; the chain verifies | 0 |
|
|
47
|
+
| 013-disclosure-keys-omitted | 0.4 receipt, `disclosure` is `undeclared` but `hash`/`bytes` are omitted, not `null` | 20 |
|
|
44
48
|
|
|
45
49
|
Exit codes are the ones in [RECEIPT-SPEC.md](../docs/RECEIPT-SPEC.md); the
|
|
46
50
|
drift guard in `test/spec_exitcode_drift.mjs` keeps the two in sync.
|
|
@@ -83,10 +87,11 @@ thing an interoperable receipt actually requires. Sign it with your own key.
|
|
|
83
87
|
|
|
84
88
|
## Regenerating — read before you do
|
|
85
89
|
|
|
86
|
-
`scripts/gen-test-vectors.mjs` produced
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
`scripts/gen-test-vectors.mjs` produced 001–009. It now refuses to run if those
|
|
91
|
+
files exist. `scripts/gen-test-vectors-04.mjs` appended 010–012, then 013. Do
|
|
92
|
+
not run either to make a failing test pass. If a change to this repository
|
|
93
|
+
breaks a vector, the format changed, and that is the signal the vectors exist
|
|
94
|
+
to raise.
|
|
90
95
|
|
|
91
96
|
The frozen hash of case 001 is asserted separately in `test/vectors_run.mjs`
|
|
92
97
|
for exactly this reason.
|
|
@@ -19,6 +19,30 @@
|
|
|
19
19
|
"seq": 3,
|
|
20
20
|
"prevHash": "sha256:56937472179de1567fee9f0b863c7c5d16d8d6b7a8e613e9bf50fb321f82433c",
|
|
21
21
|
"hash": "sha256:a06a30c3fb4bdbd46bb9400da0815fb3a7007b703cc9cb41208be08413e254c7"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"case": "010-disclosure-commitment",
|
|
25
|
+
"seq": 1,
|
|
26
|
+
"prevHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
27
|
+
"hash": "sha256:a3dd969eea7eda0ae728cc994527e3f19f512d10ae655f85c58e8d5a31e25a88"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"case": "011-destination-declared",
|
|
31
|
+
"seq": 1,
|
|
32
|
+
"prevHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
33
|
+
"hash": "sha256:7cdbfd0e131c1f5615c305f7908c136b19e25b7fbd96c7d48f0928f1df4c076e"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"case": "012-mixed-chain",
|
|
37
|
+
"seq": 2,
|
|
38
|
+
"prevHash": "sha256:dbbbd3139923cdf7f854283b495386526de0629a71dc4d5407a3a810ee3e1847",
|
|
39
|
+
"hash": "sha256:d34aba9928377dc233a90d8cb10c566ad0d35d0a05ef9e396a066e1b689426ee"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"case": "013-disclosure-keys-omitted",
|
|
43
|
+
"seq": 1,
|
|
44
|
+
"prevHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
45
|
+
"hash": "sha256:4c26d350a17659a4e1501a1c45e21dddae9833ffbc8bd8d335a6aa090fe85d49"
|
|
22
46
|
}
|
|
23
47
|
]
|
|
24
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": "conarium-receipt",
|
|
3
|
-
"versionUnderTest": "conarium-receipt/0.
|
|
3
|
+
"versionUnderTest": "conarium-receipt/0.4",
|
|
4
4
|
"keyId": "cnr-vectors",
|
|
5
5
|
"publicKey": "keys/vector-key.pub.pem",
|
|
6
6
|
"note": "Frozen conformance vectors. Run each case through your verifier and compare the exit code. KEYS/ in args resolves to the keys/ directory at the root of test-vectors.",
|
|
@@ -90,6 +90,42 @@
|
|
|
90
90
|
"--pubkey",
|
|
91
91
|
"KEYS/vector-key.pub.pem"
|
|
92
92
|
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "010-disclosure-commitment",
|
|
96
|
+
"description": "0.4 receipt with a measured disclosure hash over the masked, row-capped payload. Verify exits 0.",
|
|
97
|
+
"exitCode": 0,
|
|
98
|
+
"args": [
|
|
99
|
+
"--pubkey",
|
|
100
|
+
"KEYS/vector-key.pub.pem"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "011-destination-declared",
|
|
105
|
+
"description": "0.4 receipt with destination declared by the operator. source is operator-declared, not verified.",
|
|
106
|
+
"exitCode": 0,
|
|
107
|
+
"args": [
|
|
108
|
+
"--pubkey",
|
|
109
|
+
"KEYS/vector-key.pub.pem"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "012-mixed-chain",
|
|
114
|
+
"description": "A 0.3 receipt followed by a 0.4 receipt. The chain verifies; old receipts are not rewritten.",
|
|
115
|
+
"exitCode": 0,
|
|
116
|
+
"args": [
|
|
117
|
+
"--pubkey",
|
|
118
|
+
"KEYS/vector-key.pub.pem"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "013-disclosure-keys-omitted",
|
|
123
|
+
"description": "0.4 receipt whose disclosure is undeclared but omits hash and bytes entirely. Absence is not explicit null; verify exits 20.",
|
|
124
|
+
"exitCode": 20,
|
|
125
|
+
"args": [
|
|
126
|
+
"--pubkey",
|
|
127
|
+
"KEYS/vector-key.pub.pem"
|
|
128
|
+
]
|
|
93
129
|
}
|
|
94
130
|
]
|
|
95
131
|
}
|