@peac/schema 0.11.2 → 0.12.0-preview.1
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 +64 -3
- package/dist/actor-binding.d.ts +148 -0
- package/dist/actor-binding.d.ts.map +1 -0
- package/dist/dispute.d.ts +4 -4
- package/dist/errors.d.ts +2 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/extensions/control-action.d.ts +68 -0
- package/dist/extensions/control-action.d.ts.map +1 -0
- package/dist/extensions/credential-event.d.ts +53 -0
- package/dist/extensions/credential-event.d.ts.map +1 -0
- package/dist/extensions/fingerprint-ref.d.ts +50 -0
- package/dist/extensions/fingerprint-ref.d.ts.map +1 -0
- package/dist/extensions/index.d.ts +16 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/tool-registry.d.ts +32 -0
- package/dist/extensions/tool-registry.d.ts.map +1 -0
- package/dist/extensions/treaty.d.ts +55 -0
- package/dist/extensions/treaty.d.ts.map +1 -0
- package/dist/index.cjs +883 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +803 -7
- package/dist/index.mjs.map +1 -1
- package/dist/issuer-config.d.ts +61 -0
- package/dist/issuer-config.d.ts.map +1 -0
- package/dist/policy-binding.d.ts +24 -0
- package/dist/policy-binding.d.ts.map +1 -0
- package/dist/receipt-parser.cjs +492 -3
- package/dist/receipt-parser.cjs.map +1 -1
- package/dist/receipt-parser.d.ts +36 -14
- package/dist/receipt-parser.d.ts.map +1 -1
- package/dist/receipt-parser.mjs +493 -5
- package/dist/receipt-parser.mjs.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validators.d.ts +16 -0
- package/dist/validators.d.ts.map +1 -1
- package/dist/wire-02-envelope.d.ts +152 -0
- package/dist/wire-02-envelope.d.ts.map +1 -0
- package/dist/wire-02-extensions.d.ts +216 -0
- package/dist/wire-02-extensions.d.ts.map +1 -0
- package/dist/wire-02-registries.d.ts +21 -0
- package/dist/wire-02-registries.d.ts.map +1 -0
- package/dist/wire-02-representation.d.ts +49 -0
- package/dist/wire-02-representation.d.ts.map +1 -0
- package/dist/wire-02-warnings.d.ts +29 -0
- package/dist/wire-02-warnings.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -55,7 +55,9 @@ var ERROR_CODES = {
|
|
|
55
55
|
E_WORKFLOW_SUMMARY_INVALID: "E_WORKFLOW_SUMMARY_INVALID",
|
|
56
56
|
E_WORKFLOW_CYCLE_DETECTED: "E_WORKFLOW_CYCLE_DETECTED",
|
|
57
57
|
// Constraint errors (400, DD-121)
|
|
58
|
-
E_CONSTRAINT_VIOLATION: "E_CONSTRAINT_VIOLATION"
|
|
58
|
+
E_CONSTRAINT_VIOLATION: "E_CONSTRAINT_VIOLATION",
|
|
59
|
+
// Wire 0.2 extension errors (400, DD-153/DD-156)
|
|
60
|
+
E_INVALID_EXTENSION_KEY: "E_INVALID_EXTENSION_KEY"
|
|
59
61
|
};
|
|
60
62
|
function createPEACError(code, category, severity, retryable, options) {
|
|
61
63
|
return {
|
|
@@ -964,11 +966,12 @@ var Extensions = zod.z.object({
|
|
|
964
966
|
aipref_snapshot: AIPREFSnapshot.optional()
|
|
965
967
|
// control block validated via ControlBlockSchema when present
|
|
966
968
|
}).catchall(zod.z.unknown());
|
|
967
|
-
var
|
|
969
|
+
var Wire01JWSHeaderSchema = zod.z.object({
|
|
968
970
|
typ: zod.z.literal(PEAC_WIRE_TYP),
|
|
969
971
|
alg: zod.z.literal(PEAC_ALG),
|
|
970
972
|
kid: zod.z.string().min(8)
|
|
971
973
|
}).strict();
|
|
974
|
+
var JWSHeader = Wire01JWSHeaderSchema;
|
|
972
975
|
var CanonicalPurposeValues = ["train", "search", "user_action", "inference", "index"];
|
|
973
976
|
var PurposeReasonValues = [
|
|
974
977
|
"allowed",
|
|
@@ -1156,6 +1159,306 @@ function validateEvidence(evidence, limits) {
|
|
|
1156
1159
|
}
|
|
1157
1160
|
return { ok: true, value: evidence };
|
|
1158
1161
|
}
|
|
1162
|
+
var PROOF_TYPES = [
|
|
1163
|
+
"ed25519-cert-chain",
|
|
1164
|
+
"eat-passport",
|
|
1165
|
+
"eat-background-check",
|
|
1166
|
+
"sigstore-oidc",
|
|
1167
|
+
"did",
|
|
1168
|
+
"spiffe",
|
|
1169
|
+
"x509-pki",
|
|
1170
|
+
"custom"
|
|
1171
|
+
];
|
|
1172
|
+
var ProofTypeSchema = zod.z.enum(PROOF_TYPES);
|
|
1173
|
+
function isOriginOnly(value) {
|
|
1174
|
+
try {
|
|
1175
|
+
const url = new URL(value);
|
|
1176
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
1177
|
+
return false;
|
|
1178
|
+
}
|
|
1179
|
+
if (url.pathname !== "/") {
|
|
1180
|
+
return false;
|
|
1181
|
+
}
|
|
1182
|
+
if (url.search !== "") {
|
|
1183
|
+
return false;
|
|
1184
|
+
}
|
|
1185
|
+
if (url.hash !== "" || value.includes("#")) {
|
|
1186
|
+
return false;
|
|
1187
|
+
}
|
|
1188
|
+
if (url.username !== "" || url.password !== "") {
|
|
1189
|
+
return false;
|
|
1190
|
+
}
|
|
1191
|
+
if (url.hostname.endsWith(".")) {
|
|
1192
|
+
return false;
|
|
1193
|
+
}
|
|
1194
|
+
const hostPart = value.replace(/^https?:\/\//, "").split(/[/:]/)[0];
|
|
1195
|
+
if (hostPart.endsWith(".")) {
|
|
1196
|
+
return false;
|
|
1197
|
+
}
|
|
1198
|
+
if (url.hostname.includes("%")) {
|
|
1199
|
+
return false;
|
|
1200
|
+
}
|
|
1201
|
+
return true;
|
|
1202
|
+
} catch {
|
|
1203
|
+
return false;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
var ACTOR_BINDING_EXTENSION_KEY = "org.peacprotocol/actor_binding";
|
|
1207
|
+
var ActorBindingSchema = zod.z.object({
|
|
1208
|
+
/** Stable actor identifier (opaque, no PII) */
|
|
1209
|
+
id: zod.z.string().min(1).max(256),
|
|
1210
|
+
/** Proof type from DD-143 multi-root vocabulary */
|
|
1211
|
+
proof_type: ProofTypeSchema,
|
|
1212
|
+
/** URI or hash of external proof artifact */
|
|
1213
|
+
proof_ref: zod.z.string().max(2048).optional(),
|
|
1214
|
+
/** Origin-only URL: scheme + host + optional port; NO path, query, or fragment */
|
|
1215
|
+
origin: zod.z.string().max(2048).refine(isOriginOnly, {
|
|
1216
|
+
message: "origin must be an origin-only URL (scheme + host + optional port; no path, query, or fragment)"
|
|
1217
|
+
}),
|
|
1218
|
+
/** SHA-256 hash of the intent (hash-first per DD-138) */
|
|
1219
|
+
intent_hash: zod.z.string().regex(/^sha256:[a-f0-9]{64}$/, {
|
|
1220
|
+
message: "intent_hash must match sha256:<64 hex chars>"
|
|
1221
|
+
}).optional()
|
|
1222
|
+
}).strict();
|
|
1223
|
+
var MVISTimeBoundsSchema = zod.z.object({
|
|
1224
|
+
/** Earliest valid time (RFC 3339) */
|
|
1225
|
+
not_before: zod.z.string().datetime(),
|
|
1226
|
+
/** Latest valid time (RFC 3339) */
|
|
1227
|
+
not_after: zod.z.string().datetime()
|
|
1228
|
+
}).strict();
|
|
1229
|
+
var MVISReplayProtectionSchema = zod.z.object({
|
|
1230
|
+
/** Unique token identifier (jti from JWT or equivalent) */
|
|
1231
|
+
jti: zod.z.string().min(1).max(256),
|
|
1232
|
+
/** Optional nonce for additional replay protection */
|
|
1233
|
+
nonce: zod.z.string().max(256).optional()
|
|
1234
|
+
}).strict();
|
|
1235
|
+
var MVISFieldsSchema = zod.z.object({
|
|
1236
|
+
/** Who issued the identity assertion */
|
|
1237
|
+
issuer: zod.z.string().min(1).max(2048),
|
|
1238
|
+
/** Who the identity is about (opaque identifier, no PII) */
|
|
1239
|
+
subject: zod.z.string().min(1).max(256),
|
|
1240
|
+
/** Cryptographic binding: kid or JWK thumbprint */
|
|
1241
|
+
key_binding: zod.z.string().min(1).max(256),
|
|
1242
|
+
/** Validity period */
|
|
1243
|
+
time_bounds: MVISTimeBoundsSchema,
|
|
1244
|
+
/** Replay protection */
|
|
1245
|
+
replay_protection: MVISReplayProtectionSchema
|
|
1246
|
+
}).strict();
|
|
1247
|
+
function validateActorBinding(data) {
|
|
1248
|
+
const result = ActorBindingSchema.safeParse(data);
|
|
1249
|
+
if (result.success) {
|
|
1250
|
+
return { ok: true, value: result.data };
|
|
1251
|
+
}
|
|
1252
|
+
return { ok: false, error: result.error.message };
|
|
1253
|
+
}
|
|
1254
|
+
function validateMVIS(data) {
|
|
1255
|
+
const result = MVISFieldsSchema.safeParse(data);
|
|
1256
|
+
if (!result.success) {
|
|
1257
|
+
return { ok: false, error: result.error.message };
|
|
1258
|
+
}
|
|
1259
|
+
const notBefore = new Date(result.data.time_bounds.not_before).getTime();
|
|
1260
|
+
const notAfter = new Date(result.data.time_bounds.not_after).getTime();
|
|
1261
|
+
if (notBefore >= notAfter) {
|
|
1262
|
+
return { ok: false, error: "not_before must be before not_after" };
|
|
1263
|
+
}
|
|
1264
|
+
const MAX_DURATION_MS = 100 * 365.25 * 24 * 60 * 60 * 1e3;
|
|
1265
|
+
if (notAfter - notBefore > MAX_DURATION_MS) {
|
|
1266
|
+
return { ok: false, error: "time_bounds duration must not exceed 100 years" };
|
|
1267
|
+
}
|
|
1268
|
+
return { ok: true, value: result.data };
|
|
1269
|
+
}
|
|
1270
|
+
var CREDENTIAL_EVENT_EXTENSION_KEY = "org.peacprotocol/credential_event";
|
|
1271
|
+
var CREDENTIAL_EVENTS = ["issued", "leased", "rotated", "revoked", "expired"];
|
|
1272
|
+
var CredentialEventTypeSchema = zod.z.enum(CREDENTIAL_EVENTS);
|
|
1273
|
+
var FINGERPRINT_REF_PATTERN = /^(sha256|hmac-sha256):[a-f0-9]{64}$/;
|
|
1274
|
+
var CredentialRefSchema = zod.z.string().max(256).regex(FINGERPRINT_REF_PATTERN, {
|
|
1275
|
+
message: "credential_ref must be an opaque fingerprint reference: (sha256|hmac-sha256):<64 hex chars>"
|
|
1276
|
+
});
|
|
1277
|
+
var CredentialEventSchema = zod.z.object({
|
|
1278
|
+
/** Lifecycle event type */
|
|
1279
|
+
event: CredentialEventTypeSchema,
|
|
1280
|
+
/** Opaque fingerprint reference of the credential (format validation only) */
|
|
1281
|
+
credential_ref: CredentialRefSchema,
|
|
1282
|
+
/** Authority that performed the action (HTTPS URL) */
|
|
1283
|
+
authority: zod.z.string().url().max(2048).refine((v) => v.startsWith("https://"), {
|
|
1284
|
+
message: "authority must be an HTTPS URL"
|
|
1285
|
+
}),
|
|
1286
|
+
/** When the credential expires (RFC 3339, optional) */
|
|
1287
|
+
expires_at: zod.z.string().datetime().optional(),
|
|
1288
|
+
/** Previous credential reference for rotation chains (optional) */
|
|
1289
|
+
previous_ref: CredentialRefSchema.optional()
|
|
1290
|
+
}).strict();
|
|
1291
|
+
function validateCredentialEvent(data) {
|
|
1292
|
+
const result = CredentialEventSchema.safeParse(data);
|
|
1293
|
+
if (result.success) {
|
|
1294
|
+
return { ok: true, value: result.data };
|
|
1295
|
+
}
|
|
1296
|
+
return { ok: false, error: result.error.message };
|
|
1297
|
+
}
|
|
1298
|
+
var TOOL_REGISTRY_EXTENSION_KEY = "org.peacprotocol/tool_registry";
|
|
1299
|
+
function isAllowedRegistryUri(value) {
|
|
1300
|
+
if (value.startsWith("urn:")) {
|
|
1301
|
+
return true;
|
|
1302
|
+
}
|
|
1303
|
+
try {
|
|
1304
|
+
const url = new URL(value);
|
|
1305
|
+
return url.protocol === "https:";
|
|
1306
|
+
} catch {
|
|
1307
|
+
return false;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
var ToolRegistrySchema = zod.z.object({
|
|
1311
|
+
/** Tool identifier */
|
|
1312
|
+
tool_id: zod.z.string().min(1).max(256),
|
|
1313
|
+
/** Registry URI (HTTPS or URN only; no file:// or data:// for SSRF prevention) */
|
|
1314
|
+
registry_uri: zod.z.string().max(2048).refine(isAllowedRegistryUri, {
|
|
1315
|
+
message: "registry_uri must be an HTTPS URL or URN (file:// and data:// are prohibited)"
|
|
1316
|
+
}),
|
|
1317
|
+
/** Tool version (optional, semver-like) */
|
|
1318
|
+
version: zod.z.string().max(64).optional(),
|
|
1319
|
+
/** Tool capabilities (optional) */
|
|
1320
|
+
capabilities: zod.z.array(zod.z.string().max(64)).max(32).optional()
|
|
1321
|
+
}).strict();
|
|
1322
|
+
function validateToolRegistry(data) {
|
|
1323
|
+
const result = ToolRegistrySchema.safeParse(data);
|
|
1324
|
+
if (result.success) {
|
|
1325
|
+
return { ok: true, value: result.data };
|
|
1326
|
+
}
|
|
1327
|
+
return { ok: false, error: result.error.message };
|
|
1328
|
+
}
|
|
1329
|
+
var CONTROL_ACTION_EXTENSION_KEY = "org.peacprotocol/control_action";
|
|
1330
|
+
var CONTROL_ACTIONS = ["grant", "deny", "escalate", "delegate", "audit"];
|
|
1331
|
+
var ControlActionTypeSchema = zod.z.enum(CONTROL_ACTIONS);
|
|
1332
|
+
var CONTROL_TRIGGERS = [
|
|
1333
|
+
"policy_evaluation",
|
|
1334
|
+
"manual_review",
|
|
1335
|
+
"anomaly_detection",
|
|
1336
|
+
"scheduled",
|
|
1337
|
+
"event_driven"
|
|
1338
|
+
];
|
|
1339
|
+
var ControlTriggerSchema = zod.z.enum(CONTROL_TRIGGERS);
|
|
1340
|
+
var ControlActionSchema = zod.z.object({
|
|
1341
|
+
/** Action taken */
|
|
1342
|
+
action: ControlActionTypeSchema,
|
|
1343
|
+
/** What triggered the action */
|
|
1344
|
+
trigger: ControlTriggerSchema,
|
|
1345
|
+
/** Resource or scope the action applies to (optional) */
|
|
1346
|
+
resource: zod.z.string().max(2048).optional(),
|
|
1347
|
+
/** Reason for the action (optional, human-readable) */
|
|
1348
|
+
reason: zod.z.string().max(1024).optional(),
|
|
1349
|
+
/** Policy identifier that was evaluated (optional) */
|
|
1350
|
+
policy_ref: zod.z.string().max(2048).optional(),
|
|
1351
|
+
/** When the action was taken (RFC 3339, optional; defaults to receipt iat) */
|
|
1352
|
+
action_at: zod.z.string().datetime().optional()
|
|
1353
|
+
}).strict();
|
|
1354
|
+
function validateControlAction(data) {
|
|
1355
|
+
const result = ControlActionSchema.safeParse(data);
|
|
1356
|
+
if (result.success) {
|
|
1357
|
+
return { ok: true, value: result.data };
|
|
1358
|
+
}
|
|
1359
|
+
return { ok: false, error: result.error.message };
|
|
1360
|
+
}
|
|
1361
|
+
var TREATY_EXTENSION_KEY = "org.peacprotocol/treaty";
|
|
1362
|
+
var COMMITMENT_CLASSES = ["informational", "operational", "financial", "legal"];
|
|
1363
|
+
var CommitmentClassSchema = zod.z.enum(COMMITMENT_CLASSES);
|
|
1364
|
+
var TreatySchema = zod.z.object({
|
|
1365
|
+
/** Commitment level */
|
|
1366
|
+
commitment_class: CommitmentClassSchema,
|
|
1367
|
+
/** URL to full terms document (optional) */
|
|
1368
|
+
terms_ref: zod.z.string().url().max(2048).optional(),
|
|
1369
|
+
/** SHA-256 hash of terms document for integrity verification (optional) */
|
|
1370
|
+
terms_hash: zod.z.string().regex(/^sha256:[a-f0-9]{64}$/, {
|
|
1371
|
+
message: "terms_hash must match sha256:<64 hex chars>"
|
|
1372
|
+
}).optional(),
|
|
1373
|
+
/** Counterparty identifier (optional) */
|
|
1374
|
+
counterparty: zod.z.string().max(256).optional(),
|
|
1375
|
+
/** When the treaty becomes effective (RFC 3339, optional) */
|
|
1376
|
+
effective_at: zod.z.string().datetime().optional(),
|
|
1377
|
+
/** When the treaty expires (RFC 3339, optional) */
|
|
1378
|
+
expires_at: zod.z.string().datetime().optional()
|
|
1379
|
+
}).strict();
|
|
1380
|
+
function validateTreaty(data) {
|
|
1381
|
+
const result = TreatySchema.safeParse(data);
|
|
1382
|
+
if (!result.success) {
|
|
1383
|
+
return { ok: false, error: result.error.message };
|
|
1384
|
+
}
|
|
1385
|
+
if (result.data.effective_at && result.data.expires_at) {
|
|
1386
|
+
const effectiveMs = new Date(result.data.effective_at).getTime();
|
|
1387
|
+
const expiresMs = new Date(result.data.expires_at).getTime();
|
|
1388
|
+
if (effectiveMs > expiresMs) {
|
|
1389
|
+
return { ok: false, error: "effective_at must not be after expires_at" };
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return { ok: true, value: result.data };
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// src/extensions/fingerprint-ref.ts
|
|
1396
|
+
function hexToBase64url(hex) {
|
|
1397
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
1398
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
1399
|
+
bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
|
|
1400
|
+
}
|
|
1401
|
+
let base64;
|
|
1402
|
+
if (typeof Buffer !== "undefined") {
|
|
1403
|
+
base64 = Buffer.from(bytes).toString("base64");
|
|
1404
|
+
} else {
|
|
1405
|
+
base64 = btoa(String.fromCharCode(...bytes));
|
|
1406
|
+
}
|
|
1407
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1408
|
+
}
|
|
1409
|
+
function base64urlToHex(b64url) {
|
|
1410
|
+
let base64 = b64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1411
|
+
while (base64.length % 4 !== 0) {
|
|
1412
|
+
base64 += "=";
|
|
1413
|
+
}
|
|
1414
|
+
let bytes;
|
|
1415
|
+
if (typeof Buffer !== "undefined") {
|
|
1416
|
+
bytes = Buffer.from(base64, "base64");
|
|
1417
|
+
} else {
|
|
1418
|
+
const binary = atob(base64);
|
|
1419
|
+
bytes = new Uint8Array(binary.length);
|
|
1420
|
+
for (let i = 0; i < binary.length; i++) {
|
|
1421
|
+
bytes[i] = binary.charCodeAt(i);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1425
|
+
}
|
|
1426
|
+
var VALID_ALGS = ["sha256", "hmac-sha256"];
|
|
1427
|
+
var STRING_FORM_PATTERN = /^(sha256|hmac-sha256):([a-f0-9]{64})$/;
|
|
1428
|
+
var MAX_FINGERPRINT_REF_LENGTH = 76;
|
|
1429
|
+
var BASE64URL_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
1430
|
+
function stringToFingerprintRef(s) {
|
|
1431
|
+
if (s.length > MAX_FINGERPRINT_REF_LENGTH) {
|
|
1432
|
+
return null;
|
|
1433
|
+
}
|
|
1434
|
+
const match = STRING_FORM_PATTERN.exec(s);
|
|
1435
|
+
if (!match) {
|
|
1436
|
+
return null;
|
|
1437
|
+
}
|
|
1438
|
+
const alg = match[1];
|
|
1439
|
+
const hex = match[2];
|
|
1440
|
+
return {
|
|
1441
|
+
alg,
|
|
1442
|
+
value: hexToBase64url(hex)
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
function fingerprintRefToString(obj) {
|
|
1446
|
+
if (!VALID_ALGS.includes(obj.alg)) {
|
|
1447
|
+
return null;
|
|
1448
|
+
}
|
|
1449
|
+
if (!BASE64URL_PATTERN.test(obj.value)) {
|
|
1450
|
+
return null;
|
|
1451
|
+
}
|
|
1452
|
+
try {
|
|
1453
|
+
const hex = base64urlToHex(obj.value);
|
|
1454
|
+
if (hex.length !== 64) {
|
|
1455
|
+
return null;
|
|
1456
|
+
}
|
|
1457
|
+
return `${obj.alg}:${hex}`;
|
|
1458
|
+
} catch {
|
|
1459
|
+
return null;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1159
1462
|
var DISPUTE_LIMITS = {
|
|
1160
1463
|
/** Maximum grounds per dispute */
|
|
1161
1464
|
maxGrounds: 10,
|
|
@@ -2772,15 +3075,404 @@ async function verifyReceiptRefConsistency(carrier) {
|
|
|
2772
3075
|
}
|
|
2773
3076
|
return null;
|
|
2774
3077
|
}
|
|
3078
|
+
function isValidContentHash(s) {
|
|
3079
|
+
const ref = stringToFingerprintRef(s);
|
|
3080
|
+
if (ref === null) return false;
|
|
3081
|
+
return ref.alg === "sha256";
|
|
3082
|
+
}
|
|
3083
|
+
var MIME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9!#$&\-^_.+]*\/[a-zA-Z0-9][a-zA-Z0-9!#$&\-^_.+]*(;\s*[a-zA-Z0-9][a-zA-Z0-9!#$&\-^_.+]*=[^\s;]+)*$/;
|
|
3084
|
+
function isValidMimeType(s) {
|
|
3085
|
+
return MIME_PATTERN.test(s);
|
|
3086
|
+
}
|
|
3087
|
+
var REPRESENTATION_LIMITS = {
|
|
3088
|
+
/** Max content_hash string length (sha256:<64 hex> = 71 chars, capped at FingerprintRef max) */
|
|
3089
|
+
maxContentHashLength: MAX_FINGERPRINT_REF_LENGTH,
|
|
3090
|
+
/** Max content_type string length */
|
|
3091
|
+
maxContentTypeLength: 256
|
|
3092
|
+
};
|
|
3093
|
+
var Wire02RepresentationFieldsSchema = zod.z.object({
|
|
3094
|
+
/**
|
|
3095
|
+
* FingerprintRef of the served content body.
|
|
3096
|
+
* Format: sha256:<64 lowercase hex>
|
|
3097
|
+
* hmac-sha256 is NOT permitted for representation hashes.
|
|
3098
|
+
*/
|
|
3099
|
+
content_hash: zod.z.string().max(REPRESENTATION_LIMITS.maxContentHashLength).refine(isValidContentHash, {
|
|
3100
|
+
message: "content_hash must be a valid sha256 FingerprintRef (sha256:<64 lowercase hex>)"
|
|
3101
|
+
}).optional(),
|
|
3102
|
+
/**
|
|
3103
|
+
* MIME type of the served content (e.g., 'text/plain', 'application/json').
|
|
3104
|
+
* Conservative pattern validation: type/subtype with optional parameters.
|
|
3105
|
+
*/
|
|
3106
|
+
content_type: zod.z.string().max(REPRESENTATION_LIMITS.maxContentTypeLength).refine(isValidMimeType, {
|
|
3107
|
+
message: "content_type must be a valid MIME type (type/subtype with optional parameters)"
|
|
3108
|
+
}).optional(),
|
|
3109
|
+
/**
|
|
3110
|
+
* Size of the served content in bytes.
|
|
3111
|
+
* Non-negative integer, bounded by Number.MAX_SAFE_INTEGER.
|
|
3112
|
+
*/
|
|
3113
|
+
content_length: zod.z.number().int().finite().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
|
|
3114
|
+
}).strict();
|
|
3115
|
+
var EXTENSION_LIMITS = {
|
|
3116
|
+
// Extension key grammar
|
|
3117
|
+
maxExtensionKeyLength: 512,
|
|
3118
|
+
maxDnsLabelLength: 63,
|
|
3119
|
+
maxDnsDomainLength: 253,
|
|
3120
|
+
// Commerce
|
|
3121
|
+
maxPaymentRailLength: 128,
|
|
3122
|
+
maxCurrencyLength: 16,
|
|
3123
|
+
maxAmountMinorLength: 64,
|
|
3124
|
+
maxReferenceLength: 256,
|
|
3125
|
+
maxAssetLength: 256,
|
|
3126
|
+
// Access
|
|
3127
|
+
maxResourceLength: 2048,
|
|
3128
|
+
maxActionLength: 256,
|
|
3129
|
+
// Challenge
|
|
3130
|
+
maxProblemTypeLength: 2048,
|
|
3131
|
+
maxProblemTitleLength: 256,
|
|
3132
|
+
maxProblemDetailLength: 4096,
|
|
3133
|
+
maxProblemInstanceLength: 2048,
|
|
3134
|
+
// Identity
|
|
3135
|
+
maxProofRefLength: 256,
|
|
3136
|
+
// Correlation
|
|
3137
|
+
maxTraceIdLength: 32,
|
|
3138
|
+
maxSpanIdLength: 16,
|
|
3139
|
+
maxWorkflowIdLength: 256,
|
|
3140
|
+
maxParentJtiLength: 256,
|
|
3141
|
+
maxDependsOnLength: 64
|
|
3142
|
+
};
|
|
3143
|
+
var DNS_LABEL = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
|
|
3144
|
+
var SEGMENT_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
3145
|
+
function isValidExtensionKey(key) {
|
|
3146
|
+
if (key.length === 0 || key.length > EXTENSION_LIMITS.maxExtensionKeyLength) return false;
|
|
3147
|
+
const slashIdx = key.indexOf("/");
|
|
3148
|
+
if (slashIdx <= 0) return false;
|
|
3149
|
+
const domain = key.slice(0, slashIdx);
|
|
3150
|
+
const segment = key.slice(slashIdx + 1);
|
|
3151
|
+
if (!domain.includes(".")) return false;
|
|
3152
|
+
if (domain.length > EXTENSION_LIMITS.maxDnsDomainLength) return false;
|
|
3153
|
+
if (segment.length === 0) return false;
|
|
3154
|
+
if (!SEGMENT_PATTERN.test(segment)) return false;
|
|
3155
|
+
const labels = domain.split(".");
|
|
3156
|
+
for (const label of labels) {
|
|
3157
|
+
if (label.length === 0 || label.length > EXTENSION_LIMITS.maxDnsLabelLength) return false;
|
|
3158
|
+
if (!DNS_LABEL.test(label)) return false;
|
|
3159
|
+
}
|
|
3160
|
+
return true;
|
|
3161
|
+
}
|
|
3162
|
+
var COMMERCE_EXTENSION_KEY = "org.peacprotocol/commerce";
|
|
3163
|
+
var ACCESS_EXTENSION_KEY = "org.peacprotocol/access";
|
|
3164
|
+
var CHALLENGE_EXTENSION_KEY = "org.peacprotocol/challenge";
|
|
3165
|
+
var IDENTITY_EXTENSION_KEY = "org.peacprotocol/identity";
|
|
3166
|
+
var CORRELATION_EXTENSION_KEY = "org.peacprotocol/correlation";
|
|
3167
|
+
function escapePointerSegment(s) {
|
|
3168
|
+
return s.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3169
|
+
}
|
|
3170
|
+
function zodPathToPointer(groupKey, zodPath) {
|
|
3171
|
+
const escaped = escapePointerSegment(groupKey);
|
|
3172
|
+
const segments = zodPath.map((s) => escapePointerSegment(String(s)));
|
|
3173
|
+
return `/extensions/${escaped}` + (segments.length > 0 ? "/" + segments.join("/") : "");
|
|
3174
|
+
}
|
|
3175
|
+
var AMOUNT_MINOR_PATTERN = /^-?[0-9]+$/;
|
|
3176
|
+
var CommerceExtensionSchema = zod.z.object({
|
|
3177
|
+
/** Payment rail identifier (e.g., 'stripe', 'x402', 'lightning') */
|
|
3178
|
+
payment_rail: zod.z.string().min(1).max(EXTENSION_LIMITS.maxPaymentRailLength),
|
|
3179
|
+
/**
|
|
3180
|
+
* Amount in smallest currency unit as a string for arbitrary precision.
|
|
3181
|
+
* Base-10 integer: optional leading minus, one or more digits.
|
|
3182
|
+
* Decimals and empty strings are rejected.
|
|
3183
|
+
*/
|
|
3184
|
+
amount_minor: zod.z.string().min(1).max(EXTENSION_LIMITS.maxAmountMinorLength).regex(
|
|
3185
|
+
AMOUNT_MINOR_PATTERN,
|
|
3186
|
+
'amount_minor must be a base-10 integer string (e.g., "1000", "-50")'
|
|
3187
|
+
),
|
|
3188
|
+
/** ISO 4217 currency code or asset identifier */
|
|
3189
|
+
currency: zod.z.string().min(1).max(EXTENSION_LIMITS.maxCurrencyLength),
|
|
3190
|
+
/** Caller-assigned payment reference */
|
|
3191
|
+
reference: zod.z.string().max(EXTENSION_LIMITS.maxReferenceLength).optional(),
|
|
3192
|
+
/** Asset identifier for non-fiat (e.g., token address) */
|
|
3193
|
+
asset: zod.z.string().max(EXTENSION_LIMITS.maxAssetLength).optional(),
|
|
3194
|
+
/** Environment discriminant */
|
|
3195
|
+
env: zod.z.enum(["live", "test"]).optional()
|
|
3196
|
+
}).strict();
|
|
3197
|
+
var AccessExtensionSchema = zod.z.object({
|
|
3198
|
+
/** Resource being accessed (URI or identifier) */
|
|
3199
|
+
resource: zod.z.string().min(1).max(EXTENSION_LIMITS.maxResourceLength),
|
|
3200
|
+
/** Action performed on the resource */
|
|
3201
|
+
action: zod.z.string().min(1).max(EXTENSION_LIMITS.maxActionLength),
|
|
3202
|
+
/** Access decision */
|
|
3203
|
+
decision: zod.z.enum(["allow", "deny", "review"])
|
|
3204
|
+
}).strict();
|
|
3205
|
+
var CHALLENGE_TYPES = [
|
|
3206
|
+
"payment_required",
|
|
3207
|
+
"identity_required",
|
|
3208
|
+
"consent_required",
|
|
3209
|
+
"attestation_required",
|
|
3210
|
+
"rate_limited",
|
|
3211
|
+
"purpose_disallowed",
|
|
3212
|
+
"custom"
|
|
3213
|
+
];
|
|
3214
|
+
var ChallengeTypeSchema = zod.z.enum(CHALLENGE_TYPES);
|
|
3215
|
+
var ProblemDetailsSchema = zod.z.object({
|
|
3216
|
+
/** HTTP status code (100-599) */
|
|
3217
|
+
status: zod.z.number().int().min(100).max(599),
|
|
3218
|
+
/** Problem type URI */
|
|
3219
|
+
type: zod.z.string().min(1).max(EXTENSION_LIMITS.maxProblemTypeLength).url(),
|
|
3220
|
+
/** Short human-readable summary */
|
|
3221
|
+
title: zod.z.string().max(EXTENSION_LIMITS.maxProblemTitleLength).optional(),
|
|
3222
|
+
/** Human-readable explanation specific to this occurrence */
|
|
3223
|
+
detail: zod.z.string().max(EXTENSION_LIMITS.maxProblemDetailLength).optional(),
|
|
3224
|
+
/** URI reference identifying the specific occurrence */
|
|
3225
|
+
instance: zod.z.string().max(EXTENSION_LIMITS.maxProblemInstanceLength).optional()
|
|
3226
|
+
}).passthrough();
|
|
3227
|
+
var ChallengeExtensionSchema = zod.z.object({
|
|
3228
|
+
/** Challenge type (7 values) */
|
|
3229
|
+
challenge_type: ChallengeTypeSchema,
|
|
3230
|
+
/** RFC 9457 Problem Details */
|
|
3231
|
+
problem: ProblemDetailsSchema,
|
|
3232
|
+
/** Resource that triggered the challenge */
|
|
3233
|
+
resource: zod.z.string().max(EXTENSION_LIMITS.maxResourceLength).optional(),
|
|
3234
|
+
/** Action that triggered the challenge */
|
|
3235
|
+
action: zod.z.string().max(EXTENSION_LIMITS.maxActionLength).optional(),
|
|
3236
|
+
/** Caller-defined requirements for resolving the challenge */
|
|
3237
|
+
requirements: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
3238
|
+
}).strict();
|
|
3239
|
+
var IdentityExtensionSchema = zod.z.object({
|
|
3240
|
+
/** Proof reference (opaque string; no actor_binding: top-level actor is sole location) */
|
|
3241
|
+
proof_ref: zod.z.string().max(EXTENSION_LIMITS.maxProofRefLength).optional()
|
|
3242
|
+
}).strict();
|
|
3243
|
+
var TRACE_ID_PATTERN = /^[0-9a-f]{32}$/;
|
|
3244
|
+
var SPAN_ID_PATTERN = /^[0-9a-f]{16}$/;
|
|
3245
|
+
var CorrelationExtensionSchema = zod.z.object({
|
|
3246
|
+
/** OpenTelemetry-compatible trace ID (32 lowercase hex chars) */
|
|
3247
|
+
trace_id: zod.z.string().length(EXTENSION_LIMITS.maxTraceIdLength).regex(TRACE_ID_PATTERN, "trace_id must be 32 lowercase hex characters").optional(),
|
|
3248
|
+
/** OpenTelemetry-compatible span ID (16 lowercase hex chars) */
|
|
3249
|
+
span_id: zod.z.string().length(EXTENSION_LIMITS.maxSpanIdLength).regex(SPAN_ID_PATTERN, "span_id must be 16 lowercase hex characters").optional(),
|
|
3250
|
+
/** Workflow identifier */
|
|
3251
|
+
workflow_id: zod.z.string().min(1).max(EXTENSION_LIMITS.maxWorkflowIdLength).optional(),
|
|
3252
|
+
/** Parent receipt JTI for causal chains */
|
|
3253
|
+
parent_jti: zod.z.string().min(1).max(EXTENSION_LIMITS.maxParentJtiLength).optional(),
|
|
3254
|
+
/** JTIs this receipt depends on */
|
|
3255
|
+
depends_on: zod.z.array(zod.z.string().min(1).max(EXTENSION_LIMITS.maxParentJtiLength)).max(EXTENSION_LIMITS.maxDependsOnLength).optional()
|
|
3256
|
+
}).strict();
|
|
3257
|
+
var EXTENSION_SCHEMA_MAP = /* @__PURE__ */ new Map();
|
|
3258
|
+
EXTENSION_SCHEMA_MAP.set(COMMERCE_EXTENSION_KEY, CommerceExtensionSchema);
|
|
3259
|
+
EXTENSION_SCHEMA_MAP.set(ACCESS_EXTENSION_KEY, AccessExtensionSchema);
|
|
3260
|
+
EXTENSION_SCHEMA_MAP.set(CHALLENGE_EXTENSION_KEY, ChallengeExtensionSchema);
|
|
3261
|
+
EXTENSION_SCHEMA_MAP.set(IDENTITY_EXTENSION_KEY, IdentityExtensionSchema);
|
|
3262
|
+
EXTENSION_SCHEMA_MAP.set(CORRELATION_EXTENSION_KEY, CorrelationExtensionSchema);
|
|
3263
|
+
function getExtension(extensions, key, schema) {
|
|
3264
|
+
if (extensions === void 0) return void 0;
|
|
3265
|
+
if (!Object.prototype.hasOwnProperty.call(extensions, key)) return void 0;
|
|
3266
|
+
const value = extensions[key];
|
|
3267
|
+
const result = schema.safeParse(value);
|
|
3268
|
+
if (result.success) {
|
|
3269
|
+
return result.data;
|
|
3270
|
+
}
|
|
3271
|
+
const firstIssue = result.error.issues[0];
|
|
3272
|
+
const pointer = zodPathToPointer(key, firstIssue?.path ?? []);
|
|
3273
|
+
throw createPEACError(ERROR_CODES.E_INVALID_ENVELOPE, "validation", "error", false, {
|
|
3274
|
+
http_status: 400,
|
|
3275
|
+
pointer,
|
|
3276
|
+
remediation: `Fix the ${key} extension group value`,
|
|
3277
|
+
details: {
|
|
3278
|
+
message: firstIssue?.message ?? "Invalid extension value",
|
|
3279
|
+
issues: result.error.issues
|
|
3280
|
+
}
|
|
3281
|
+
});
|
|
3282
|
+
}
|
|
3283
|
+
function getCommerceExtension(extensions) {
|
|
3284
|
+
return getExtension(extensions, COMMERCE_EXTENSION_KEY, CommerceExtensionSchema);
|
|
3285
|
+
}
|
|
3286
|
+
function getAccessExtension(extensions) {
|
|
3287
|
+
return getExtension(extensions, ACCESS_EXTENSION_KEY, AccessExtensionSchema);
|
|
3288
|
+
}
|
|
3289
|
+
function getChallengeExtension(extensions) {
|
|
3290
|
+
return getExtension(extensions, CHALLENGE_EXTENSION_KEY, ChallengeExtensionSchema);
|
|
3291
|
+
}
|
|
3292
|
+
function getIdentityExtension(extensions) {
|
|
3293
|
+
return getExtension(extensions, IDENTITY_EXTENSION_KEY, IdentityExtensionSchema);
|
|
3294
|
+
}
|
|
3295
|
+
function getCorrelationExtension(extensions) {
|
|
3296
|
+
return getExtension(extensions, CORRELATION_EXTENSION_KEY, CorrelationExtensionSchema);
|
|
3297
|
+
}
|
|
3298
|
+
function validateKnownExtensions(extensions, ctx) {
|
|
3299
|
+
if (extensions === void 0) return;
|
|
3300
|
+
for (const key of Object.keys(extensions)) {
|
|
3301
|
+
if (!isValidExtensionKey(key)) {
|
|
3302
|
+
ctx.addIssue({
|
|
3303
|
+
code: "custom",
|
|
3304
|
+
message: ERROR_CODES.E_INVALID_EXTENSION_KEY,
|
|
3305
|
+
path: ["extensions", key]
|
|
3306
|
+
});
|
|
3307
|
+
continue;
|
|
3308
|
+
}
|
|
3309
|
+
const schema = EXTENSION_SCHEMA_MAP.get(key);
|
|
3310
|
+
if (schema !== void 0) {
|
|
3311
|
+
const result = schema.safeParse(extensions[key]);
|
|
3312
|
+
if (!result.success) {
|
|
3313
|
+
const firstIssue = result.error.issues[0];
|
|
3314
|
+
const issuePath = firstIssue?.path ?? [];
|
|
3315
|
+
ctx.addIssue({
|
|
3316
|
+
code: "custom",
|
|
3317
|
+
message: firstIssue?.message ?? "Invalid extension value",
|
|
3318
|
+
path: ["extensions", key, ...issuePath]
|
|
3319
|
+
});
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
// src/wire-02-envelope.ts
|
|
3326
|
+
function isSortedAndUnique(arr) {
|
|
3327
|
+
for (let i = 1; i < arr.length; i++) {
|
|
3328
|
+
if (arr[i] <= arr[i - 1]) return false;
|
|
3329
|
+
}
|
|
3330
|
+
return true;
|
|
3331
|
+
}
|
|
3332
|
+
function isCanonicalIss(iss) {
|
|
3333
|
+
if (typeof iss !== "string" || iss.length === 0 || iss.length > kernel.ISS_CANONICAL.maxLength) {
|
|
3334
|
+
return false;
|
|
3335
|
+
}
|
|
3336
|
+
if (iss.startsWith("did:")) {
|
|
3337
|
+
return /^did:[a-z0-9]+:[^#?/]+$/.test(iss);
|
|
3338
|
+
}
|
|
3339
|
+
try {
|
|
3340
|
+
const url = new URL(iss);
|
|
3341
|
+
if (url.protocol !== "https:") return false;
|
|
3342
|
+
if (!url.hostname) return false;
|
|
3343
|
+
if (url.username !== "" || url.password !== "") return false;
|
|
3344
|
+
const origin = `${url.protocol}//${url.host}`;
|
|
3345
|
+
return iss === origin;
|
|
3346
|
+
} catch {
|
|
3347
|
+
return false;
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
var ABS_URI_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//;
|
|
3351
|
+
function isValidReceiptType(value) {
|
|
3352
|
+
if (value.length === 0 || value.length > kernel.TYPE_GRAMMAR.maxLength) return false;
|
|
3353
|
+
if (ABS_URI_PATTERN.test(value)) return true;
|
|
3354
|
+
const slashIdx = value.indexOf("/");
|
|
3355
|
+
if (slashIdx <= 0) return false;
|
|
3356
|
+
const domain = value.slice(0, slashIdx);
|
|
3357
|
+
const segment = value.slice(slashIdx + 1);
|
|
3358
|
+
if (!domain.includes(".")) return false;
|
|
3359
|
+
if (segment.length === 0) return false;
|
|
3360
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9.-]*$/.test(domain)) return false;
|
|
3361
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(segment)) return false;
|
|
3362
|
+
return true;
|
|
3363
|
+
}
|
|
3364
|
+
var EVIDENCE_PILLARS = [
|
|
3365
|
+
"access",
|
|
3366
|
+
"attribution",
|
|
3367
|
+
"commerce",
|
|
3368
|
+
"compliance",
|
|
3369
|
+
"consent",
|
|
3370
|
+
"identity",
|
|
3371
|
+
"privacy",
|
|
3372
|
+
"provenance",
|
|
3373
|
+
"purpose",
|
|
3374
|
+
"safety"
|
|
3375
|
+
];
|
|
3376
|
+
var EvidencePillarSchema = zod.z.enum(
|
|
3377
|
+
EVIDENCE_PILLARS
|
|
3378
|
+
);
|
|
3379
|
+
var PillarsSchema = zod.z.array(EvidencePillarSchema).min(1).superRefine((arr, ctx) => {
|
|
3380
|
+
if (!isSortedAndUnique(arr)) {
|
|
3381
|
+
ctx.addIssue({
|
|
3382
|
+
code: "custom",
|
|
3383
|
+
message: "E_PILLARS_NOT_SORTED"
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
});
|
|
3387
|
+
var Wire02KindSchema = zod.z.enum(["evidence", "challenge"]);
|
|
3388
|
+
var ReceiptTypeSchema = zod.z.string().max(kernel.TYPE_GRAMMAR.maxLength).refine(isValidReceiptType, {
|
|
3389
|
+
message: "type must be reverse-DNS notation (e.g., org.example/flow) or an absolute URI"
|
|
3390
|
+
});
|
|
3391
|
+
var CanonicalIssSchema = zod.z.string().max(kernel.ISS_CANONICAL.maxLength).refine(isCanonicalIss, {
|
|
3392
|
+
message: "E_ISS_NOT_CANONICAL"
|
|
3393
|
+
});
|
|
3394
|
+
var PolicyBlockSchema = zod.z.object({
|
|
3395
|
+
/** JCS+SHA-256 digest: 'sha256:<64 lowercase hex>' */
|
|
3396
|
+
digest: zod.z.string().regex(kernel.HASH.pattern, "digest must be sha256:<64 lowercase hex>"),
|
|
3397
|
+
/**
|
|
3398
|
+
* HTTPS locator hint for the policy document.
|
|
3399
|
+
* MUST be an https:// URL (max 2048 chars).
|
|
3400
|
+
* MUST NOT trigger auto-fetch; callers use this as a hint only (DD-55).
|
|
3401
|
+
*/
|
|
3402
|
+
uri: zod.z.string().max(kernel.POLICY_BLOCK.uriMaxLength).url().refine((u) => u.startsWith("https://"), "policy.uri must be an https:// URL").optional(),
|
|
3403
|
+
/** Caller-assigned version label (max 256 chars) */
|
|
3404
|
+
version: zod.z.string().max(kernel.POLICY_BLOCK.versionMaxLength).optional()
|
|
3405
|
+
});
|
|
3406
|
+
var Wire02ClaimsSchema = zod.z.object({
|
|
3407
|
+
/** Wire format version discriminant; always '0.2' for Wire 0.2 */
|
|
3408
|
+
peac_version: zod.z.literal("0.2"),
|
|
3409
|
+
/** Structural kind: 'evidence' or 'challenge' */
|
|
3410
|
+
kind: Wire02KindSchema,
|
|
3411
|
+
/** Open semantic type (reverse-DNS or absolute URI) */
|
|
3412
|
+
type: ReceiptTypeSchema,
|
|
3413
|
+
/** Canonical issuer (https:// ASCII origin or did: identifier) */
|
|
3414
|
+
iss: CanonicalIssSchema,
|
|
3415
|
+
/** Issued-at time (Unix seconds). REQUIRED. */
|
|
3416
|
+
iat: zod.z.number().int(),
|
|
3417
|
+
/** Unique receipt identifier; 1 to 256 chars */
|
|
3418
|
+
jti: zod.z.string().min(1).max(256),
|
|
3419
|
+
/** Subject identifier; max 2048 chars */
|
|
3420
|
+
sub: zod.z.string().max(2048).optional(),
|
|
3421
|
+
/** Evidence pillars (closed 10-value taxonomy); sorted ascending, unique */
|
|
3422
|
+
pillars: PillarsSchema.optional(),
|
|
3423
|
+
/** Top-level actor binding (sole location for ActorBinding in Wire 0.2) */
|
|
3424
|
+
actor: ActorBindingSchema.optional(),
|
|
3425
|
+
/** Policy binding block (DD-151) */
|
|
3426
|
+
policy: PolicyBlockSchema.optional(),
|
|
3427
|
+
/** Representation fields (DD-152): FingerprintRef validation, sha256-only, strict */
|
|
3428
|
+
representation: Wire02RepresentationFieldsSchema.optional(),
|
|
3429
|
+
/** ISO 8601 / RFC 3339 timestamp when the interaction occurred; evidence kind only */
|
|
3430
|
+
occurred_at: zod.z.string().datetime({ offset: true }).optional(),
|
|
3431
|
+
/** Declared purpose string; max 256 chars */
|
|
3432
|
+
purpose_declared: zod.z.string().max(256).optional(),
|
|
3433
|
+
/** Extension groups (open; known group keys validated by group schema) */
|
|
3434
|
+
extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
3435
|
+
}).superRefine((data, ctx) => {
|
|
3436
|
+
if (data.kind === "challenge" && data.occurred_at !== void 0) {
|
|
3437
|
+
ctx.addIssue({
|
|
3438
|
+
code: "custom",
|
|
3439
|
+
message: "E_OCCURRED_AT_ON_CHALLENGE"
|
|
3440
|
+
});
|
|
3441
|
+
}
|
|
3442
|
+
validateKnownExtensions(data.extensions, ctx);
|
|
3443
|
+
}).strict();
|
|
3444
|
+
function checkOccurredAtSkew(occurredAt, iat, now, tolerance = kernel.OCCURRED_AT_TOLERANCE_SECONDS) {
|
|
3445
|
+
if (occurredAt === void 0) return null;
|
|
3446
|
+
const ts = Date.parse(occurredAt) / 1e3;
|
|
3447
|
+
if (isNaN(ts)) return null;
|
|
3448
|
+
if (ts > now + tolerance) return "future_error";
|
|
3449
|
+
if (ts > iat) {
|
|
3450
|
+
return {
|
|
3451
|
+
code: "occurred_at_skew",
|
|
3452
|
+
message: "occurred_at is after iat",
|
|
3453
|
+
pointer: "/occurred_at"
|
|
3454
|
+
};
|
|
3455
|
+
}
|
|
3456
|
+
return null;
|
|
3457
|
+
}
|
|
2775
3458
|
|
|
2776
3459
|
// src/receipt-parser.ts
|
|
2777
|
-
function
|
|
3460
|
+
function detectWireVersion(obj) {
|
|
3461
|
+
if (obj === null || obj === void 0 || typeof obj !== "object" || Array.isArray(obj)) {
|
|
3462
|
+
return null;
|
|
3463
|
+
}
|
|
3464
|
+
const record = obj;
|
|
3465
|
+
if (record.peac_version === "0.2") return "0.2";
|
|
3466
|
+
if ("peac_version" in record) return null;
|
|
3467
|
+
return "0.1";
|
|
3468
|
+
}
|
|
3469
|
+
function classifyWire01Receipt(obj) {
|
|
2778
3470
|
if ("amt" in obj || "cur" in obj || "payment" in obj) {
|
|
2779
3471
|
return "commerce";
|
|
2780
3472
|
}
|
|
2781
3473
|
return "attestation";
|
|
2782
3474
|
}
|
|
2783
|
-
function parseReceiptClaims(input,
|
|
3475
|
+
function parseReceiptClaims(input, opts) {
|
|
2784
3476
|
if (input === null || input === void 0 || typeof input !== "object" || Array.isArray(input)) {
|
|
2785
3477
|
return {
|
|
2786
3478
|
ok: false,
|
|
@@ -2791,7 +3483,37 @@ function parseReceiptClaims(input, _opts) {
|
|
|
2791
3483
|
};
|
|
2792
3484
|
}
|
|
2793
3485
|
const obj = input;
|
|
2794
|
-
const
|
|
3486
|
+
const wireVersion = opts?.wireVersion === "0.2" || opts?.wireVersion === "0.1" ? opts.wireVersion : detectWireVersion(obj);
|
|
3487
|
+
if (wireVersion === null) {
|
|
3488
|
+
return {
|
|
3489
|
+
ok: false,
|
|
3490
|
+
error: {
|
|
3491
|
+
code: "E_UNSUPPORTED_WIRE_VERSION",
|
|
3492
|
+
message: `Unsupported or unrecognized peac_version: ${JSON.stringify(obj["peac_version"])}`
|
|
3493
|
+
}
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
if (wireVersion === "0.2") {
|
|
3497
|
+
const result2 = Wire02ClaimsSchema.safeParse(obj);
|
|
3498
|
+
if (!result2.success) {
|
|
3499
|
+
return {
|
|
3500
|
+
ok: false,
|
|
3501
|
+
error: {
|
|
3502
|
+
code: "E_INVALID_FORMAT",
|
|
3503
|
+
message: `Wire 0.2 receipt validation failed: ${result2.error.issues.map((i) => i.message).join("; ")}`,
|
|
3504
|
+
issues: result2.error.issues
|
|
3505
|
+
}
|
|
3506
|
+
};
|
|
3507
|
+
}
|
|
3508
|
+
return {
|
|
3509
|
+
ok: true,
|
|
3510
|
+
variant: "wire-02",
|
|
3511
|
+
wireVersion: "0.2",
|
|
3512
|
+
warnings: [],
|
|
3513
|
+
claims: result2.data
|
|
3514
|
+
};
|
|
3515
|
+
}
|
|
3516
|
+
const variant = classifyWire01Receipt(obj);
|
|
2795
3517
|
if (variant === "commerce") {
|
|
2796
3518
|
const result2 = ReceiptClaimsSchema.safeParse(obj);
|
|
2797
3519
|
if (!result2.success) {
|
|
@@ -2807,6 +3529,8 @@ function parseReceiptClaims(input, _opts) {
|
|
|
2807
3529
|
return {
|
|
2808
3530
|
ok: true,
|
|
2809
3531
|
variant: "commerce",
|
|
3532
|
+
wireVersion: "0.1",
|
|
3533
|
+
warnings: [],
|
|
2810
3534
|
claims: result2.data
|
|
2811
3535
|
};
|
|
2812
3536
|
}
|
|
@@ -2824,10 +3548,84 @@ function parseReceiptClaims(input, _opts) {
|
|
|
2824
3548
|
return {
|
|
2825
3549
|
ok: true,
|
|
2826
3550
|
variant: "attestation",
|
|
3551
|
+
wireVersion: "0.1",
|
|
3552
|
+
warnings: [],
|
|
2827
3553
|
claims: result.data
|
|
2828
3554
|
};
|
|
2829
3555
|
}
|
|
2830
3556
|
|
|
3557
|
+
// src/wire-02-warnings.ts
|
|
3558
|
+
var WARNING_TYPE_UNREGISTERED = "type_unregistered";
|
|
3559
|
+
var WARNING_UNKNOWN_EXTENSION = "unknown_extension_preserved";
|
|
3560
|
+
var WARNING_OCCURRED_AT_SKEW = "occurred_at_skew";
|
|
3561
|
+
var WARNING_TYP_MISSING = "typ_missing";
|
|
3562
|
+
function sortWarnings(warnings) {
|
|
3563
|
+
return [...warnings].sort((a, b) => {
|
|
3564
|
+
const aHasPtr = a.pointer !== void 0;
|
|
3565
|
+
const bHasPtr = b.pointer !== void 0;
|
|
3566
|
+
if (!aHasPtr && bHasPtr) return -1;
|
|
3567
|
+
if (aHasPtr && !bHasPtr) return 1;
|
|
3568
|
+
if (aHasPtr && bHasPtr) {
|
|
3569
|
+
const cmp = a.pointer.localeCompare(b.pointer);
|
|
3570
|
+
if (cmp !== 0) return cmp;
|
|
3571
|
+
}
|
|
3572
|
+
return a.code.localeCompare(b.code);
|
|
3573
|
+
});
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
// src/wire-02-registries.ts
|
|
3577
|
+
var REGISTERED_RECEIPT_TYPES = /* @__PURE__ */ new Set([
|
|
3578
|
+
"org.peacprotocol/payment",
|
|
3579
|
+
"org.peacprotocol/access-decision",
|
|
3580
|
+
"org.peacprotocol/identity-attestation",
|
|
3581
|
+
"org.peacprotocol/consent-record",
|
|
3582
|
+
"org.peacprotocol/compliance-check",
|
|
3583
|
+
"org.peacprotocol/privacy-signal",
|
|
3584
|
+
"org.peacprotocol/safety-review",
|
|
3585
|
+
"org.peacprotocol/provenance-record",
|
|
3586
|
+
"org.peacprotocol/attribution-event",
|
|
3587
|
+
"org.peacprotocol/purpose-declaration"
|
|
3588
|
+
]);
|
|
3589
|
+
var REGISTERED_EXTENSION_GROUP_KEYS = /* @__PURE__ */ new Set([
|
|
3590
|
+
"org.peacprotocol/commerce",
|
|
3591
|
+
"org.peacprotocol/access",
|
|
3592
|
+
"org.peacprotocol/challenge",
|
|
3593
|
+
"org.peacprotocol/identity",
|
|
3594
|
+
"org.peacprotocol/correlation"
|
|
3595
|
+
]);
|
|
3596
|
+
|
|
3597
|
+
// src/policy-binding.ts
|
|
3598
|
+
function verifyPolicyBinding(receiptDigest, localDigest) {
|
|
3599
|
+
return receiptDigest === localDigest ? "verified" : "failed";
|
|
3600
|
+
}
|
|
3601
|
+
var REVOCATION_REASONS = [
|
|
3602
|
+
"key_compromise",
|
|
3603
|
+
"superseded",
|
|
3604
|
+
"cessation_of_operation",
|
|
3605
|
+
"privilege_withdrawn"
|
|
3606
|
+
];
|
|
3607
|
+
var RevokedKeyEntrySchema = zod.z.object({
|
|
3608
|
+
/** Key ID that was revoked */
|
|
3609
|
+
kid: zod.z.string().min(1).max(256),
|
|
3610
|
+
/** ISO 8601 timestamp of revocation */
|
|
3611
|
+
revoked_at: zod.z.string().datetime(),
|
|
3612
|
+
/** Revocation reason (optional, RFC 5280 CRLReason subset) */
|
|
3613
|
+
reason: zod.z.enum(REVOCATION_REASONS).optional()
|
|
3614
|
+
}).strict();
|
|
3615
|
+
var RevokedKeysArraySchema = zod.z.array(RevokedKeyEntrySchema).max(100);
|
|
3616
|
+
function validateRevokedKeys(data) {
|
|
3617
|
+
const result = RevokedKeysArraySchema.safeParse(data);
|
|
3618
|
+
if (result.success) {
|
|
3619
|
+
return { ok: true, value: result.data };
|
|
3620
|
+
}
|
|
3621
|
+
return { ok: false, error: result.error.issues.map((i) => i.message).join("; ") };
|
|
3622
|
+
}
|
|
3623
|
+
function findRevokedKey(revokedKeys, kid) {
|
|
3624
|
+
return revokedKeys.find((entry) => entry.kid === kid) ?? null;
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3627
|
+
exports.ACCESS_EXTENSION_KEY = ACCESS_EXTENSION_KEY;
|
|
3628
|
+
exports.ACTOR_BINDING_EXTENSION_KEY = ACTOR_BINDING_EXTENSION_KEY;
|
|
2831
3629
|
exports.AGENT_IDENTITY_TYPE = AGENT_IDENTITY_TYPE;
|
|
2832
3630
|
exports.AIPREFSnapshotSchema = AIPREFSnapshot;
|
|
2833
3631
|
exports.ATTESTATION_LIMITS = ATTESTATION_LIMITS;
|
|
@@ -2835,6 +3633,8 @@ exports.ATTESTATION_RECEIPT_TYPE = ATTESTATION_RECEIPT_TYPE;
|
|
|
2835
3633
|
exports.ATTRIBUTION_LIMITS = ATTRIBUTION_LIMITS;
|
|
2836
3634
|
exports.ATTRIBUTION_TYPE = ATTRIBUTION_TYPE;
|
|
2837
3635
|
exports.ATTRIBUTION_USAGES = ATTRIBUTION_USAGES;
|
|
3636
|
+
exports.AccessExtensionSchema = AccessExtensionSchema;
|
|
3637
|
+
exports.ActorBindingSchema = ActorBindingSchema;
|
|
2838
3638
|
exports.AgentIdentityAttestationSchema = AgentIdentityAttestationSchema;
|
|
2839
3639
|
exports.AgentIdentityEvidenceSchema = AgentIdentityEvidenceSchema;
|
|
2840
3640
|
exports.AgentIdentityVerifiedSchema = AgentIdentityVerifiedSchema;
|
|
@@ -2850,23 +3650,45 @@ exports.BindingDetailsSchema = BindingDetailsSchema;
|
|
|
2850
3650
|
exports.CANONICAL_DIGEST_ALGS = CANONICAL_DIGEST_ALGS;
|
|
2851
3651
|
exports.CANONICAL_PURPOSES = CANONICAL_PURPOSES;
|
|
2852
3652
|
exports.CARRIER_TRANSPORT_LIMITS = CARRIER_TRANSPORT_LIMITS;
|
|
3653
|
+
exports.CHALLENGE_EXTENSION_KEY = CHALLENGE_EXTENSION_KEY;
|
|
3654
|
+
exports.CHALLENGE_TYPES = CHALLENGE_TYPES;
|
|
3655
|
+
exports.COMMERCE_EXTENSION_KEY = COMMERCE_EXTENSION_KEY;
|
|
3656
|
+
exports.COMMITMENT_CLASSES = COMMITMENT_CLASSES;
|
|
2853
3657
|
exports.CONTRIBUTION_TYPES = CONTRIBUTION_TYPES;
|
|
3658
|
+
exports.CONTROL_ACTIONS = CONTROL_ACTIONS;
|
|
3659
|
+
exports.CONTROL_ACTION_EXTENSION_KEY = CONTROL_ACTION_EXTENSION_KEY;
|
|
3660
|
+
exports.CONTROL_TRIGGERS = CONTROL_TRIGGERS;
|
|
2854
3661
|
exports.CONTROL_TYPES = CONTROL_TYPES;
|
|
3662
|
+
exports.CORRELATION_EXTENSION_KEY = CORRELATION_EXTENSION_KEY;
|
|
3663
|
+
exports.CREDENTIAL_EVENTS = CREDENTIAL_EVENTS;
|
|
3664
|
+
exports.CREDENTIAL_EVENT_EXTENSION_KEY = CREDENTIAL_EVENT_EXTENSION_KEY;
|
|
2855
3665
|
exports.CREDIT_METHODS = CREDIT_METHODS;
|
|
3666
|
+
exports.CanonicalIssSchema = CanonicalIssSchema;
|
|
2856
3667
|
exports.CanonicalPurposeSchema = CanonicalPurposeSchema;
|
|
2857
3668
|
exports.CarrierFormatSchema = CarrierFormatSchema;
|
|
2858
3669
|
exports.CarrierMetaSchema = CarrierMetaSchema;
|
|
3670
|
+
exports.ChallengeExtensionSchema = ChallengeExtensionSchema;
|
|
3671
|
+
exports.ChallengeTypeSchema = ChallengeTypeSchema;
|
|
3672
|
+
exports.CommerceExtensionSchema = CommerceExtensionSchema;
|
|
3673
|
+
exports.CommitmentClassSchema = CommitmentClassSchema;
|
|
2859
3674
|
exports.CompactJwsSchema = CompactJwsSchema;
|
|
2860
3675
|
exports.ContactMethodSchema = ContactMethodSchema;
|
|
2861
3676
|
exports.ContentHashSchema = ContentHashSchema;
|
|
2862
3677
|
exports.ContributionObligationSchema = ContributionObligationSchema;
|
|
2863
3678
|
exports.ContributionTypeSchema = ContributionTypeSchema;
|
|
3679
|
+
exports.ControlActionSchema = ControlActionSchema;
|
|
3680
|
+
exports.ControlActionTypeSchema = ControlActionTypeSchema;
|
|
2864
3681
|
exports.ControlBlockSchema = ControlBlockSchema;
|
|
2865
3682
|
exports.ControlDecisionSchema = ControlDecisionSchema;
|
|
2866
3683
|
exports.ControlLicensingModeSchema = ControlLicensingModeSchema;
|
|
2867
3684
|
exports.ControlPurposeSchema = ControlPurposeSchema;
|
|
2868
3685
|
exports.ControlStepSchema = ControlStepSchema;
|
|
3686
|
+
exports.ControlTriggerSchema = ControlTriggerSchema;
|
|
2869
3687
|
exports.ControlTypeSchema = ControlTypeSchema;
|
|
3688
|
+
exports.CorrelationExtensionSchema = CorrelationExtensionSchema;
|
|
3689
|
+
exports.CredentialEventSchema = CredentialEventSchema;
|
|
3690
|
+
exports.CredentialEventTypeSchema = CredentialEventTypeSchema;
|
|
3691
|
+
exports.CredentialRefSchema = CredentialRefSchema;
|
|
2870
3692
|
exports.CreditMethodSchema = CreditMethodSchema;
|
|
2871
3693
|
exports.CreditObligationSchema = CreditObligationSchema;
|
|
2872
3694
|
exports.DERIVATION_TYPES = DERIVATION_TYPES;
|
|
@@ -2898,15 +3720,19 @@ exports.DocumentRefSchema = DocumentRefSchema;
|
|
|
2898
3720
|
exports.ERROR_CATEGORIES_CANONICAL = ERROR_CATEGORIES_CANONICAL;
|
|
2899
3721
|
exports.ERROR_CODES = ERROR_CODES;
|
|
2900
3722
|
exports.EXTENSION_KEY_PATTERN = EXTENSION_KEY_PATTERN;
|
|
3723
|
+
exports.EXTENSION_LIMITS = EXTENSION_LIMITS;
|
|
3724
|
+
exports.EvidencePillarSchema = EvidencePillarSchema;
|
|
2901
3725
|
exports.ExecutorSchema = ExecutorSchema;
|
|
2902
3726
|
exports.Extensions = Extensions;
|
|
2903
3727
|
exports.ExtensionsSchema = ExtensionsSchema;
|
|
2904
3728
|
exports.HashAlgorithmSchema = HashAlgorithmSchema;
|
|
2905
3729
|
exports.HashEncodingSchema = HashEncodingSchema;
|
|
3730
|
+
exports.IDENTITY_EXTENSION_KEY = IDENTITY_EXTENSION_KEY;
|
|
2906
3731
|
exports.INTERACTION_EXTENSION_KEY = INTERACTION_EXTENSION_KEY;
|
|
2907
3732
|
exports.INTERACTION_LIMITS = INTERACTION_LIMITS;
|
|
2908
3733
|
exports.INTERNAL_PURPOSE_UNDECLARED = INTERNAL_PURPOSE_UNDECLARED;
|
|
2909
3734
|
exports.IdentityBindingSchema = IdentityBindingSchema;
|
|
3735
|
+
exports.IdentityExtensionSchema = IdentityExtensionSchema;
|
|
2910
3736
|
exports.InteractionEvidenceV01Schema = InteractionEvidenceV01Schema;
|
|
2911
3737
|
exports.JSON_EVIDENCE_LIMITS = JSON_EVIDENCE_LIMITS;
|
|
2912
3738
|
exports.JWSHeader = JWSHeader;
|
|
@@ -2920,6 +3746,9 @@ exports.KindSchema = KindSchema;
|
|
|
2920
3746
|
exports.MAX_PURPOSE_TOKENS_PER_REQUEST = MAX_PURPOSE_TOKENS_PER_REQUEST;
|
|
2921
3747
|
exports.MAX_PURPOSE_TOKEN_LENGTH = MAX_PURPOSE_TOKEN_LENGTH;
|
|
2922
3748
|
exports.MIDDLEWARE_INTERACTION_KEY = MIDDLEWARE_INTERACTION_KEY;
|
|
3749
|
+
exports.MVISFieldsSchema = MVISFieldsSchema;
|
|
3750
|
+
exports.MVISReplayProtectionSchema = MVISReplayProtectionSchema;
|
|
3751
|
+
exports.MVISTimeBoundsSchema = MVISTimeBoundsSchema;
|
|
2923
3752
|
exports.MinimalInteractionBindingSchema = MinimalInteractionBindingSchema;
|
|
2924
3753
|
exports.NormalizedPayment = NormalizedPayment;
|
|
2925
3754
|
exports.OBLIGATIONS_EXTENSION_KEY = OBLIGATIONS_EXTENSION_KEY;
|
|
@@ -2943,6 +3772,7 @@ exports.PEAC_RECEIPT_SCHEMA_URL = PEAC_RECEIPT_SCHEMA_URL;
|
|
|
2943
3772
|
exports.PEAC_WIRE_TYP = PEAC_WIRE_TYP;
|
|
2944
3773
|
exports.POLICY_DECISIONS = POLICY_DECISIONS;
|
|
2945
3774
|
exports.PROOF_METHODS = PROOF_METHODS;
|
|
3775
|
+
exports.PROOF_TYPES = PROOF_TYPES;
|
|
2946
3776
|
exports.PURPOSE_REASONS = PURPOSE_REASONS;
|
|
2947
3777
|
exports.PURPOSE_TOKEN_REGEX = PURPOSE_TOKEN_REGEX;
|
|
2948
3778
|
exports.PayloadRefSchema = PayloadRefSchema;
|
|
@@ -2950,23 +3780,35 @@ exports.PaymentEvidenceSchema = PaymentEvidenceSchema;
|
|
|
2950
3780
|
exports.PaymentRoutingSchema = PaymentRoutingSchema;
|
|
2951
3781
|
exports.PaymentSplitSchema = PaymentSplitSchema;
|
|
2952
3782
|
exports.PeacEvidenceCarrierSchema = PeacEvidenceCarrierSchema;
|
|
3783
|
+
exports.PillarsSchema = PillarsSchema;
|
|
3784
|
+
exports.PolicyBlockSchema = PolicyBlockSchema;
|
|
2953
3785
|
exports.PolicyContextSchema = PolicyContextSchema;
|
|
3786
|
+
exports.ProblemDetailsSchema = ProblemDetailsSchema;
|
|
2954
3787
|
exports.ProofMethodSchema = ProofMethodSchema;
|
|
3788
|
+
exports.ProofTypeSchema = ProofTypeSchema;
|
|
2955
3789
|
exports.PurposeReasonSchema = PurposeReasonSchema;
|
|
2956
3790
|
exports.PurposeTokenSchema = PurposeTokenSchema;
|
|
2957
3791
|
exports.REDACTION_MODES = REDACTION_MODES;
|
|
3792
|
+
exports.REGISTERED_EXTENSION_GROUP_KEYS = REGISTERED_EXTENSION_GROUP_KEYS;
|
|
3793
|
+
exports.REGISTERED_RECEIPT_TYPES = REGISTERED_RECEIPT_TYPES;
|
|
2958
3794
|
exports.REMEDIATION_TYPES = REMEDIATION_TYPES;
|
|
3795
|
+
exports.REPRESENTATION_LIMITS = REPRESENTATION_LIMITS;
|
|
2959
3796
|
exports.RESERVED_KIND_PREFIXES = RESERVED_KIND_PREFIXES;
|
|
2960
3797
|
exports.RESULT_STATUSES = RESULT_STATUSES;
|
|
3798
|
+
exports.REVOCATION_REASONS = REVOCATION_REASONS;
|
|
2961
3799
|
exports.ReceiptClaims = ReceiptClaims;
|
|
2962
3800
|
exports.ReceiptClaimsSchema = ReceiptClaimsSchema;
|
|
2963
3801
|
exports.ReceiptRefSchema = ReceiptRefSchema2;
|
|
3802
|
+
exports.ReceiptTypeSchema = ReceiptTypeSchema;
|
|
2964
3803
|
exports.ReceiptUrlSchema = ReceiptUrlSchema;
|
|
2965
3804
|
exports.RefsSchema = RefsSchema;
|
|
2966
3805
|
exports.RemediationSchema = RemediationSchema;
|
|
2967
3806
|
exports.RemediationTypeSchema = RemediationTypeSchema;
|
|
3807
|
+
exports.RepresentationFieldsSchema = Wire02RepresentationFieldsSchema;
|
|
2968
3808
|
exports.ResourceTargetSchema = ResourceTargetSchema;
|
|
2969
3809
|
exports.ResultSchema = ResultSchema;
|
|
3810
|
+
exports.RevokedKeyEntrySchema = RevokedKeyEntrySchema;
|
|
3811
|
+
exports.RevokedKeysArraySchema = RevokedKeysArraySchema;
|
|
2970
3812
|
exports.STEP_ID_PATTERN = STEP_ID_PATTERN;
|
|
2971
3813
|
exports.StepIdSchema = StepIdSchema;
|
|
2972
3814
|
exports.SubjectProfileSchema = SubjectProfileSchema;
|
|
@@ -2974,14 +3816,26 @@ exports.SubjectProfileSnapshotSchema = SubjectProfileSnapshotSchema;
|
|
|
2974
3816
|
exports.SubjectSchema = Subject;
|
|
2975
3817
|
exports.SubjectTypeSchema = SubjectTypeSchema;
|
|
2976
3818
|
exports.TERMINAL_STATES = TERMINAL_STATES;
|
|
3819
|
+
exports.TOOL_REGISTRY_EXTENSION_KEY = TOOL_REGISTRY_EXTENSION_KEY;
|
|
3820
|
+
exports.TREATY_EXTENSION_KEY = TREATY_EXTENSION_KEY;
|
|
3821
|
+
exports.ToolRegistrySchema = ToolRegistrySchema;
|
|
2977
3822
|
exports.ToolTargetSchema = ToolTargetSchema;
|
|
3823
|
+
exports.TreatySchema = TreatySchema;
|
|
2978
3824
|
exports.VerifyRequestSchema = VerifyRequest;
|
|
3825
|
+
exports.WARNING_OCCURRED_AT_SKEW = WARNING_OCCURRED_AT_SKEW;
|
|
3826
|
+
exports.WARNING_TYPE_UNREGISTERED = WARNING_TYPE_UNREGISTERED;
|
|
3827
|
+
exports.WARNING_TYP_MISSING = WARNING_TYP_MISSING;
|
|
3828
|
+
exports.WARNING_UNKNOWN_EXTENSION = WARNING_UNKNOWN_EXTENSION;
|
|
2979
3829
|
exports.WELL_KNOWN_KINDS = WELL_KNOWN_KINDS;
|
|
2980
3830
|
exports.WORKFLOW_EXTENSION_KEY = WORKFLOW_EXTENSION_KEY;
|
|
2981
3831
|
exports.WORKFLOW_ID_PATTERN = WORKFLOW_ID_PATTERN;
|
|
2982
3832
|
exports.WORKFLOW_LIMITS = WORKFLOW_LIMITS;
|
|
2983
3833
|
exports.WORKFLOW_STATUSES = WORKFLOW_STATUSES;
|
|
2984
3834
|
exports.WORKFLOW_SUMMARY_TYPE = WORKFLOW_SUMMARY_TYPE;
|
|
3835
|
+
exports.Wire01JWSHeaderSchema = Wire01JWSHeaderSchema;
|
|
3836
|
+
exports.Wire02ClaimsSchema = Wire02ClaimsSchema;
|
|
3837
|
+
exports.Wire02KindSchema = Wire02KindSchema;
|
|
3838
|
+
exports.Wire02RepresentationFieldsSchema = Wire02RepresentationFieldsSchema;
|
|
2985
3839
|
exports.WorkflowContextSchema = WorkflowContextSchema;
|
|
2986
3840
|
exports.WorkflowErrorContextSchema = WorkflowErrorContextSchema;
|
|
2987
3841
|
exports.WorkflowIdSchema = WorkflowIdSchema;
|
|
@@ -2990,6 +3844,7 @@ exports.WorkflowSummaryAttestationSchema = WorkflowSummaryAttestationSchema;
|
|
|
2990
3844
|
exports.WorkflowSummaryEvidenceSchema = WorkflowSummaryEvidenceSchema;
|
|
2991
3845
|
exports.assertJsonSafeIterative = assertJsonSafeIterative;
|
|
2992
3846
|
exports.canTransitionTo = canTransitionTo;
|
|
3847
|
+
exports.checkOccurredAtSkew = checkOccurredAtSkew;
|
|
2993
3848
|
exports.computeReceiptRef = computeReceiptRef;
|
|
2994
3849
|
exports.computeTotalWeight = computeTotalWeight;
|
|
2995
3850
|
exports.createAgentIdentityAttestation = createAgentIdentityAttestation;
|
|
@@ -3012,8 +3867,16 @@ exports.createWorkflowId = createWorkflowId;
|
|
|
3012
3867
|
exports.createWorkflowSummaryAttestation = createWorkflowSummaryAttestation;
|
|
3013
3868
|
exports.deriveKnownPurposes = deriveKnownPurposes;
|
|
3014
3869
|
exports.detectCycleInSources = detectCycleInSources;
|
|
3870
|
+
exports.detectWireVersion = detectWireVersion;
|
|
3015
3871
|
exports.determinePurposeReason = determinePurposeReason;
|
|
3016
3872
|
exports.extractObligationsExtension = extractObligationsExtension;
|
|
3873
|
+
exports.findRevokedKey = findRevokedKey;
|
|
3874
|
+
exports.fingerprintRefToString = fingerprintRefToString;
|
|
3875
|
+
exports.getAccessExtension = getAccessExtension;
|
|
3876
|
+
exports.getChallengeExtension = getChallengeExtension;
|
|
3877
|
+
exports.getCommerceExtension = getCommerceExtension;
|
|
3878
|
+
exports.getCorrelationExtension = getCorrelationExtension;
|
|
3879
|
+
exports.getIdentityExtension = getIdentityExtension;
|
|
3017
3880
|
exports.getInteraction = getInteraction;
|
|
3018
3881
|
exports.getValidTransitions = getValidTransitions;
|
|
3019
3882
|
exports.hasInteraction = hasInteraction;
|
|
@@ -3027,6 +3890,7 @@ exports.isAttestationReceiptClaims = isAttestationReceiptClaims;
|
|
|
3027
3890
|
exports.isAttributionAttestation = isAttributionAttestation;
|
|
3028
3891
|
exports.isAttributionExpired = isAttributionExpired;
|
|
3029
3892
|
exports.isAttributionNotYetValid = isAttributionNotYetValid;
|
|
3893
|
+
exports.isCanonicalIss = isCanonicalIss;
|
|
3030
3894
|
exports.isCanonicalPurpose = isCanonicalPurpose;
|
|
3031
3895
|
exports.isContributionRequired = isContributionRequired;
|
|
3032
3896
|
exports.isCreditRequired = isCreditRequired;
|
|
@@ -3036,15 +3900,18 @@ exports.isDisputeExpired = isDisputeExpired;
|
|
|
3036
3900
|
exports.isDisputeNotYetValid = isDisputeNotYetValid;
|
|
3037
3901
|
exports.isLegacyPurpose = isLegacyPurpose;
|
|
3038
3902
|
exports.isMinimalInteractionBinding = isMinimalInteractionBinding;
|
|
3903
|
+
exports.isOriginOnly = isOriginOnly;
|
|
3039
3904
|
exports.isPaymentReceipt = isPaymentReceipt;
|
|
3040
3905
|
exports.isReservedKindPrefix = isReservedKindPrefix;
|
|
3041
3906
|
exports.isTerminalState = isTerminalState;
|
|
3042
3907
|
exports.isTerminalWorkflowStatus = isTerminalWorkflowStatus;
|
|
3043
3908
|
exports.isUndeclaredPurpose = isUndeclaredPurpose;
|
|
3044
3909
|
exports.isValidDisputeAttestation = isValidDisputeAttestation;
|
|
3910
|
+
exports.isValidExtensionKey = isValidExtensionKey;
|
|
3045
3911
|
exports.isValidInteractionEvidence = isValidInteractionEvidence;
|
|
3046
3912
|
exports.isValidPurposeReason = isValidPurposeReason;
|
|
3047
3913
|
exports.isValidPurposeToken = isValidPurposeToken;
|
|
3914
|
+
exports.isValidReceiptType = isValidReceiptType;
|
|
3048
3915
|
exports.isValidWorkflowContext = isValidWorkflowContext;
|
|
3049
3916
|
exports.isWellKnownKind = isWellKnownKind;
|
|
3050
3917
|
exports.isWorkflowSummaryAttestation = isWorkflowSummaryAttestation;
|
|
@@ -3054,8 +3921,11 @@ exports.normalizeToCanonicalOrPreserve = normalizeToCanonicalOrPreserve;
|
|
|
3054
3921
|
exports.parsePurposeHeader = parsePurposeHeader;
|
|
3055
3922
|
exports.parseReceiptClaims = parseReceiptClaims;
|
|
3056
3923
|
exports.setInteraction = setInteraction;
|
|
3924
|
+
exports.sortWarnings = sortWarnings;
|
|
3925
|
+
exports.stringToFingerprintRef = stringToFingerprintRef;
|
|
3057
3926
|
exports.toCoreClaims = toCoreClaims;
|
|
3058
3927
|
exports.transitionDisputeState = transitionDisputeState;
|
|
3928
|
+
exports.validateActorBinding = validateActorBinding;
|
|
3059
3929
|
exports.validateAgentIdentityAttestation = validateAgentIdentityAttestation;
|
|
3060
3930
|
exports.validateAttestationReceiptClaims = validateAttestationReceiptClaims;
|
|
3061
3931
|
exports.validateAttributionAttestation = validateAttributionAttestation;
|
|
@@ -3063,6 +3933,8 @@ exports.validateAttributionSource = validateAttributionSource;
|
|
|
3063
3933
|
exports.validateCarrierConstraints = validateCarrierConstraints;
|
|
3064
3934
|
exports.validateContentHash = validateContentHash;
|
|
3065
3935
|
exports.validateContributionObligation = validateContributionObligation;
|
|
3936
|
+
exports.validateControlAction = validateControlAction;
|
|
3937
|
+
exports.validateCredentialEvent = validateCredentialEvent;
|
|
3066
3938
|
exports.validateCreditObligation = validateCreditObligation;
|
|
3067
3939
|
exports.validateDisputeAttestation = validateDisputeAttestation;
|
|
3068
3940
|
exports.validateDisputeContact = validateDisputeContact;
|
|
@@ -3073,13 +3945,19 @@ exports.validateInteraction = validateInteraction;
|
|
|
3073
3945
|
exports.validateInteractionEvidence = validateInteractionEvidence;
|
|
3074
3946
|
exports.validateInteractionOrdered = validateInteractionOrdered;
|
|
3075
3947
|
exports.validateKernelConstraints = validateKernelConstraints;
|
|
3948
|
+
exports.validateKnownExtensions = validateKnownExtensions;
|
|
3949
|
+
exports.validateMVIS = validateMVIS;
|
|
3076
3950
|
exports.validateMinimalInteractionBinding = validateMinimalInteractionBinding;
|
|
3077
3951
|
exports.validateObligationsExtension = validateObligationsExtension;
|
|
3078
3952
|
exports.validatePurposeTokens = validatePurposeTokens;
|
|
3953
|
+
exports.validateRevokedKeys = validateRevokedKeys;
|
|
3079
3954
|
exports.validateSubjectSnapshot = validateSubjectSnapshot;
|
|
3955
|
+
exports.validateToolRegistry = validateToolRegistry;
|
|
3956
|
+
exports.validateTreaty = validateTreaty;
|
|
3080
3957
|
exports.validateWorkflowContext = validateWorkflowContext;
|
|
3081
3958
|
exports.validateWorkflowContextOrdered = validateWorkflowContextOrdered;
|
|
3082
3959
|
exports.validateWorkflowSummaryAttestation = validateWorkflowSummaryAttestation;
|
|
3960
|
+
exports.verifyPolicyBinding = verifyPolicyBinding;
|
|
3083
3961
|
exports.verifyReceiptRefConsistency = verifyReceiptRefConsistency;
|
|
3084
3962
|
//# sourceMappingURL=index.cjs.map
|
|
3085
3963
|
//# sourceMappingURL=index.cjs.map
|