@peac/cli 0.10.9 → 0.10.10
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/LICENSE +1 -1
- package/dist/index.cjs +2257 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +2236 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +21 -16
- package/dist/cli.js +0 -90
- package/dist/cli.js.map +0 -1
- package/dist/commands/bridge/index.js +0 -20
- package/dist/commands/bridge/index.js.map +0 -1
- package/dist/commands/bridge/install.js +0 -27
- package/dist/commands/bridge/install.js.map +0 -1
- package/dist/commands/bridge/start.js +0 -123
- package/dist/commands/bridge/start.js.map +0 -1
- package/dist/commands/bridge/status.js +0 -192
- package/dist/commands/bridge/status.js.map +0 -1
- package/dist/commands/bridge/stop.js +0 -130
- package/dist/commands/bridge/stop.js.map +0 -1
- package/dist/commands/bundle.js +0 -363
- package/dist/commands/bundle.js.map +0 -1
- package/dist/commands/conformance.js +0 -301
- package/dist/commands/conformance.js.map +0 -1
- package/dist/commands/discover.js +0 -39
- package/dist/commands/discover.js.map +0 -1
- package/dist/commands/hash.js +0 -106
- package/dist/commands/hash.js.map +0 -1
- package/dist/commands/policy.js +0 -712
- package/dist/commands/policy.js.map +0 -1
- package/dist/commands/samples.js +0 -360
- package/dist/commands/samples.js.map +0 -1
- package/dist/commands/verify.js +0 -50
- package/dist/commands/verify.js.map +0 -1
- package/dist/commands/workflow.d.ts +0 -11
- package/dist/commands/workflow.d.ts.map +0 -1
- package/dist/commands/workflow.js +0 -214
- package/dist/commands/workflow.js.map +0 -1
- package/dist/index.js +0 -240
- package/dist/index.js.map +0 -1
- package/dist/lib/conformance/digest.js +0 -202
- package/dist/lib/conformance/digest.js.map +0 -1
- package/dist/lib/conformance/index.js +0 -30
- package/dist/lib/conformance/index.js.map +0 -1
- package/dist/lib/conformance/manifest.js +0 -66
- package/dist/lib/conformance/manifest.js.map +0 -1
- package/dist/lib/conformance/profiles.js +0 -138
- package/dist/lib/conformance/profiles.js.map +0 -1
- package/dist/lib/conformance/types.js +0 -8
- package/dist/lib/conformance/types.js.map +0 -1
- package/dist/lib/conformance/validators.js +0 -415
- package/dist/lib/conformance/validators.js.map +0 -1
- package/dist/lib/conformance-runner.js +0 -433
- package/dist/lib/conformance-runner.js.map +0 -1
- package/dist/lib/samples-loader.js +0 -311
- package/dist/lib/samples-loader.js.map +0 -1
- package/dist/lib/version.js +0 -61
- package/dist/lib/version.js.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/utils.js +0 -101
- package/dist/utils.js.map +0 -1
|
@@ -1,202 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5B,sCAAsC;YACtC,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,KAAc;IACnD,IAAI,CAAC;QACH,MAAM,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AG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACjD,qEAAqE;QACrE,MAAM,aAAa,GAAG,qBAAqB,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAC/D,QAAQ,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;IAClC,CAAC;IAED,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtE,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,sCAAsC;QACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Conformance Profile Capabilities
|
|
4
|
-
*
|
|
5
|
-
* Maps categories to their profile details for capabilities reporting.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.PROFILE_CAPABILITIES = void 0;
|
|
9
|
-
exports.getCategoryCapability = getCategoryCapability;
|
|
10
|
-
exports.getCategoryProfile = getCategoryProfile;
|
|
11
|
-
exports.shouldRunAtLevel = shouldRunAtLevel;
|
|
12
|
-
/**
|
|
13
|
-
* Profile capability registry
|
|
14
|
-
*
|
|
15
|
-
* Maps categories to their profile details including:
|
|
16
|
-
* - profile: The profile name for the report
|
|
17
|
-
* - level: 'semantic' for full validation, 'shape' for structural-only
|
|
18
|
-
* - validator: The validator used (for transparency)
|
|
19
|
-
* - notes: Any caveats about validation scope
|
|
20
|
-
*/
|
|
21
|
-
exports.PROFILE_CAPABILITIES = {
|
|
22
|
-
valid: {
|
|
23
|
-
profile: 'receipt.verify.claims',
|
|
24
|
-
level: 'semantic',
|
|
25
|
-
validator: '@peac/schema:ReceiptClaimsSchema',
|
|
26
|
-
},
|
|
27
|
-
invalid: {
|
|
28
|
-
profile: 'receipt.verify.claims',
|
|
29
|
-
level: 'semantic',
|
|
30
|
-
validator: '@peac/schema:ReceiptClaimsSchema',
|
|
31
|
-
},
|
|
32
|
-
edge: {
|
|
33
|
-
profile: 'receipt.verify.claims',
|
|
34
|
-
level: 'semantic',
|
|
35
|
-
validator: '@peac/schema:ReceiptClaimsSchema',
|
|
36
|
-
},
|
|
37
|
-
'agent-identity': {
|
|
38
|
-
profile: 'receipt.verify.agent-identity',
|
|
39
|
-
level: 'semantic',
|
|
40
|
-
validator: '@peac/schema:validateAgentIdentityAttestation',
|
|
41
|
-
},
|
|
42
|
-
attribution: {
|
|
43
|
-
profile: 'receipt.verify.attribution',
|
|
44
|
-
level: 'semantic',
|
|
45
|
-
validator: '@peac/schema:validateAttributionAttestation',
|
|
46
|
-
},
|
|
47
|
-
bundle: {
|
|
48
|
-
profile: 'bundle.shape',
|
|
49
|
-
level: 'shape',
|
|
50
|
-
validator: 'structural-check',
|
|
51
|
-
notes: 'Structure-only; no cryptographic integrity verification',
|
|
52
|
-
},
|
|
53
|
-
discovery: {
|
|
54
|
-
profile: 'discovery.config',
|
|
55
|
-
level: 'semantic',
|
|
56
|
-
validator: '@peac/disc:parse',
|
|
57
|
-
},
|
|
58
|
-
dispute: {
|
|
59
|
-
profile: 'receipt.verify.dispute',
|
|
60
|
-
level: 'semantic',
|
|
61
|
-
validator: '@peac/schema:validateDisputeAttestation',
|
|
62
|
-
},
|
|
63
|
-
interaction: {
|
|
64
|
-
profile: 'receipt.verify.interaction',
|
|
65
|
-
level: 'semantic',
|
|
66
|
-
validator: '@peac/schema:validateInteractionOrdered',
|
|
67
|
-
},
|
|
68
|
-
issue: {
|
|
69
|
-
profile: 'receipt.issue',
|
|
70
|
-
level: 'semantic',
|
|
71
|
-
validator: '@peac/schema:ReceiptClaimsSchema',
|
|
72
|
-
},
|
|
73
|
-
obligations: {
|
|
74
|
-
profile: 'receipt.verify.obligations',
|
|
75
|
-
level: 'semantic',
|
|
76
|
-
validator: '@peac/schema:validateObligationsExtension',
|
|
77
|
-
},
|
|
78
|
-
policy: {
|
|
79
|
-
profile: 'policy.evaluate',
|
|
80
|
-
level: 'shape',
|
|
81
|
-
validator: 'structural-check',
|
|
82
|
-
notes: 'Structure-only; no policy evaluation logic',
|
|
83
|
-
},
|
|
84
|
-
purpose: {
|
|
85
|
-
profile: 'receipt.verify.purpose',
|
|
86
|
-
level: 'semantic',
|
|
87
|
-
validator: '@peac/schema:isValidPurposeToken',
|
|
88
|
-
},
|
|
89
|
-
verifier: {
|
|
90
|
-
profile: 'receipt.verify',
|
|
91
|
-
level: 'semantic',
|
|
92
|
-
validator: '@peac/schema:ReceiptClaimsSchema',
|
|
93
|
-
},
|
|
94
|
-
workflow: {
|
|
95
|
-
profile: 'workflow.validate',
|
|
96
|
-
level: 'semantic',
|
|
97
|
-
validator: '@peac/schema:validateWorkflowContextOrdered',
|
|
98
|
-
},
|
|
99
|
-
x402: {
|
|
100
|
-
profile: 'transport.x402.shape',
|
|
101
|
-
level: 'shape',
|
|
102
|
-
validator: 'structural-check',
|
|
103
|
-
notes: 'Structure-only; no offer/receipt verification or term matching',
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Get profile capability for a category
|
|
108
|
-
*
|
|
109
|
-
* For unknown categories, honestly reports that the default validator uses
|
|
110
|
-
* heuristic semantic receipt validation (ReceiptClaimsSchema) when input
|
|
111
|
-
* looks like claims. This prevents capability misrepresentation.
|
|
112
|
-
*/
|
|
113
|
-
function getCategoryCapability(category) {
|
|
114
|
-
return (exports.PROFILE_CAPABILITIES[category] ?? {
|
|
115
|
-
profile: `receipt.verify.${category}`,
|
|
116
|
-
level: 'semantic',
|
|
117
|
-
validator: '@peac/schema:ReceiptClaimsSchema (heuristic)',
|
|
118
|
-
notes: 'Unknown category - uses semantic receipt validation when input looks like claims',
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Get profile name based on category
|
|
123
|
-
*/
|
|
124
|
-
function getCategoryProfile(category) {
|
|
125
|
-
return getCategoryCapability(category).profile;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Determine if a fixture should run at a given level
|
|
129
|
-
*/
|
|
130
|
-
function shouldRunAtLevel(fixtureVersion, level) {
|
|
131
|
-
if (!fixtureVersion)
|
|
132
|
-
return true; // Default to basic
|
|
133
|
-
const [major, minor] = fixtureVersion.split('.').map(Number);
|
|
134
|
-
const fixtureLevel = major > 0 || minor >= 10 ? 'full' : minor >= 9 ? 'standard' : 'basic';
|
|
135
|
-
const levelOrder = ['basic', 'standard', 'full'];
|
|
136
|
-
return levelOrder.indexOf(fixtureLevel) <= levelOrder.indexOf(level);
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=profiles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/lib/conformance/profiles.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA0GH,sDASC;AAKD,gDAEC;AAKD,4CAYC;AAvID;;;;;;;;GAQG;AACU,QAAA,oBAAoB,GAAkC;IACjE,KAAK,EAAE;QACL,OAAO,EAAE,uBAAuB;QAChC,KAAK,EAAE,UAAU;QACjB,SAAS,EAAE,kCAAkC;KAC9C;IACD,OAAO,EAAE;QACP,OAAO,EAAE,uBAAuB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