@peac/schema 0.11.3 → 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/dist/errors.d.ts +2 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.cjs +520 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +478 -7
- package/dist/index.mjs.map +1 -1
- 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/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",
|
|
@@ -3072,15 +3075,404 @@ async function verifyReceiptRefConsistency(carrier) {
|
|
|
3072
3075
|
}
|
|
3073
3076
|
return null;
|
|
3074
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
|
+
}
|
|
3075
3458
|
|
|
3076
3459
|
// src/receipt-parser.ts
|
|
3077
|
-
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) {
|
|
3078
3470
|
if ("amt" in obj || "cur" in obj || "payment" in obj) {
|
|
3079
3471
|
return "commerce";
|
|
3080
3472
|
}
|
|
3081
3473
|
return "attestation";
|
|
3082
3474
|
}
|
|
3083
|
-
function parseReceiptClaims(input,
|
|
3475
|
+
function parseReceiptClaims(input, opts) {
|
|
3084
3476
|
if (input === null || input === void 0 || typeof input !== "object" || Array.isArray(input)) {
|
|
3085
3477
|
return {
|
|
3086
3478
|
ok: false,
|
|
@@ -3091,7 +3483,37 @@ function parseReceiptClaims(input, _opts) {
|
|
|
3091
3483
|
};
|
|
3092
3484
|
}
|
|
3093
3485
|
const obj = input;
|
|
3094
|
-
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);
|
|
3095
3517
|
if (variant === "commerce") {
|
|
3096
3518
|
const result2 = ReceiptClaimsSchema.safeParse(obj);
|
|
3097
3519
|
if (!result2.success) {
|
|
@@ -3107,6 +3529,8 @@ function parseReceiptClaims(input, _opts) {
|
|
|
3107
3529
|
return {
|
|
3108
3530
|
ok: true,
|
|
3109
3531
|
variant: "commerce",
|
|
3532
|
+
wireVersion: "0.1",
|
|
3533
|
+
warnings: [],
|
|
3110
3534
|
claims: result2.data
|
|
3111
3535
|
};
|
|
3112
3536
|
}
|
|
@@ -3124,9 +3548,56 @@ function parseReceiptClaims(input, _opts) {
|
|
|
3124
3548
|
return {
|
|
3125
3549
|
ok: true,
|
|
3126
3550
|
variant: "attestation",
|
|
3551
|
+
wireVersion: "0.1",
|
|
3552
|
+
warnings: [],
|
|
3127
3553
|
claims: result.data
|
|
3128
3554
|
};
|
|
3129
3555
|
}
|
|
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
|
+
}
|
|
3130
3601
|
var REVOCATION_REASONS = [
|
|
3131
3602
|
"key_compromise",
|
|
3132
3603
|
"superseded",
|
|
@@ -3153,6 +3624,7 @@ function findRevokedKey(revokedKeys, kid) {
|
|
|
3153
3624
|
return revokedKeys.find((entry) => entry.kid === kid) ?? null;
|
|
3154
3625
|
}
|
|
3155
3626
|
|
|
3627
|
+
exports.ACCESS_EXTENSION_KEY = ACCESS_EXTENSION_KEY;
|
|
3156
3628
|
exports.ACTOR_BINDING_EXTENSION_KEY = ACTOR_BINDING_EXTENSION_KEY;
|
|
3157
3629
|
exports.AGENT_IDENTITY_TYPE = AGENT_IDENTITY_TYPE;
|
|
3158
3630
|
exports.AIPREFSnapshotSchema = AIPREFSnapshot;
|
|
@@ -3161,6 +3633,7 @@ exports.ATTESTATION_RECEIPT_TYPE = ATTESTATION_RECEIPT_TYPE;
|
|
|
3161
3633
|
exports.ATTRIBUTION_LIMITS = ATTRIBUTION_LIMITS;
|
|
3162
3634
|
exports.ATTRIBUTION_TYPE = ATTRIBUTION_TYPE;
|
|
3163
3635
|
exports.ATTRIBUTION_USAGES = ATTRIBUTION_USAGES;
|
|
3636
|
+
exports.AccessExtensionSchema = AccessExtensionSchema;
|
|
3164
3637
|
exports.ActorBindingSchema = ActorBindingSchema;
|
|
3165
3638
|
exports.AgentIdentityAttestationSchema = AgentIdentityAttestationSchema;
|
|
3166
3639
|
exports.AgentIdentityEvidenceSchema = AgentIdentityEvidenceSchema;
|
|
@@ -3177,18 +3650,26 @@ exports.BindingDetailsSchema = BindingDetailsSchema;
|
|
|
3177
3650
|
exports.CANONICAL_DIGEST_ALGS = CANONICAL_DIGEST_ALGS;
|
|
3178
3651
|
exports.CANONICAL_PURPOSES = CANONICAL_PURPOSES;
|
|
3179
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;
|
|
3180
3656
|
exports.COMMITMENT_CLASSES = COMMITMENT_CLASSES;
|
|
3181
3657
|
exports.CONTRIBUTION_TYPES = CONTRIBUTION_TYPES;
|
|
3182
3658
|
exports.CONTROL_ACTIONS = CONTROL_ACTIONS;
|
|
3183
3659
|
exports.CONTROL_ACTION_EXTENSION_KEY = CONTROL_ACTION_EXTENSION_KEY;
|
|
3184
3660
|
exports.CONTROL_TRIGGERS = CONTROL_TRIGGERS;
|
|
3185
3661
|
exports.CONTROL_TYPES = CONTROL_TYPES;
|
|
3662
|
+
exports.CORRELATION_EXTENSION_KEY = CORRELATION_EXTENSION_KEY;
|
|
3186
3663
|
exports.CREDENTIAL_EVENTS = CREDENTIAL_EVENTS;
|
|
3187
3664
|
exports.CREDENTIAL_EVENT_EXTENSION_KEY = CREDENTIAL_EVENT_EXTENSION_KEY;
|
|
3188
3665
|
exports.CREDIT_METHODS = CREDIT_METHODS;
|
|
3666
|
+
exports.CanonicalIssSchema = CanonicalIssSchema;
|
|
3189
3667
|
exports.CanonicalPurposeSchema = CanonicalPurposeSchema;
|
|
3190
3668
|
exports.CarrierFormatSchema = CarrierFormatSchema;
|
|
3191
3669
|
exports.CarrierMetaSchema = CarrierMetaSchema;
|
|
3670
|
+
exports.ChallengeExtensionSchema = ChallengeExtensionSchema;
|
|
3671
|
+
exports.ChallengeTypeSchema = ChallengeTypeSchema;
|
|
3672
|
+
exports.CommerceExtensionSchema = CommerceExtensionSchema;
|
|
3192
3673
|
exports.CommitmentClassSchema = CommitmentClassSchema;
|
|
3193
3674
|
exports.CompactJwsSchema = CompactJwsSchema;
|
|
3194
3675
|
exports.ContactMethodSchema = ContactMethodSchema;
|
|
@@ -3204,6 +3685,7 @@ exports.ControlPurposeSchema = ControlPurposeSchema;
|
|
|
3204
3685
|
exports.ControlStepSchema = ControlStepSchema;
|
|
3205
3686
|
exports.ControlTriggerSchema = ControlTriggerSchema;
|
|
3206
3687
|
exports.ControlTypeSchema = ControlTypeSchema;
|
|
3688
|
+
exports.CorrelationExtensionSchema = CorrelationExtensionSchema;
|
|
3207
3689
|
exports.CredentialEventSchema = CredentialEventSchema;
|
|
3208
3690
|
exports.CredentialEventTypeSchema = CredentialEventTypeSchema;
|
|
3209
3691
|
exports.CredentialRefSchema = CredentialRefSchema;
|
|
@@ -3238,15 +3720,19 @@ exports.DocumentRefSchema = DocumentRefSchema;
|
|
|
3238
3720
|
exports.ERROR_CATEGORIES_CANONICAL = ERROR_CATEGORIES_CANONICAL;
|
|
3239
3721
|
exports.ERROR_CODES = ERROR_CODES;
|
|
3240
3722
|
exports.EXTENSION_KEY_PATTERN = EXTENSION_KEY_PATTERN;
|
|
3723
|
+
exports.EXTENSION_LIMITS = EXTENSION_LIMITS;
|
|
3724
|
+
exports.EvidencePillarSchema = EvidencePillarSchema;
|
|
3241
3725
|
exports.ExecutorSchema = ExecutorSchema;
|
|
3242
3726
|
exports.Extensions = Extensions;
|
|
3243
3727
|
exports.ExtensionsSchema = ExtensionsSchema;
|
|
3244
3728
|
exports.HashAlgorithmSchema = HashAlgorithmSchema;
|
|
3245
3729
|
exports.HashEncodingSchema = HashEncodingSchema;
|
|
3730
|
+
exports.IDENTITY_EXTENSION_KEY = IDENTITY_EXTENSION_KEY;
|
|
3246
3731
|
exports.INTERACTION_EXTENSION_KEY = INTERACTION_EXTENSION_KEY;
|
|
3247
3732
|
exports.INTERACTION_LIMITS = INTERACTION_LIMITS;
|
|
3248
3733
|
exports.INTERNAL_PURPOSE_UNDECLARED = INTERNAL_PURPOSE_UNDECLARED;
|
|
3249
3734
|
exports.IdentityBindingSchema = IdentityBindingSchema;
|
|
3735
|
+
exports.IdentityExtensionSchema = IdentityExtensionSchema;
|
|
3250
3736
|
exports.InteractionEvidenceV01Schema = InteractionEvidenceV01Schema;
|
|
3251
3737
|
exports.JSON_EVIDENCE_LIMITS = JSON_EVIDENCE_LIMITS;
|
|
3252
3738
|
exports.JWSHeader = JWSHeader;
|
|
@@ -3294,23 +3780,31 @@ exports.PaymentEvidenceSchema = PaymentEvidenceSchema;
|
|
|
3294
3780
|
exports.PaymentRoutingSchema = PaymentRoutingSchema;
|
|
3295
3781
|
exports.PaymentSplitSchema = PaymentSplitSchema;
|
|
3296
3782
|
exports.PeacEvidenceCarrierSchema = PeacEvidenceCarrierSchema;
|
|
3783
|
+
exports.PillarsSchema = PillarsSchema;
|
|
3784
|
+
exports.PolicyBlockSchema = PolicyBlockSchema;
|
|
3297
3785
|
exports.PolicyContextSchema = PolicyContextSchema;
|
|
3786
|
+
exports.ProblemDetailsSchema = ProblemDetailsSchema;
|
|
3298
3787
|
exports.ProofMethodSchema = ProofMethodSchema;
|
|
3299
3788
|
exports.ProofTypeSchema = ProofTypeSchema;
|
|
3300
3789
|
exports.PurposeReasonSchema = PurposeReasonSchema;
|
|
3301
3790
|
exports.PurposeTokenSchema = PurposeTokenSchema;
|
|
3302
3791
|
exports.REDACTION_MODES = REDACTION_MODES;
|
|
3792
|
+
exports.REGISTERED_EXTENSION_GROUP_KEYS = REGISTERED_EXTENSION_GROUP_KEYS;
|
|
3793
|
+
exports.REGISTERED_RECEIPT_TYPES = REGISTERED_RECEIPT_TYPES;
|
|
3303
3794
|
exports.REMEDIATION_TYPES = REMEDIATION_TYPES;
|
|
3795
|
+
exports.REPRESENTATION_LIMITS = REPRESENTATION_LIMITS;
|
|
3304
3796
|
exports.RESERVED_KIND_PREFIXES = RESERVED_KIND_PREFIXES;
|
|
3305
3797
|
exports.RESULT_STATUSES = RESULT_STATUSES;
|
|
3306
3798
|
exports.REVOCATION_REASONS = REVOCATION_REASONS;
|
|
3307
3799
|
exports.ReceiptClaims = ReceiptClaims;
|
|
3308
3800
|
exports.ReceiptClaimsSchema = ReceiptClaimsSchema;
|
|
3309
3801
|
exports.ReceiptRefSchema = ReceiptRefSchema2;
|
|
3802
|
+
exports.ReceiptTypeSchema = ReceiptTypeSchema;
|
|
3310
3803
|
exports.ReceiptUrlSchema = ReceiptUrlSchema;
|
|
3311
3804
|
exports.RefsSchema = RefsSchema;
|
|
3312
3805
|
exports.RemediationSchema = RemediationSchema;
|
|
3313
3806
|
exports.RemediationTypeSchema = RemediationTypeSchema;
|
|
3807
|
+
exports.RepresentationFieldsSchema = Wire02RepresentationFieldsSchema;
|
|
3314
3808
|
exports.ResourceTargetSchema = ResourceTargetSchema;
|
|
3315
3809
|
exports.ResultSchema = ResultSchema;
|
|
3316
3810
|
exports.RevokedKeyEntrySchema = RevokedKeyEntrySchema;
|
|
@@ -3328,12 +3822,20 @@ exports.ToolRegistrySchema = ToolRegistrySchema;
|
|
|
3328
3822
|
exports.ToolTargetSchema = ToolTargetSchema;
|
|
3329
3823
|
exports.TreatySchema = TreatySchema;
|
|
3330
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;
|
|
3331
3829
|
exports.WELL_KNOWN_KINDS = WELL_KNOWN_KINDS;
|
|
3332
3830
|
exports.WORKFLOW_EXTENSION_KEY = WORKFLOW_EXTENSION_KEY;
|
|
3333
3831
|
exports.WORKFLOW_ID_PATTERN = WORKFLOW_ID_PATTERN;
|
|
3334
3832
|
exports.WORKFLOW_LIMITS = WORKFLOW_LIMITS;
|
|
3335
3833
|
exports.WORKFLOW_STATUSES = WORKFLOW_STATUSES;
|
|
3336
3834
|
exports.WORKFLOW_SUMMARY_TYPE = WORKFLOW_SUMMARY_TYPE;
|
|
3835
|
+
exports.Wire01JWSHeaderSchema = Wire01JWSHeaderSchema;
|
|
3836
|
+
exports.Wire02ClaimsSchema = Wire02ClaimsSchema;
|
|
3837
|
+
exports.Wire02KindSchema = Wire02KindSchema;
|
|
3838
|
+
exports.Wire02RepresentationFieldsSchema = Wire02RepresentationFieldsSchema;
|
|
3337
3839
|
exports.WorkflowContextSchema = WorkflowContextSchema;
|
|
3338
3840
|
exports.WorkflowErrorContextSchema = WorkflowErrorContextSchema;
|
|
3339
3841
|
exports.WorkflowIdSchema = WorkflowIdSchema;
|
|
@@ -3342,6 +3844,7 @@ exports.WorkflowSummaryAttestationSchema = WorkflowSummaryAttestationSchema;
|
|
|
3342
3844
|
exports.WorkflowSummaryEvidenceSchema = WorkflowSummaryEvidenceSchema;
|
|
3343
3845
|
exports.assertJsonSafeIterative = assertJsonSafeIterative;
|
|
3344
3846
|
exports.canTransitionTo = canTransitionTo;
|
|
3847
|
+
exports.checkOccurredAtSkew = checkOccurredAtSkew;
|
|
3345
3848
|
exports.computeReceiptRef = computeReceiptRef;
|
|
3346
3849
|
exports.computeTotalWeight = computeTotalWeight;
|
|
3347
3850
|
exports.createAgentIdentityAttestation = createAgentIdentityAttestation;
|
|
@@ -3364,10 +3867,16 @@ exports.createWorkflowId = createWorkflowId;
|
|
|
3364
3867
|
exports.createWorkflowSummaryAttestation = createWorkflowSummaryAttestation;
|
|
3365
3868
|
exports.deriveKnownPurposes = deriveKnownPurposes;
|
|
3366
3869
|
exports.detectCycleInSources = detectCycleInSources;
|
|
3870
|
+
exports.detectWireVersion = detectWireVersion;
|
|
3367
3871
|
exports.determinePurposeReason = determinePurposeReason;
|
|
3368
3872
|
exports.extractObligationsExtension = extractObligationsExtension;
|
|
3369
3873
|
exports.findRevokedKey = findRevokedKey;
|
|
3370
3874
|
exports.fingerprintRefToString = fingerprintRefToString;
|
|
3875
|
+
exports.getAccessExtension = getAccessExtension;
|
|
3876
|
+
exports.getChallengeExtension = getChallengeExtension;
|
|
3877
|
+
exports.getCommerceExtension = getCommerceExtension;
|
|
3878
|
+
exports.getCorrelationExtension = getCorrelationExtension;
|
|
3879
|
+
exports.getIdentityExtension = getIdentityExtension;
|
|
3371
3880
|
exports.getInteraction = getInteraction;
|
|
3372
3881
|
exports.getValidTransitions = getValidTransitions;
|
|
3373
3882
|
exports.hasInteraction = hasInteraction;
|
|
@@ -3381,6 +3890,7 @@ exports.isAttestationReceiptClaims = isAttestationReceiptClaims;
|
|
|
3381
3890
|
exports.isAttributionAttestation = isAttributionAttestation;
|
|
3382
3891
|
exports.isAttributionExpired = isAttributionExpired;
|
|
3383
3892
|
exports.isAttributionNotYetValid = isAttributionNotYetValid;
|
|
3893
|
+
exports.isCanonicalIss = isCanonicalIss;
|
|
3384
3894
|
exports.isCanonicalPurpose = isCanonicalPurpose;
|
|
3385
3895
|
exports.isContributionRequired = isContributionRequired;
|
|
3386
3896
|
exports.isCreditRequired = isCreditRequired;
|
|
@@ -3397,9 +3907,11 @@ exports.isTerminalState = isTerminalState;
|
|
|
3397
3907
|
exports.isTerminalWorkflowStatus = isTerminalWorkflowStatus;
|
|
3398
3908
|
exports.isUndeclaredPurpose = isUndeclaredPurpose;
|
|
3399
3909
|
exports.isValidDisputeAttestation = isValidDisputeAttestation;
|
|
3910
|
+
exports.isValidExtensionKey = isValidExtensionKey;
|
|
3400
3911
|
exports.isValidInteractionEvidence = isValidInteractionEvidence;
|
|
3401
3912
|
exports.isValidPurposeReason = isValidPurposeReason;
|
|
3402
3913
|
exports.isValidPurposeToken = isValidPurposeToken;
|
|
3914
|
+
exports.isValidReceiptType = isValidReceiptType;
|
|
3403
3915
|
exports.isValidWorkflowContext = isValidWorkflowContext;
|
|
3404
3916
|
exports.isWellKnownKind = isWellKnownKind;
|
|
3405
3917
|
exports.isWorkflowSummaryAttestation = isWorkflowSummaryAttestation;
|
|
@@ -3409,6 +3921,7 @@ exports.normalizeToCanonicalOrPreserve = normalizeToCanonicalOrPreserve;
|
|
|
3409
3921
|
exports.parsePurposeHeader = parsePurposeHeader;
|
|
3410
3922
|
exports.parseReceiptClaims = parseReceiptClaims;
|
|
3411
3923
|
exports.setInteraction = setInteraction;
|
|
3924
|
+
exports.sortWarnings = sortWarnings;
|
|
3412
3925
|
exports.stringToFingerprintRef = stringToFingerprintRef;
|
|
3413
3926
|
exports.toCoreClaims = toCoreClaims;
|
|
3414
3927
|
exports.transitionDisputeState = transitionDisputeState;
|
|
@@ -3432,6 +3945,7 @@ exports.validateInteraction = validateInteraction;
|
|
|
3432
3945
|
exports.validateInteractionEvidence = validateInteractionEvidence;
|
|
3433
3946
|
exports.validateInteractionOrdered = validateInteractionOrdered;
|
|
3434
3947
|
exports.validateKernelConstraints = validateKernelConstraints;
|
|
3948
|
+
exports.validateKnownExtensions = validateKnownExtensions;
|
|
3435
3949
|
exports.validateMVIS = validateMVIS;
|
|
3436
3950
|
exports.validateMinimalInteractionBinding = validateMinimalInteractionBinding;
|
|
3437
3951
|
exports.validateObligationsExtension = validateObligationsExtension;
|
|
@@ -3443,6 +3957,7 @@ exports.validateTreaty = validateTreaty;
|
|
|
3443
3957
|
exports.validateWorkflowContext = validateWorkflowContext;
|
|
3444
3958
|
exports.validateWorkflowContextOrdered = validateWorkflowContextOrdered;
|
|
3445
3959
|
exports.validateWorkflowSummaryAttestation = validateWorkflowSummaryAttestation;
|
|
3960
|
+
exports.verifyPolicyBinding = verifyPolicyBinding;
|
|
3446
3961
|
exports.verifyReceiptRefConsistency = verifyReceiptRefConsistency;
|
|
3447
3962
|
//# sourceMappingURL=index.cjs.map
|
|
3448
3963
|
//# sourceMappingURL=index.cjs.map
|