@peac/schema 0.11.1 → 0.11.3
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/carrier.d.ts +6 -0
- package/dist/carrier.d.ts.map +1 -1
- package/dist/dispute.d.ts +4 -4
- 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 +390 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +352 -2
- package/dist/index.mjs.map +1 -1
- package/dist/interaction.cjs +2 -1
- package/dist/interaction.cjs.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.d.ts.map +1 -1
- package/dist/interaction.mjs +2 -1
- package/dist/interaction.mjs.map +1 -1
- package/dist/issuer-config.d.ts +61 -0
- package/dist/issuer-config.d.ts.map +1 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1156,6 +1156,306 @@ function validateEvidence(evidence, limits) {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
return { ok: true, value: evidence };
|
|
1158
1158
|
}
|
|
1159
|
+
var PROOF_TYPES = [
|
|
1160
|
+
"ed25519-cert-chain",
|
|
1161
|
+
"eat-passport",
|
|
1162
|
+
"eat-background-check",
|
|
1163
|
+
"sigstore-oidc",
|
|
1164
|
+
"did",
|
|
1165
|
+
"spiffe",
|
|
1166
|
+
"x509-pki",
|
|
1167
|
+
"custom"
|
|
1168
|
+
];
|
|
1169
|
+
var ProofTypeSchema = zod.z.enum(PROOF_TYPES);
|
|
1170
|
+
function isOriginOnly(value) {
|
|
1171
|
+
try {
|
|
1172
|
+
const url = new URL(value);
|
|
1173
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
1174
|
+
return false;
|
|
1175
|
+
}
|
|
1176
|
+
if (url.pathname !== "/") {
|
|
1177
|
+
return false;
|
|
1178
|
+
}
|
|
1179
|
+
if (url.search !== "") {
|
|
1180
|
+
return false;
|
|
1181
|
+
}
|
|
1182
|
+
if (url.hash !== "" || value.includes("#")) {
|
|
1183
|
+
return false;
|
|
1184
|
+
}
|
|
1185
|
+
if (url.username !== "" || url.password !== "") {
|
|
1186
|
+
return false;
|
|
1187
|
+
}
|
|
1188
|
+
if (url.hostname.endsWith(".")) {
|
|
1189
|
+
return false;
|
|
1190
|
+
}
|
|
1191
|
+
const hostPart = value.replace(/^https?:\/\//, "").split(/[/:]/)[0];
|
|
1192
|
+
if (hostPart.endsWith(".")) {
|
|
1193
|
+
return false;
|
|
1194
|
+
}
|
|
1195
|
+
if (url.hostname.includes("%")) {
|
|
1196
|
+
return false;
|
|
1197
|
+
}
|
|
1198
|
+
return true;
|
|
1199
|
+
} catch {
|
|
1200
|
+
return false;
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
var ACTOR_BINDING_EXTENSION_KEY = "org.peacprotocol/actor_binding";
|
|
1204
|
+
var ActorBindingSchema = zod.z.object({
|
|
1205
|
+
/** Stable actor identifier (opaque, no PII) */
|
|
1206
|
+
id: zod.z.string().min(1).max(256),
|
|
1207
|
+
/** Proof type from DD-143 multi-root vocabulary */
|
|
1208
|
+
proof_type: ProofTypeSchema,
|
|
1209
|
+
/** URI or hash of external proof artifact */
|
|
1210
|
+
proof_ref: zod.z.string().max(2048).optional(),
|
|
1211
|
+
/** Origin-only URL: scheme + host + optional port; NO path, query, or fragment */
|
|
1212
|
+
origin: zod.z.string().max(2048).refine(isOriginOnly, {
|
|
1213
|
+
message: "origin must be an origin-only URL (scheme + host + optional port; no path, query, or fragment)"
|
|
1214
|
+
}),
|
|
1215
|
+
/** SHA-256 hash of the intent (hash-first per DD-138) */
|
|
1216
|
+
intent_hash: zod.z.string().regex(/^sha256:[a-f0-9]{64}$/, {
|
|
1217
|
+
message: "intent_hash must match sha256:<64 hex chars>"
|
|
1218
|
+
}).optional()
|
|
1219
|
+
}).strict();
|
|
1220
|
+
var MVISTimeBoundsSchema = zod.z.object({
|
|
1221
|
+
/** Earliest valid time (RFC 3339) */
|
|
1222
|
+
not_before: zod.z.string().datetime(),
|
|
1223
|
+
/** Latest valid time (RFC 3339) */
|
|
1224
|
+
not_after: zod.z.string().datetime()
|
|
1225
|
+
}).strict();
|
|
1226
|
+
var MVISReplayProtectionSchema = zod.z.object({
|
|
1227
|
+
/** Unique token identifier (jti from JWT or equivalent) */
|
|
1228
|
+
jti: zod.z.string().min(1).max(256),
|
|
1229
|
+
/** Optional nonce for additional replay protection */
|
|
1230
|
+
nonce: zod.z.string().max(256).optional()
|
|
1231
|
+
}).strict();
|
|
1232
|
+
var MVISFieldsSchema = zod.z.object({
|
|
1233
|
+
/** Who issued the identity assertion */
|
|
1234
|
+
issuer: zod.z.string().min(1).max(2048),
|
|
1235
|
+
/** Who the identity is about (opaque identifier, no PII) */
|
|
1236
|
+
subject: zod.z.string().min(1).max(256),
|
|
1237
|
+
/** Cryptographic binding: kid or JWK thumbprint */
|
|
1238
|
+
key_binding: zod.z.string().min(1).max(256),
|
|
1239
|
+
/** Validity period */
|
|
1240
|
+
time_bounds: MVISTimeBoundsSchema,
|
|
1241
|
+
/** Replay protection */
|
|
1242
|
+
replay_protection: MVISReplayProtectionSchema
|
|
1243
|
+
}).strict();
|
|
1244
|
+
function validateActorBinding(data) {
|
|
1245
|
+
const result = ActorBindingSchema.safeParse(data);
|
|
1246
|
+
if (result.success) {
|
|
1247
|
+
return { ok: true, value: result.data };
|
|
1248
|
+
}
|
|
1249
|
+
return { ok: false, error: result.error.message };
|
|
1250
|
+
}
|
|
1251
|
+
function validateMVIS(data) {
|
|
1252
|
+
const result = MVISFieldsSchema.safeParse(data);
|
|
1253
|
+
if (!result.success) {
|
|
1254
|
+
return { ok: false, error: result.error.message };
|
|
1255
|
+
}
|
|
1256
|
+
const notBefore = new Date(result.data.time_bounds.not_before).getTime();
|
|
1257
|
+
const notAfter = new Date(result.data.time_bounds.not_after).getTime();
|
|
1258
|
+
if (notBefore >= notAfter) {
|
|
1259
|
+
return { ok: false, error: "not_before must be before not_after" };
|
|
1260
|
+
}
|
|
1261
|
+
const MAX_DURATION_MS = 100 * 365.25 * 24 * 60 * 60 * 1e3;
|
|
1262
|
+
if (notAfter - notBefore > MAX_DURATION_MS) {
|
|
1263
|
+
return { ok: false, error: "time_bounds duration must not exceed 100 years" };
|
|
1264
|
+
}
|
|
1265
|
+
return { ok: true, value: result.data };
|
|
1266
|
+
}
|
|
1267
|
+
var CREDENTIAL_EVENT_EXTENSION_KEY = "org.peacprotocol/credential_event";
|
|
1268
|
+
var CREDENTIAL_EVENTS = ["issued", "leased", "rotated", "revoked", "expired"];
|
|
1269
|
+
var CredentialEventTypeSchema = zod.z.enum(CREDENTIAL_EVENTS);
|
|
1270
|
+
var FINGERPRINT_REF_PATTERN = /^(sha256|hmac-sha256):[a-f0-9]{64}$/;
|
|
1271
|
+
var CredentialRefSchema = zod.z.string().max(256).regex(FINGERPRINT_REF_PATTERN, {
|
|
1272
|
+
message: "credential_ref must be an opaque fingerprint reference: (sha256|hmac-sha256):<64 hex chars>"
|
|
1273
|
+
});
|
|
1274
|
+
var CredentialEventSchema = zod.z.object({
|
|
1275
|
+
/** Lifecycle event type */
|
|
1276
|
+
event: CredentialEventTypeSchema,
|
|
1277
|
+
/** Opaque fingerprint reference of the credential (format validation only) */
|
|
1278
|
+
credential_ref: CredentialRefSchema,
|
|
1279
|
+
/** Authority that performed the action (HTTPS URL) */
|
|
1280
|
+
authority: zod.z.string().url().max(2048).refine((v) => v.startsWith("https://"), {
|
|
1281
|
+
message: "authority must be an HTTPS URL"
|
|
1282
|
+
}),
|
|
1283
|
+
/** When the credential expires (RFC 3339, optional) */
|
|
1284
|
+
expires_at: zod.z.string().datetime().optional(),
|
|
1285
|
+
/** Previous credential reference for rotation chains (optional) */
|
|
1286
|
+
previous_ref: CredentialRefSchema.optional()
|
|
1287
|
+
}).strict();
|
|
1288
|
+
function validateCredentialEvent(data) {
|
|
1289
|
+
const result = CredentialEventSchema.safeParse(data);
|
|
1290
|
+
if (result.success) {
|
|
1291
|
+
return { ok: true, value: result.data };
|
|
1292
|
+
}
|
|
1293
|
+
return { ok: false, error: result.error.message };
|
|
1294
|
+
}
|
|
1295
|
+
var TOOL_REGISTRY_EXTENSION_KEY = "org.peacprotocol/tool_registry";
|
|
1296
|
+
function isAllowedRegistryUri(value) {
|
|
1297
|
+
if (value.startsWith("urn:")) {
|
|
1298
|
+
return true;
|
|
1299
|
+
}
|
|
1300
|
+
try {
|
|
1301
|
+
const url = new URL(value);
|
|
1302
|
+
return url.protocol === "https:";
|
|
1303
|
+
} catch {
|
|
1304
|
+
return false;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
var ToolRegistrySchema = zod.z.object({
|
|
1308
|
+
/** Tool identifier */
|
|
1309
|
+
tool_id: zod.z.string().min(1).max(256),
|
|
1310
|
+
/** Registry URI (HTTPS or URN only; no file:// or data:// for SSRF prevention) */
|
|
1311
|
+
registry_uri: zod.z.string().max(2048).refine(isAllowedRegistryUri, {
|
|
1312
|
+
message: "registry_uri must be an HTTPS URL or URN (file:// and data:// are prohibited)"
|
|
1313
|
+
}),
|
|
1314
|
+
/** Tool version (optional, semver-like) */
|
|
1315
|
+
version: zod.z.string().max(64).optional(),
|
|
1316
|
+
/** Tool capabilities (optional) */
|
|
1317
|
+
capabilities: zod.z.array(zod.z.string().max(64)).max(32).optional()
|
|
1318
|
+
}).strict();
|
|
1319
|
+
function validateToolRegistry(data) {
|
|
1320
|
+
const result = ToolRegistrySchema.safeParse(data);
|
|
1321
|
+
if (result.success) {
|
|
1322
|
+
return { ok: true, value: result.data };
|
|
1323
|
+
}
|
|
1324
|
+
return { ok: false, error: result.error.message };
|
|
1325
|
+
}
|
|
1326
|
+
var CONTROL_ACTION_EXTENSION_KEY = "org.peacprotocol/control_action";
|
|
1327
|
+
var CONTROL_ACTIONS = ["grant", "deny", "escalate", "delegate", "audit"];
|
|
1328
|
+
var ControlActionTypeSchema = zod.z.enum(CONTROL_ACTIONS);
|
|
1329
|
+
var CONTROL_TRIGGERS = [
|
|
1330
|
+
"policy_evaluation",
|
|
1331
|
+
"manual_review",
|
|
1332
|
+
"anomaly_detection",
|
|
1333
|
+
"scheduled",
|
|
1334
|
+
"event_driven"
|
|
1335
|
+
];
|
|
1336
|
+
var ControlTriggerSchema = zod.z.enum(CONTROL_TRIGGERS);
|
|
1337
|
+
var ControlActionSchema = zod.z.object({
|
|
1338
|
+
/** Action taken */
|
|
1339
|
+
action: ControlActionTypeSchema,
|
|
1340
|
+
/** What triggered the action */
|
|
1341
|
+
trigger: ControlTriggerSchema,
|
|
1342
|
+
/** Resource or scope the action applies to (optional) */
|
|
1343
|
+
resource: zod.z.string().max(2048).optional(),
|
|
1344
|
+
/** Reason for the action (optional, human-readable) */
|
|
1345
|
+
reason: zod.z.string().max(1024).optional(),
|
|
1346
|
+
/** Policy identifier that was evaluated (optional) */
|
|
1347
|
+
policy_ref: zod.z.string().max(2048).optional(),
|
|
1348
|
+
/** When the action was taken (RFC 3339, optional; defaults to receipt iat) */
|
|
1349
|
+
action_at: zod.z.string().datetime().optional()
|
|
1350
|
+
}).strict();
|
|
1351
|
+
function validateControlAction(data) {
|
|
1352
|
+
const result = ControlActionSchema.safeParse(data);
|
|
1353
|
+
if (result.success) {
|
|
1354
|
+
return { ok: true, value: result.data };
|
|
1355
|
+
}
|
|
1356
|
+
return { ok: false, error: result.error.message };
|
|
1357
|
+
}
|
|
1358
|
+
var TREATY_EXTENSION_KEY = "org.peacprotocol/treaty";
|
|
1359
|
+
var COMMITMENT_CLASSES = ["informational", "operational", "financial", "legal"];
|
|
1360
|
+
var CommitmentClassSchema = zod.z.enum(COMMITMENT_CLASSES);
|
|
1361
|
+
var TreatySchema = zod.z.object({
|
|
1362
|
+
/** Commitment level */
|
|
1363
|
+
commitment_class: CommitmentClassSchema,
|
|
1364
|
+
/** URL to full terms document (optional) */
|
|
1365
|
+
terms_ref: zod.z.string().url().max(2048).optional(),
|
|
1366
|
+
/** SHA-256 hash of terms document for integrity verification (optional) */
|
|
1367
|
+
terms_hash: zod.z.string().regex(/^sha256:[a-f0-9]{64}$/, {
|
|
1368
|
+
message: "terms_hash must match sha256:<64 hex chars>"
|
|
1369
|
+
}).optional(),
|
|
1370
|
+
/** Counterparty identifier (optional) */
|
|
1371
|
+
counterparty: zod.z.string().max(256).optional(),
|
|
1372
|
+
/** When the treaty becomes effective (RFC 3339, optional) */
|
|
1373
|
+
effective_at: zod.z.string().datetime().optional(),
|
|
1374
|
+
/** When the treaty expires (RFC 3339, optional) */
|
|
1375
|
+
expires_at: zod.z.string().datetime().optional()
|
|
1376
|
+
}).strict();
|
|
1377
|
+
function validateTreaty(data) {
|
|
1378
|
+
const result = TreatySchema.safeParse(data);
|
|
1379
|
+
if (!result.success) {
|
|
1380
|
+
return { ok: false, error: result.error.message };
|
|
1381
|
+
}
|
|
1382
|
+
if (result.data.effective_at && result.data.expires_at) {
|
|
1383
|
+
const effectiveMs = new Date(result.data.effective_at).getTime();
|
|
1384
|
+
const expiresMs = new Date(result.data.expires_at).getTime();
|
|
1385
|
+
if (effectiveMs > expiresMs) {
|
|
1386
|
+
return { ok: false, error: "effective_at must not be after expires_at" };
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
return { ok: true, value: result.data };
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
// src/extensions/fingerprint-ref.ts
|
|
1393
|
+
function hexToBase64url(hex) {
|
|
1394
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
1395
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
1396
|
+
bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
|
|
1397
|
+
}
|
|
1398
|
+
let base64;
|
|
1399
|
+
if (typeof Buffer !== "undefined") {
|
|
1400
|
+
base64 = Buffer.from(bytes).toString("base64");
|
|
1401
|
+
} else {
|
|
1402
|
+
base64 = btoa(String.fromCharCode(...bytes));
|
|
1403
|
+
}
|
|
1404
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1405
|
+
}
|
|
1406
|
+
function base64urlToHex(b64url) {
|
|
1407
|
+
let base64 = b64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1408
|
+
while (base64.length % 4 !== 0) {
|
|
1409
|
+
base64 += "=";
|
|
1410
|
+
}
|
|
1411
|
+
let bytes;
|
|
1412
|
+
if (typeof Buffer !== "undefined") {
|
|
1413
|
+
bytes = Buffer.from(base64, "base64");
|
|
1414
|
+
} else {
|
|
1415
|
+
const binary = atob(base64);
|
|
1416
|
+
bytes = new Uint8Array(binary.length);
|
|
1417
|
+
for (let i = 0; i < binary.length; i++) {
|
|
1418
|
+
bytes[i] = binary.charCodeAt(i);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1422
|
+
}
|
|
1423
|
+
var VALID_ALGS = ["sha256", "hmac-sha256"];
|
|
1424
|
+
var STRING_FORM_PATTERN = /^(sha256|hmac-sha256):([a-f0-9]{64})$/;
|
|
1425
|
+
var MAX_FINGERPRINT_REF_LENGTH = 76;
|
|
1426
|
+
var BASE64URL_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
1427
|
+
function stringToFingerprintRef(s) {
|
|
1428
|
+
if (s.length > MAX_FINGERPRINT_REF_LENGTH) {
|
|
1429
|
+
return null;
|
|
1430
|
+
}
|
|
1431
|
+
const match = STRING_FORM_PATTERN.exec(s);
|
|
1432
|
+
if (!match) {
|
|
1433
|
+
return null;
|
|
1434
|
+
}
|
|
1435
|
+
const alg = match[1];
|
|
1436
|
+
const hex = match[2];
|
|
1437
|
+
return {
|
|
1438
|
+
alg,
|
|
1439
|
+
value: hexToBase64url(hex)
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
function fingerprintRefToString(obj) {
|
|
1443
|
+
if (!VALID_ALGS.includes(obj.alg)) {
|
|
1444
|
+
return null;
|
|
1445
|
+
}
|
|
1446
|
+
if (!BASE64URL_PATTERN.test(obj.value)) {
|
|
1447
|
+
return null;
|
|
1448
|
+
}
|
|
1449
|
+
try {
|
|
1450
|
+
const hex = base64urlToHex(obj.value);
|
|
1451
|
+
if (hex.length !== 64) {
|
|
1452
|
+
return null;
|
|
1453
|
+
}
|
|
1454
|
+
return `${obj.alg}:${hex}`;
|
|
1455
|
+
} catch {
|
|
1456
|
+
return null;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1159
1459
|
var DISPUTE_LIMITS = {
|
|
1160
1460
|
/** Maximum grounds per dispute */
|
|
1161
1461
|
maxGrounds: 10,
|
|
@@ -1872,7 +2172,8 @@ var WELL_KNOWN_KINDS = [
|
|
|
1872
2172
|
"http.request",
|
|
1873
2173
|
"fs.read",
|
|
1874
2174
|
"fs.write",
|
|
1875
|
-
"message"
|
|
2175
|
+
"message",
|
|
2176
|
+
"inference.chat_completion"
|
|
1876
2177
|
];
|
|
1877
2178
|
var RESERVED_KIND_PREFIXES = ["peac.", "org.peacprotocol."];
|
|
1878
2179
|
var INTERACTION_LIMITS = {
|
|
@@ -2672,9 +2973,25 @@ var CompactJwsSchema = zod.z.string().regex(
|
|
|
2672
2973
|
"receipt_jws must be a valid compact JWS (header.payload.signature)"
|
|
2673
2974
|
);
|
|
2674
2975
|
var CarrierFormatSchema = zod.z.enum(["embed", "reference"]);
|
|
2976
|
+
var ReceiptUrlSchema = zod.z.string().url().max(2048).refine((url) => url.startsWith("https://"), {
|
|
2977
|
+
message: "receipt_url must use HTTPS scheme"
|
|
2978
|
+
}).refine(
|
|
2979
|
+
(url) => {
|
|
2980
|
+
try {
|
|
2981
|
+
const parsed = new URL(url);
|
|
2982
|
+
return !parsed.username && !parsed.password;
|
|
2983
|
+
} catch {
|
|
2984
|
+
return false;
|
|
2985
|
+
}
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
message: "receipt_url must not contain credentials"
|
|
2989
|
+
}
|
|
2990
|
+
);
|
|
2675
2991
|
var PeacEvidenceCarrierSchema = zod.z.object({
|
|
2676
2992
|
receipt_ref: ReceiptRefSchema2,
|
|
2677
2993
|
receipt_jws: CompactJwsSchema.optional(),
|
|
2994
|
+
receipt_url: ReceiptUrlSchema.optional(),
|
|
2678
2995
|
policy_binding: zod.z.string().max(KERNEL_CONSTRAINTS.MAX_STRING_LENGTH).optional(),
|
|
2679
2996
|
actor_binding: zod.z.string().max(KERNEL_CONSTRAINTS.MAX_STRING_LENGTH).optional(),
|
|
2680
2997
|
request_nonce: zod.z.string().max(KERNEL_CONSTRAINTS.MAX_STRING_LENGTH).optional(),
|
|
@@ -2719,6 +3036,14 @@ function validateCarrierConstraints(carrier, meta) {
|
|
|
2719
3036
|
`carrier size ${sizeBytes} bytes exceeds transport limit ${meta.max_size} bytes for ${meta.transport}`
|
|
2720
3037
|
);
|
|
2721
3038
|
}
|
|
3039
|
+
if (carrier.receipt_url !== void 0) {
|
|
3040
|
+
const urlResult = ReceiptUrlSchema.safeParse(carrier.receipt_url);
|
|
3041
|
+
if (!urlResult.success) {
|
|
3042
|
+
for (const issue of urlResult.error.issues) {
|
|
3043
|
+
violations.push(`invalid receipt_url: ${issue.message}`);
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
2722
3047
|
const stringFields = [
|
|
2723
3048
|
["policy_binding", carrier.policy_binding],
|
|
2724
3049
|
["actor_binding", carrier.actor_binding],
|
|
@@ -2802,7 +3127,33 @@ function parseReceiptClaims(input, _opts) {
|
|
|
2802
3127
|
claims: result.data
|
|
2803
3128
|
};
|
|
2804
3129
|
}
|
|
3130
|
+
var REVOCATION_REASONS = [
|
|
3131
|
+
"key_compromise",
|
|
3132
|
+
"superseded",
|
|
3133
|
+
"cessation_of_operation",
|
|
3134
|
+
"privilege_withdrawn"
|
|
3135
|
+
];
|
|
3136
|
+
var RevokedKeyEntrySchema = zod.z.object({
|
|
3137
|
+
/** Key ID that was revoked */
|
|
3138
|
+
kid: zod.z.string().min(1).max(256),
|
|
3139
|
+
/** ISO 8601 timestamp of revocation */
|
|
3140
|
+
revoked_at: zod.z.string().datetime(),
|
|
3141
|
+
/** Revocation reason (optional, RFC 5280 CRLReason subset) */
|
|
3142
|
+
reason: zod.z.enum(REVOCATION_REASONS).optional()
|
|
3143
|
+
}).strict();
|
|
3144
|
+
var RevokedKeysArraySchema = zod.z.array(RevokedKeyEntrySchema).max(100);
|
|
3145
|
+
function validateRevokedKeys(data) {
|
|
3146
|
+
const result = RevokedKeysArraySchema.safeParse(data);
|
|
3147
|
+
if (result.success) {
|
|
3148
|
+
return { ok: true, value: result.data };
|
|
3149
|
+
}
|
|
3150
|
+
return { ok: false, error: result.error.issues.map((i) => i.message).join("; ") };
|
|
3151
|
+
}
|
|
3152
|
+
function findRevokedKey(revokedKeys, kid) {
|
|
3153
|
+
return revokedKeys.find((entry) => entry.kid === kid) ?? null;
|
|
3154
|
+
}
|
|
2805
3155
|
|
|
3156
|
+
exports.ACTOR_BINDING_EXTENSION_KEY = ACTOR_BINDING_EXTENSION_KEY;
|
|
2806
3157
|
exports.AGENT_IDENTITY_TYPE = AGENT_IDENTITY_TYPE;
|
|
2807
3158
|
exports.AIPREFSnapshotSchema = AIPREFSnapshot;
|
|
2808
3159
|
exports.ATTESTATION_LIMITS = ATTESTATION_LIMITS;
|
|
@@ -2810,6 +3161,7 @@ exports.ATTESTATION_RECEIPT_TYPE = ATTESTATION_RECEIPT_TYPE;
|
|
|
2810
3161
|
exports.ATTRIBUTION_LIMITS = ATTRIBUTION_LIMITS;
|
|
2811
3162
|
exports.ATTRIBUTION_TYPE = ATTRIBUTION_TYPE;
|
|
2812
3163
|
exports.ATTRIBUTION_USAGES = ATTRIBUTION_USAGES;
|
|
3164
|
+
exports.ActorBindingSchema = ActorBindingSchema;
|
|
2813
3165
|
exports.AgentIdentityAttestationSchema = AgentIdentityAttestationSchema;
|
|
2814
3166
|
exports.AgentIdentityEvidenceSchema = AgentIdentityEvidenceSchema;
|
|
2815
3167
|
exports.AgentIdentityVerifiedSchema = AgentIdentityVerifiedSchema;
|
|
@@ -2825,23 +3177,36 @@ exports.BindingDetailsSchema = BindingDetailsSchema;
|
|
|
2825
3177
|
exports.CANONICAL_DIGEST_ALGS = CANONICAL_DIGEST_ALGS;
|
|
2826
3178
|
exports.CANONICAL_PURPOSES = CANONICAL_PURPOSES;
|
|
2827
3179
|
exports.CARRIER_TRANSPORT_LIMITS = CARRIER_TRANSPORT_LIMITS;
|
|
3180
|
+
exports.COMMITMENT_CLASSES = COMMITMENT_CLASSES;
|
|
2828
3181
|
exports.CONTRIBUTION_TYPES = CONTRIBUTION_TYPES;
|
|
3182
|
+
exports.CONTROL_ACTIONS = CONTROL_ACTIONS;
|
|
3183
|
+
exports.CONTROL_ACTION_EXTENSION_KEY = CONTROL_ACTION_EXTENSION_KEY;
|
|
3184
|
+
exports.CONTROL_TRIGGERS = CONTROL_TRIGGERS;
|
|
2829
3185
|
exports.CONTROL_TYPES = CONTROL_TYPES;
|
|
3186
|
+
exports.CREDENTIAL_EVENTS = CREDENTIAL_EVENTS;
|
|
3187
|
+
exports.CREDENTIAL_EVENT_EXTENSION_KEY = CREDENTIAL_EVENT_EXTENSION_KEY;
|
|
2830
3188
|
exports.CREDIT_METHODS = CREDIT_METHODS;
|
|
2831
3189
|
exports.CanonicalPurposeSchema = CanonicalPurposeSchema;
|
|
2832
3190
|
exports.CarrierFormatSchema = CarrierFormatSchema;
|
|
2833
3191
|
exports.CarrierMetaSchema = CarrierMetaSchema;
|
|
3192
|
+
exports.CommitmentClassSchema = CommitmentClassSchema;
|
|
2834
3193
|
exports.CompactJwsSchema = CompactJwsSchema;
|
|
2835
3194
|
exports.ContactMethodSchema = ContactMethodSchema;
|
|
2836
3195
|
exports.ContentHashSchema = ContentHashSchema;
|
|
2837
3196
|
exports.ContributionObligationSchema = ContributionObligationSchema;
|
|
2838
3197
|
exports.ContributionTypeSchema = ContributionTypeSchema;
|
|
3198
|
+
exports.ControlActionSchema = ControlActionSchema;
|
|
3199
|
+
exports.ControlActionTypeSchema = ControlActionTypeSchema;
|
|
2839
3200
|
exports.ControlBlockSchema = ControlBlockSchema;
|
|
2840
3201
|
exports.ControlDecisionSchema = ControlDecisionSchema;
|
|
2841
3202
|
exports.ControlLicensingModeSchema = ControlLicensingModeSchema;
|
|
2842
3203
|
exports.ControlPurposeSchema = ControlPurposeSchema;
|
|
2843
3204
|
exports.ControlStepSchema = ControlStepSchema;
|
|
3205
|
+
exports.ControlTriggerSchema = ControlTriggerSchema;
|
|
2844
3206
|
exports.ControlTypeSchema = ControlTypeSchema;
|
|
3207
|
+
exports.CredentialEventSchema = CredentialEventSchema;
|
|
3208
|
+
exports.CredentialEventTypeSchema = CredentialEventTypeSchema;
|
|
3209
|
+
exports.CredentialRefSchema = CredentialRefSchema;
|
|
2845
3210
|
exports.CreditMethodSchema = CreditMethodSchema;
|
|
2846
3211
|
exports.CreditObligationSchema = CreditObligationSchema;
|
|
2847
3212
|
exports.DERIVATION_TYPES = DERIVATION_TYPES;
|
|
@@ -2895,6 +3260,9 @@ exports.KindSchema = KindSchema;
|
|
|
2895
3260
|
exports.MAX_PURPOSE_TOKENS_PER_REQUEST = MAX_PURPOSE_TOKENS_PER_REQUEST;
|
|
2896
3261
|
exports.MAX_PURPOSE_TOKEN_LENGTH = MAX_PURPOSE_TOKEN_LENGTH;
|
|
2897
3262
|
exports.MIDDLEWARE_INTERACTION_KEY = MIDDLEWARE_INTERACTION_KEY;
|
|
3263
|
+
exports.MVISFieldsSchema = MVISFieldsSchema;
|
|
3264
|
+
exports.MVISReplayProtectionSchema = MVISReplayProtectionSchema;
|
|
3265
|
+
exports.MVISTimeBoundsSchema = MVISTimeBoundsSchema;
|
|
2898
3266
|
exports.MinimalInteractionBindingSchema = MinimalInteractionBindingSchema;
|
|
2899
3267
|
exports.NormalizedPayment = NormalizedPayment;
|
|
2900
3268
|
exports.OBLIGATIONS_EXTENSION_KEY = OBLIGATIONS_EXTENSION_KEY;
|
|
@@ -2918,6 +3286,7 @@ exports.PEAC_RECEIPT_SCHEMA_URL = PEAC_RECEIPT_SCHEMA_URL;
|
|
|
2918
3286
|
exports.PEAC_WIRE_TYP = PEAC_WIRE_TYP;
|
|
2919
3287
|
exports.POLICY_DECISIONS = POLICY_DECISIONS;
|
|
2920
3288
|
exports.PROOF_METHODS = PROOF_METHODS;
|
|
3289
|
+
exports.PROOF_TYPES = PROOF_TYPES;
|
|
2921
3290
|
exports.PURPOSE_REASONS = PURPOSE_REASONS;
|
|
2922
3291
|
exports.PURPOSE_TOKEN_REGEX = PURPOSE_TOKEN_REGEX;
|
|
2923
3292
|
exports.PayloadRefSchema = PayloadRefSchema;
|
|
@@ -2927,20 +3296,25 @@ exports.PaymentSplitSchema = PaymentSplitSchema;
|
|
|
2927
3296
|
exports.PeacEvidenceCarrierSchema = PeacEvidenceCarrierSchema;
|
|
2928
3297
|
exports.PolicyContextSchema = PolicyContextSchema;
|
|
2929
3298
|
exports.ProofMethodSchema = ProofMethodSchema;
|
|
3299
|
+
exports.ProofTypeSchema = ProofTypeSchema;
|
|
2930
3300
|
exports.PurposeReasonSchema = PurposeReasonSchema;
|
|
2931
3301
|
exports.PurposeTokenSchema = PurposeTokenSchema;
|
|
2932
3302
|
exports.REDACTION_MODES = REDACTION_MODES;
|
|
2933
3303
|
exports.REMEDIATION_TYPES = REMEDIATION_TYPES;
|
|
2934
3304
|
exports.RESERVED_KIND_PREFIXES = RESERVED_KIND_PREFIXES;
|
|
2935
3305
|
exports.RESULT_STATUSES = RESULT_STATUSES;
|
|
3306
|
+
exports.REVOCATION_REASONS = REVOCATION_REASONS;
|
|
2936
3307
|
exports.ReceiptClaims = ReceiptClaims;
|
|
2937
3308
|
exports.ReceiptClaimsSchema = ReceiptClaimsSchema;
|
|
2938
3309
|
exports.ReceiptRefSchema = ReceiptRefSchema2;
|
|
3310
|
+
exports.ReceiptUrlSchema = ReceiptUrlSchema;
|
|
2939
3311
|
exports.RefsSchema = RefsSchema;
|
|
2940
3312
|
exports.RemediationSchema = RemediationSchema;
|
|
2941
3313
|
exports.RemediationTypeSchema = RemediationTypeSchema;
|
|
2942
3314
|
exports.ResourceTargetSchema = ResourceTargetSchema;
|
|
2943
3315
|
exports.ResultSchema = ResultSchema;
|
|
3316
|
+
exports.RevokedKeyEntrySchema = RevokedKeyEntrySchema;
|
|
3317
|
+
exports.RevokedKeysArraySchema = RevokedKeysArraySchema;
|
|
2944
3318
|
exports.STEP_ID_PATTERN = STEP_ID_PATTERN;
|
|
2945
3319
|
exports.StepIdSchema = StepIdSchema;
|
|
2946
3320
|
exports.SubjectProfileSchema = SubjectProfileSchema;
|
|
@@ -2948,7 +3322,11 @@ exports.SubjectProfileSnapshotSchema = SubjectProfileSnapshotSchema;
|
|
|
2948
3322
|
exports.SubjectSchema = Subject;
|
|
2949
3323
|
exports.SubjectTypeSchema = SubjectTypeSchema;
|
|
2950
3324
|
exports.TERMINAL_STATES = TERMINAL_STATES;
|
|
3325
|
+
exports.TOOL_REGISTRY_EXTENSION_KEY = TOOL_REGISTRY_EXTENSION_KEY;
|
|
3326
|
+
exports.TREATY_EXTENSION_KEY = TREATY_EXTENSION_KEY;
|
|
3327
|
+
exports.ToolRegistrySchema = ToolRegistrySchema;
|
|
2951
3328
|
exports.ToolTargetSchema = ToolTargetSchema;
|
|
3329
|
+
exports.TreatySchema = TreatySchema;
|
|
2952
3330
|
exports.VerifyRequestSchema = VerifyRequest;
|
|
2953
3331
|
exports.WELL_KNOWN_KINDS = WELL_KNOWN_KINDS;
|
|
2954
3332
|
exports.WORKFLOW_EXTENSION_KEY = WORKFLOW_EXTENSION_KEY;
|
|
@@ -2988,6 +3366,8 @@ exports.deriveKnownPurposes = deriveKnownPurposes;
|
|
|
2988
3366
|
exports.detectCycleInSources = detectCycleInSources;
|
|
2989
3367
|
exports.determinePurposeReason = determinePurposeReason;
|
|
2990
3368
|
exports.extractObligationsExtension = extractObligationsExtension;
|
|
3369
|
+
exports.findRevokedKey = findRevokedKey;
|
|
3370
|
+
exports.fingerprintRefToString = fingerprintRefToString;
|
|
2991
3371
|
exports.getInteraction = getInteraction;
|
|
2992
3372
|
exports.getValidTransitions = getValidTransitions;
|
|
2993
3373
|
exports.hasInteraction = hasInteraction;
|
|
@@ -3010,6 +3390,7 @@ exports.isDisputeExpired = isDisputeExpired;
|
|
|
3010
3390
|
exports.isDisputeNotYetValid = isDisputeNotYetValid;
|
|
3011
3391
|
exports.isLegacyPurpose = isLegacyPurpose;
|
|
3012
3392
|
exports.isMinimalInteractionBinding = isMinimalInteractionBinding;
|
|
3393
|
+
exports.isOriginOnly = isOriginOnly;
|
|
3013
3394
|
exports.isPaymentReceipt = isPaymentReceipt;
|
|
3014
3395
|
exports.isReservedKindPrefix = isReservedKindPrefix;
|
|
3015
3396
|
exports.isTerminalState = isTerminalState;
|
|
@@ -3028,8 +3409,10 @@ exports.normalizeToCanonicalOrPreserve = normalizeToCanonicalOrPreserve;
|
|
|
3028
3409
|
exports.parsePurposeHeader = parsePurposeHeader;
|
|
3029
3410
|
exports.parseReceiptClaims = parseReceiptClaims;
|
|
3030
3411
|
exports.setInteraction = setInteraction;
|
|
3412
|
+
exports.stringToFingerprintRef = stringToFingerprintRef;
|
|
3031
3413
|
exports.toCoreClaims = toCoreClaims;
|
|
3032
3414
|
exports.transitionDisputeState = transitionDisputeState;
|
|
3415
|
+
exports.validateActorBinding = validateActorBinding;
|
|
3033
3416
|
exports.validateAgentIdentityAttestation = validateAgentIdentityAttestation;
|
|
3034
3417
|
exports.validateAttestationReceiptClaims = validateAttestationReceiptClaims;
|
|
3035
3418
|
exports.validateAttributionAttestation = validateAttributionAttestation;
|
|
@@ -3037,6 +3420,8 @@ exports.validateAttributionSource = validateAttributionSource;
|
|
|
3037
3420
|
exports.validateCarrierConstraints = validateCarrierConstraints;
|
|
3038
3421
|
exports.validateContentHash = validateContentHash;
|
|
3039
3422
|
exports.validateContributionObligation = validateContributionObligation;
|
|
3423
|
+
exports.validateControlAction = validateControlAction;
|
|
3424
|
+
exports.validateCredentialEvent = validateCredentialEvent;
|
|
3040
3425
|
exports.validateCreditObligation = validateCreditObligation;
|
|
3041
3426
|
exports.validateDisputeAttestation = validateDisputeAttestation;
|
|
3042
3427
|
exports.validateDisputeContact = validateDisputeContact;
|
|
@@ -3047,10 +3432,14 @@ exports.validateInteraction = validateInteraction;
|
|
|
3047
3432
|
exports.validateInteractionEvidence = validateInteractionEvidence;
|
|
3048
3433
|
exports.validateInteractionOrdered = validateInteractionOrdered;
|
|
3049
3434
|
exports.validateKernelConstraints = validateKernelConstraints;
|
|
3435
|
+
exports.validateMVIS = validateMVIS;
|
|
3050
3436
|
exports.validateMinimalInteractionBinding = validateMinimalInteractionBinding;
|
|
3051
3437
|
exports.validateObligationsExtension = validateObligationsExtension;
|
|
3052
3438
|
exports.validatePurposeTokens = validatePurposeTokens;
|
|
3439
|
+
exports.validateRevokedKeys = validateRevokedKeys;
|
|
3053
3440
|
exports.validateSubjectSnapshot = validateSubjectSnapshot;
|
|
3441
|
+
exports.validateToolRegistry = validateToolRegistry;
|
|
3442
|
+
exports.validateTreaty = validateTreaty;
|
|
3054
3443
|
exports.validateWorkflowContext = validateWorkflowContext;
|
|
3055
3444
|
exports.validateWorkflowContextOrdered = validateWorkflowContextOrdered;
|
|
3056
3445
|
exports.validateWorkflowSummaryAttestation = validateWorkflowSummaryAttestation;
|