@peac/cli 0.10.0 → 0.10.9
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/README.md +78 -5
- package/dist/commands/conformance.d.ts +16 -0
- package/dist/commands/conformance.d.ts.map +1 -0
- package/dist/commands/conformance.js +301 -0
- package/dist/commands/conformance.js.map +1 -0
- package/dist/commands/samples.d.ts +17 -0
- package/dist/commands/samples.d.ts.map +1 -0
- package/dist/commands/samples.js +360 -0
- package/dist/commands/samples.js.map +1 -0
- package/dist/commands/workflow.d.ts +11 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +214 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/index.js +34 -11
- package/dist/index.js.map +1 -1
- package/dist/lib/conformance/digest.d.ts +64 -0
- package/dist/lib/conformance/digest.d.ts.map +1 -0
- package/dist/lib/conformance/digest.js +202 -0
- package/dist/lib/conformance/digest.js.map +1 -0
- package/dist/lib/conformance/index.d.ts +11 -0
- package/dist/lib/conformance/index.d.ts.map +1 -0
- package/dist/lib/conformance/index.js +30 -0
- package/dist/lib/conformance/index.js.map +1 -0
- package/dist/lib/conformance/manifest.d.ts +15 -0
- package/dist/lib/conformance/manifest.d.ts.map +1 -0
- package/dist/lib/conformance/manifest.js +66 -0
- package/dist/lib/conformance/manifest.js.map +1 -0
- package/dist/lib/conformance/profiles.d.ts +33 -0
- package/dist/lib/conformance/profiles.d.ts.map +1 -0
- package/dist/lib/conformance/profiles.js +138 -0
- package/dist/lib/conformance/profiles.js.map +1 -0
- package/dist/lib/conformance/types.d.ts +186 -0
- package/dist/lib/conformance/types.d.ts.map +1 -0
- package/dist/lib/conformance/types.js +8 -0
- package/dist/lib/conformance/types.js.map +1 -0
- package/dist/lib/conformance/validators.d.ts +27 -0
- package/dist/lib/conformance/validators.d.ts.map +1 -0
- package/dist/lib/conformance/validators.js +415 -0
- package/dist/lib/conformance/validators.js.map +1 -0
- package/dist/lib/conformance-runner.d.ts +29 -0
- package/dist/lib/conformance-runner.d.ts.map +1 -0
- package/dist/lib/conformance-runner.js +433 -0
- package/dist/lib/conformance-runner.js.map +1 -0
- package/dist/lib/samples-loader.d.ts +44 -0
- package/dist/lib/samples-loader.d.ts.map +1 -0
- package/dist/lib/samples-loader.js +311 -0
- package/dist/lib/samples-loader.js.map +1 -0
- package/dist/lib/version.d.ts +22 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +61 -0
- package/dist/lib/version.js.map +1 -0
- package/package.json +17 -8
package/dist/index.js
CHANGED
|
@@ -43,9 +43,16 @@ const protocol_1 = require("@peac/protocol");
|
|
|
43
43
|
const protocol_2 = require("@peac/protocol");
|
|
44
44
|
const crypto_1 = require("@peac/crypto");
|
|
45
45
|
const fs = __importStar(require("fs"));
|
|
46
|
-
const
|
|
46
|
+
const policy_js_1 = require("./commands/policy.js");
|
|
47
|
+
const conformance_js_1 = require("./commands/conformance.js");
|
|
48
|
+
const samples_js_1 = require("./commands/samples.js");
|
|
49
|
+
const version_js_1 = require("./lib/version.js");
|
|
47
50
|
const program = new commander_1.Command();
|
|
48
|
-
program
|
|
51
|
+
program
|
|
52
|
+
.name('peac')
|
|
53
|
+
.description('PEAC protocol command-line tools')
|
|
54
|
+
.version((0, version_js_1.getVersion)())
|
|
55
|
+
.exitOverride(); // Throws CommanderError instead of calling process.exit()
|
|
49
56
|
/**
|
|
50
57
|
* peac verify <jws>
|
|
51
58
|
*/
|
|
@@ -86,19 +93,19 @@ program
|
|
|
86
93
|
console.log(` JWKS fetch time: ${result.perf.jwks_fetch_ms.toFixed(2)}ms`);
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
|
-
process.
|
|
96
|
+
process.exitCode = 0;
|
|
90
97
|
}
|
|
91
98
|
else {
|
|
92
99
|
console.log(`Verification failed: ${result.reason}`);
|
|
93
100
|
if (result.details) {
|
|
94
101
|
console.log(` Details: ${result.details}`);
|
|
95
102
|
}
|
|
96
|
-
process.
|
|
103
|
+
process.exitCode = 1;
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
106
|
catch (err) {
|
|
100
107
|
console.error('Error:', err instanceof Error ? err.message : String(err));
|
|
101
|
-
process.
|
|
108
|
+
process.exitCode = 1;
|
|
102
109
|
}
|
|
103
110
|
});
|
|
104
111
|
/**
|
|
@@ -144,11 +151,11 @@ program
|
|
|
144
151
|
if (config.security_contact) {
|
|
145
152
|
console.log(` Security: ${config.security_contact}`);
|
|
146
153
|
}
|
|
147
|
-
process.
|
|
154
|
+
process.exitCode = 0;
|
|
148
155
|
}
|
|
149
156
|
catch (err) {
|
|
150
157
|
console.error('Error:', err instanceof Error ? err.message : String(err));
|
|
151
|
-
process.
|
|
158
|
+
process.exitCode = 1;
|
|
152
159
|
}
|
|
153
160
|
});
|
|
154
161
|
/**
|
|
@@ -204,14 +211,30 @@ program
|
|
|
204
211
|
console.log(JSON.stringify(payload.ext, null, 2));
|
|
205
212
|
}
|
|
206
213
|
}
|
|
207
|
-
process.
|
|
214
|
+
process.exitCode = 0;
|
|
208
215
|
}
|
|
209
216
|
catch (err) {
|
|
210
217
|
console.error('Error:', err instanceof Error ? err.message : String(err));
|
|
211
|
-
process.
|
|
218
|
+
process.exitCode = 1;
|
|
212
219
|
}
|
|
213
220
|
});
|
|
214
221
|
// Policy commands (v0.9.17+)
|
|
215
|
-
program.addCommand(
|
|
216
|
-
|
|
222
|
+
program.addCommand(policy_js_1.policy);
|
|
223
|
+
// Conformance testing commands (v0.10.8+)
|
|
224
|
+
program.addCommand(conformance_js_1.conformance);
|
|
225
|
+
// Sample receipts commands (v0.10.8+)
|
|
226
|
+
program.addCommand(samples_js_1.samples);
|
|
227
|
+
// Parse and handle Commander errors (exitOverride causes CommanderError on --help, --version, etc.)
|
|
228
|
+
try {
|
|
229
|
+
program.parse();
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
if (err instanceof commander_1.CommanderError) {
|
|
233
|
+
// CommanderError from --help, --version, or validation errors
|
|
234
|
+
process.exitCode = err.exitCode;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
throw err;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
217
240
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoD;AACpD,6CAA+C;AAC/C,6CAAsE;AACtE,yCAAsC;AAEtC,uCAAyB;AACzB,oDAA8C;AAC9C,8DAAwD;AACxD,sDAAgD;AAChD,iDAA8C;AAE9C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,kCAAkC,CAAC;KAC/C,OAAO,CAAC,IAAA,uBAAU,GAAE,CAAC;KACrB,YAAY,EAAE,CAAC,CAAC,0DAA0D;AAE7E;;GAEG;AACH,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,2BAA2B,CAAC;KACxC,QAAQ,CAAC,OAAO,EAAE,0DAA0D,CAAC;KAC7E,MAAM,CAAC,eAAe,EAAE,sBAAsB,CAAC;KAC/C,MAAM,CAAC,KAAK,EAAE,QAAgB,EAAE,OAA8B,EAAE,EAAE;IACjE,IAAI,CAAC;QACH,gCAAgC;QAChC,IAAI,GAAG,GAAG,QAAQ,CAAC;QACnB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IA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AAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,6BAA6B;AAC7B,OAAO,CAAC,UAAU,CAAC,kBAAM,CAAC,CAAC;AAE3B,0CAA0C;AAC1C,OAAO,CAAC,UAAU,CAAC,4BAAW,CAAC,CAAC;AAEhC,sCAAsC;AACtC,OAAO,CAAC,UAAU,CAAC,oBAAO,CAAC,CAAC;AAE5B,oGAAoG;AACpG,IAAI,CAAC;IACH,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,IAAI,GAAG,YAAY,0BAAc,EAAE,CAAC;QAClC,8DAA8D;QAC9D,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance Digest Computation
|
|
3
|
+
*
|
|
4
|
+
* Handles SHA-256 hashing, JCS canonicalization, and vectors digest computation.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Compute SHA-256 digest of a string
|
|
8
|
+
*/
|
|
9
|
+
export declare function sha256(content: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert Zod path array to JSON Pointer (RFC 6901)
|
|
12
|
+
*
|
|
13
|
+
* @param path - Array of path segments from Zod (string for keys, number for array indices)
|
|
14
|
+
* @returns JSON Pointer string (e.g., "/evidence/attestations/0/scope")
|
|
15
|
+
*/
|
|
16
|
+
export declare function zodPathToJsonPointer(path: (string | number)[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* Compute canonical input digest using JCS (RFC 8785)
|
|
19
|
+
*
|
|
20
|
+
* Uses JSON Canonicalization Scheme for deterministic serialization,
|
|
21
|
+
* ensuring consistent digests across implementations regardless of
|
|
22
|
+
* JSON key ordering from JSON.parse.
|
|
23
|
+
*
|
|
24
|
+
* @returns Object with alg and value (alg differs if fallback was used)
|
|
25
|
+
*/
|
|
26
|
+
export declare function computeCanonicalDigest(input: unknown): {
|
|
27
|
+
alg: string;
|
|
28
|
+
value: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Compute comprehensive vectors digest by hashing all fixture files
|
|
32
|
+
*
|
|
33
|
+
* VECTORS DIGEST CONTRACT (NORMATIVE):
|
|
34
|
+
* ====================================
|
|
35
|
+
*
|
|
36
|
+
* 1. FILE SELECTION:
|
|
37
|
+
* - INCLUDES: manifest.json (if present) at root level
|
|
38
|
+
* - INCLUDES: All files in category directories with extensions: .json, .txt, .jwks, .pem, .zip
|
|
39
|
+
* - EXCLUDES: .DS_Store, .gitkeep, Thumbs.db
|
|
40
|
+
*
|
|
41
|
+
* 2. RECURSION:
|
|
42
|
+
* - Hashes files in nested directories (e.g., bundle/vectors/*.json)
|
|
43
|
+
*
|
|
44
|
+
* 3. ORDERING:
|
|
45
|
+
* - All files sorted lexicographically by normalized relative path
|
|
46
|
+
* - Path separator is always forward slash (/)
|
|
47
|
+
* - Comparison uses default string comparison (ASCII/Unicode code point order)
|
|
48
|
+
*
|
|
49
|
+
* 4. HASH INPUT FORMAT (per file):
|
|
50
|
+
* - relativePath + NUL byte (\x00) + sha256(fileBytes)
|
|
51
|
+
* - relativePath uses forward slashes, no leading slash
|
|
52
|
+
* - fileBytes are raw bytes, NO newline normalization
|
|
53
|
+
*
|
|
54
|
+
* 5. FINAL DIGEST:
|
|
55
|
+
* - SHA-256 of all concatenated (path + NUL + hash) entries
|
|
56
|
+
* - Reported as lowercase hex string
|
|
57
|
+
*
|
|
58
|
+
* This contract ensures:
|
|
59
|
+
* - Digest changes when any fixture content changes
|
|
60
|
+
* - Digest is reproducible across platforms
|
|
61
|
+
* - Digest can be verified by other implementations
|
|
62
|
+
*/
|
|
63
|
+
export declare function computeVectorsDigest(fixturesDir: string, categories: string[]): string;
|
|
64
|
+
//# sourceMappingURL=digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../src/lib/conformance/digest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAatE;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CASrF;AAyDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAmCtF"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Conformance Digest Computation
|
|
4
|
+
*
|
|
5
|
+
* Handles SHA-256 hashing, JCS canonicalization, and vectors digest computation.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.sha256 = sha256;
|
|
42
|
+
exports.zodPathToJsonPointer = zodPathToJsonPointer;
|
|
43
|
+
exports.computeCanonicalDigest = computeCanonicalDigest;
|
|
44
|
+
exports.computeVectorsDigest = computeVectorsDigest;
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const crypto_1 = require("crypto");
|
|
48
|
+
const crypto_2 = require("@peac/crypto");
|
|
49
|
+
/**
|
|
50
|
+
* Compute SHA-256 digest of a string
|
|
51
|
+
*/
|
|
52
|
+
function sha256(content) {
|
|
53
|
+
return (0, crypto_1.createHash)('sha256').update(content, 'utf8').digest('hex');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Convert Zod path array to JSON Pointer (RFC 6901)
|
|
57
|
+
*
|
|
58
|
+
* @param path - Array of path segments from Zod (string for keys, number for array indices)
|
|
59
|
+
* @returns JSON Pointer string (e.g., "/evidence/attestations/0/scope")
|
|
60
|
+
*/
|
|
61
|
+
function zodPathToJsonPointer(path) {
|
|
62
|
+
if (path.length === 0)
|
|
63
|
+
return '';
|
|
64
|
+
return ('/' +
|
|
65
|
+
path
|
|
66
|
+
.map((segment) => {
|
|
67
|
+
const str = String(segment);
|
|
68
|
+
// RFC 6901 escaping: ~ -> ~0, / -> ~1
|
|
69
|
+
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
70
|
+
})
|
|
71
|
+
.join('/'));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Compute canonical input digest using JCS (RFC 8785)
|
|
75
|
+
*
|
|
76
|
+
* Uses JSON Canonicalization Scheme for deterministic serialization,
|
|
77
|
+
* ensuring consistent digests across implementations regardless of
|
|
78
|
+
* JSON key ordering from JSON.parse.
|
|
79
|
+
*
|
|
80
|
+
* @returns Object with alg and value (alg differs if fallback was used)
|
|
81
|
+
*/
|
|
82
|
+
function computeCanonicalDigest(input) {
|
|
83
|
+
try {
|
|
84
|
+
const canonical = (0, crypto_2.canonicalize)(input);
|
|
85
|
+
return { alg: 'sha-256+jcs', value: sha256(canonical) };
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Fallback to JSON.stringify if canonicalize fails (e.g., for non-JSON values)
|
|
89
|
+
// Use different alg to indicate fallback was used
|
|
90
|
+
return { alg: 'sha-256+json', value: sha256(JSON.stringify(input)) };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* File extensions to include in vectors digest
|
|
95
|
+
*
|
|
96
|
+
* This allowlist ensures we capture all conformance-relevant files:
|
|
97
|
+
* - .json: Fixtures, manifests, JWKS
|
|
98
|
+
* - .txt: Policy files (peac.txt)
|
|
99
|
+
* - .jwks: JWKS key files
|
|
100
|
+
* - .pem: PEM-encoded keys
|
|
101
|
+
* - .zip: Bundle archives (if used)
|
|
102
|
+
*/
|
|
103
|
+
const VECTORS_FILE_EXTENSIONS = new Set(['.json', '.txt', '.jwks', '.pem', '.zip']);
|
|
104
|
+
/**
|
|
105
|
+
* Files to exclude from vectors digest
|
|
106
|
+
*/
|
|
107
|
+
const VECTORS_EXCLUDE_FILES = new Set(['.DS_Store', '.gitkeep', 'Thumbs.db']);
|
|
108
|
+
/**
|
|
109
|
+
* Recursively collect all conformance-relevant files in a directory
|
|
110
|
+
*/
|
|
111
|
+
function collectFilesRecursive(dir, basePath = '') {
|
|
112
|
+
const files = [];
|
|
113
|
+
if (!fs.existsSync(dir))
|
|
114
|
+
return files;
|
|
115
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
116
|
+
for (const entry of entries) {
|
|
117
|
+
// Skip excluded files
|
|
118
|
+
if (VECTORS_EXCLUDE_FILES.has(entry.name))
|
|
119
|
+
continue;
|
|
120
|
+
const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name;
|
|
121
|
+
const fullPath = path.join(dir, entry.name);
|
|
122
|
+
if (entry.isDirectory()) {
|
|
123
|
+
// Recurse into subdirectories
|
|
124
|
+
files.push(...collectFilesRecursive(fullPath, relativePath));
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Check if extension is in allowlist
|
|
128
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
129
|
+
if (VECTORS_FILE_EXTENSIONS.has(ext)) {
|
|
130
|
+
files.push({
|
|
131
|
+
relativePath,
|
|
132
|
+
content: fs.readFileSync(fullPath, 'utf8'),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return files;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Compute comprehensive vectors digest by hashing all fixture files
|
|
141
|
+
*
|
|
142
|
+
* VECTORS DIGEST CONTRACT (NORMATIVE):
|
|
143
|
+
* ====================================
|
|
144
|
+
*
|
|
145
|
+
* 1. FILE SELECTION:
|
|
146
|
+
* - INCLUDES: manifest.json (if present) at root level
|
|
147
|
+
* - INCLUDES: All files in category directories with extensions: .json, .txt, .jwks, .pem, .zip
|
|
148
|
+
* - EXCLUDES: .DS_Store, .gitkeep, Thumbs.db
|
|
149
|
+
*
|
|
150
|
+
* 2. RECURSION:
|
|
151
|
+
* - Hashes files in nested directories (e.g., bundle/vectors/*.json)
|
|
152
|
+
*
|
|
153
|
+
* 3. ORDERING:
|
|
154
|
+
* - All files sorted lexicographically by normalized relative path
|
|
155
|
+
* - Path separator is always forward slash (/)
|
|
156
|
+
* - Comparison uses default string comparison (ASCII/Unicode code point order)
|
|
157
|
+
*
|
|
158
|
+
* 4. HASH INPUT FORMAT (per file):
|
|
159
|
+
* - relativePath + NUL byte (\x00) + sha256(fileBytes)
|
|
160
|
+
* - relativePath uses forward slashes, no leading slash
|
|
161
|
+
* - fileBytes are raw bytes, NO newline normalization
|
|
162
|
+
*
|
|
163
|
+
* 5. FINAL DIGEST:
|
|
164
|
+
* - SHA-256 of all concatenated (path + NUL + hash) entries
|
|
165
|
+
* - Reported as lowercase hex string
|
|
166
|
+
*
|
|
167
|
+
* This contract ensures:
|
|
168
|
+
* - Digest changes when any fixture content changes
|
|
169
|
+
* - Digest is reproducible across platforms
|
|
170
|
+
* - Digest can be verified by other implementations
|
|
171
|
+
*/
|
|
172
|
+
function computeVectorsDigest(fixturesDir, categories) {
|
|
173
|
+
const hash = (0, crypto_1.createHash)('sha256');
|
|
174
|
+
const allFiles = [];
|
|
175
|
+
// Include manifest.json if present (it's part of the conformance vectors)
|
|
176
|
+
const manifestPath = path.join(fixturesDir, 'manifest.json');
|
|
177
|
+
if (fs.existsSync(manifestPath)) {
|
|
178
|
+
allFiles.push({
|
|
179
|
+
relativePath: 'manifest.json',
|
|
180
|
+
content: fs.readFileSync(manifestPath, 'utf8'),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
// Sort categories for determinism
|
|
184
|
+
const sortedCategories = [...categories].sort();
|
|
185
|
+
for (const cat of sortedCategories) {
|
|
186
|
+
const categoryPath = path.join(fixturesDir, cat);
|
|
187
|
+
// Recursively collect all conformance-relevant files in the category
|
|
188
|
+
const categoryFiles = collectFilesRecursive(categoryPath, cat);
|
|
189
|
+
allFiles.push(...categoryFiles);
|
|
190
|
+
}
|
|
191
|
+
// Sort all files by relative path for deterministic ordering
|
|
192
|
+
allFiles.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
193
|
+
for (const file of allFiles) {
|
|
194
|
+
const fileHash = sha256(file.content);
|
|
195
|
+
// Hash: relativePath + NUL + fileHash
|
|
196
|
+
hash.update(file.relativePath);
|
|
197
|
+
hash.update('\0');
|
|
198
|
+
hash.update(fileHash);
|
|
199
|
+
}
|
|
200
|
+
return hash.digest('hex');
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=digest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.js","sourceRoot":"","sources":["../../../src/lib/conformance/digest.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUH,wBAEC;AAQD,oDAaC;AAWD,wDASC;AA0FD,oDAmCC;AAhLD,uCAAyB;AACzB,2CAA6B;AAC7B,mCAAoC;AACpC,yCAA4C;AAE5C;;GAEG;AACH,SAAgB,MAAM,CAAC,OAAe;IACpC,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,IAAyB;IAC5D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjC,OAAO,CACL,GAAG;QACH,IAAI;aACD,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YACf,M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agnostics, TestResult, ProfileLevel, ProfileDetail, ConformanceReport, RunnerOptions, RunnerCallbacks, ValidationResult, ValidationResultWithPath, FixturePack, SingleFixture, ManifestEntry, Manifest, CategoryValidator, } from './types.js';
|
|
7
|
+
export { loadManifest, getManifestEntry } from './manifest.js';
|
|
8
|
+
export { sha256, zodPathToJsonPointer, computeCanonicalDigest, computeVectorsDigest, } from './digest.js';
|
|
9
|
+
export { PROFILE_CAPABILITIES, getCategoryCapability, getCategoryProfile, shouldRunAtLevel, } from './profiles.js';
|
|
10
|
+
export { validateReceiptPayload, CATEGORY_VALIDATORS, getValidator } from './validators.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/conformance/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,aAAa,EACb,aAAa,EACb,QAAQ,EACR,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG/D,OAAO,EACL,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Conformance Runner Module
|
|
4
|
+
*
|
|
5
|
+
* Re-exports all conformance testing functionality.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getValidator = exports.CATEGORY_VALIDATORS = exports.validateReceiptPayload = exports.shouldRunAtLevel = exports.getCategoryProfile = exports.getCategoryCapability = exports.PROFILE_CAPABILITIES = exports.computeVectorsDigest = exports.computeCanonicalDigest = exports.zodPathToJsonPointer = exports.sha256 = exports.getManifestEntry = exports.loadManifest = void 0;
|
|
9
|
+
// Manifest loading
|
|
10
|
+
var manifest_js_1 = require("./manifest.js");
|
|
11
|
+
Object.defineProperty(exports, "loadManifest", { enumerable: true, get: function () { return manifest_js_1.loadManifest; } });
|
|
12
|
+
Object.defineProperty(exports, "getManifestEntry", { enumerable: true, get: function () { return manifest_js_1.getManifestEntry; } });
|
|
13
|
+
// Digest computation
|
|
14
|
+
var digest_js_1 = require("./digest.js");
|
|
15
|
+
Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return digest_js_1.sha256; } });
|
|
16
|
+
Object.defineProperty(exports, "zodPathToJsonPointer", { enumerable: true, get: function () { return digest_js_1.zodPathToJsonPointer; } });
|
|
17
|
+
Object.defineProperty(exports, "computeCanonicalDigest", { enumerable: true, get: function () { return digest_js_1.computeCanonicalDigest; } });
|
|
18
|
+
Object.defineProperty(exports, "computeVectorsDigest", { enumerable: true, get: function () { return digest_js_1.computeVectorsDigest; } });
|
|
19
|
+
// Profile capabilities
|
|
20
|
+
var profiles_js_1 = require("./profiles.js");
|
|
21
|
+
Object.defineProperty(exports, "PROFILE_CAPABILITIES", { enumerable: true, get: function () { return profiles_js_1.PROFILE_CAPABILITIES; } });
|
|
22
|
+
Object.defineProperty(exports, "getCategoryCapability", { enumerable: true, get: function () { return profiles_js_1.getCategoryCapability; } });
|
|
23
|
+
Object.defineProperty(exports, "getCategoryProfile", { enumerable: true, get: function () { return profiles_js_1.getCategoryProfile; } });
|
|
24
|
+
Object.defineProperty(exports, "shouldRunAtLevel", { enumerable: true, get: function () { return profiles_js_1.shouldRunAtLevel; } });
|
|
25
|
+
// Validators
|
|
26
|
+
var validators_js_1 = require("./validators.js");
|
|
27
|
+
Object.defineProperty(exports, "validateReceiptPayload", { enumerable: true, get: function () { return validators_js_1.validateReceiptPayload; } });
|
|
28
|
+
Object.defineProperty(exports, "CATEGORY_VALIDATORS", { enumerable: true, get: function () { return validators_js_1.CATEGORY_VALIDATORS; } });
|
|
29
|
+
Object.defineProperty(exports, "getValidator", { enumerable: true, get: function () { return validators_js_1.getValidator; } });
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/conformance/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAsBH,mBAAmB;AACnB,6CAA+D;AAAtD,2GAAA,YAAY,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAEvC,qBAAqB;AACrB,yCAKqB;AAJnB,mGAAA,MAAM,OAAA;AACN,iHAAA,oBAAoB,OAAA;AACpB,mHAAA,sBAAsB,OAAA;AACtB,iHAAA,oBAAoB,OAAA;AAGtB,uBAAuB;AACvB,6CAKuB;AAJrB,mHAAA,oBAAoB,OAAA;AACpB,oHAAA,qBAAqB,OAAA;AACrB,iHAAA,kBAAkB,OAAA;AAClB,+GAAA,gBAAgB,OAAA;AAGlB,aAAa;AACb,iDAA4F;AAAnF,uHAAA,sBAAsB,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAAE,6GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance Manifest Loading and Matching
|
|
3
|
+
*
|
|
4
|
+
* Handles loading manifest.json and retrieving fixture metadata.
|
|
5
|
+
*/
|
|
6
|
+
import type { Manifest, ManifestEntry } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Load manifest.json from fixtures directory
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadManifest(fixturesDir: string): Manifest;
|
|
11
|
+
/**
|
|
12
|
+
* Get manifest entry for a fixture
|
|
13
|
+
*/
|
|
14
|
+
export declare function getManifestEntry(manifest: Manifest, category: string, filename: string): ManifestEntry | undefined;
|
|
15
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/lib/conformance/manifest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1D;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAU1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,aAAa,GAAG,SAAS,CAE3B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Conformance Manifest Loading and Matching
|
|
4
|
+
*
|
|
5
|
+
* Handles loading manifest.json and retrieving fixture metadata.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.loadManifest = loadManifest;
|
|
42
|
+
exports.getManifestEntry = getManifestEntry;
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
/**
|
|
46
|
+
* Load manifest.json from fixtures directory
|
|
47
|
+
*/
|
|
48
|
+
function loadManifest(fixturesDir) {
|
|
49
|
+
const manifestPath = path.join(fixturesDir, 'manifest.json');
|
|
50
|
+
if (!fs.existsSync(manifestPath)) {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get manifest entry for a fixture
|
|
62
|
+
*/
|
|
63
|
+
function getManifestEntry(manifest, category, filename) {
|
|
64
|
+
return manifest[category]?.[filename];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/lib/conformance/manifest.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASH,oCAUC;AAKD,4CAMC;AA5BD,uCAAyB;AACzB,2CAA6B;AAG7B;;GAEG;AACH,SAAgB,YAAY,CAAC,WAAmB;IAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC7D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,QAAkB,EAClB,QAAgB,EAChB,QAAgB;IAEhB,OAAO,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance Profile Capabilities
|
|
3
|
+
*
|
|
4
|
+
* Maps categories to their profile details for capabilities reporting.
|
|
5
|
+
*/
|
|
6
|
+
import type { ProfileDetail, ConformanceLevel } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Profile capability registry
|
|
9
|
+
*
|
|
10
|
+
* Maps categories to their profile details including:
|
|
11
|
+
* - profile: The profile name for the report
|
|
12
|
+
* - level: 'semantic' for full validation, 'shape' for structural-only
|
|
13
|
+
* - validator: The validator used (for transparency)
|
|
14
|
+
* - notes: Any caveats about validation scope
|
|
15
|
+
*/
|
|
16
|
+
export declare const PROFILE_CAPABILITIES: Record<string, ProfileDetail>;
|
|
17
|
+
/**
|
|
18
|
+
* Get profile capability for a category
|
|
19
|
+
*
|
|
20
|
+
* For unknown categories, honestly reports that the default validator uses
|
|
21
|
+
* heuristic semantic receipt validation (ReceiptClaimsSchema) when input
|
|
22
|
+
* looks like claims. This prevents capability misrepresentation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCategoryCapability(category: string): ProfileDetail;
|
|
25
|
+
/**
|
|
26
|
+
* Get profile name based on category
|
|
27
|
+
*/
|
|
28
|
+
export declare function getCategoryProfile(category: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Determine if a fixture should run at a given level
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldRunAtLevel(fixtureVersion: string | undefined, level: ConformanceLevel): boolean;
|
|
33
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/lib/conformance/profiles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAoF9D,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CASrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAST"}
|