@peac/kernel 0.9.18 → 0.9.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/dist/__tests__/http.test.d.ts +2 -0
- package/dist/__tests__/http.test.d.ts.map +1 -0
- package/dist/__tests__/http.test.js +121 -0
- package/dist/__tests__/http.test.js.map +1 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/errors.d.ts +4 -37
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.generated.d.ts +166 -0
- package/dist/errors.generated.d.ts.map +1 -0
- package/dist/errors.generated.js +965 -0
- package/dist/errors.generated.js.map +1 -0
- package/dist/errors.js +11 -172
- package/dist/errors.js.map +1 -1
- package/dist/http.d.ts +46 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +74 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +34 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,965 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PEAC Protocol Error Codes
|
|
4
|
+
*
|
|
5
|
+
* AUTO-GENERATED from specs/kernel/errors.json
|
|
6
|
+
* DO NOT EDIT MANUALLY - run: npx tsx scripts/codegen-errors.ts
|
|
7
|
+
* Spec version: 0.9.30
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.DISPUTE_ERRORS = exports.BUNDLE_ERRORS = exports.ERRORS = exports.ERROR_CODES = void 0;
|
|
11
|
+
exports.getError = getError;
|
|
12
|
+
exports.isRetriable = isRetriable;
|
|
13
|
+
/**
|
|
14
|
+
* Error code string constants
|
|
15
|
+
*/
|
|
16
|
+
exports.ERROR_CODES = {
|
|
17
|
+
// Attribution error codes
|
|
18
|
+
E_ATTRIBUTION_CHAIN_TOO_DEEP: 'E_ATTRIBUTION_CHAIN_TOO_DEEP',
|
|
19
|
+
E_ATTRIBUTION_CIRCULAR_CHAIN: 'E_ATTRIBUTION_CIRCULAR_CHAIN',
|
|
20
|
+
E_ATTRIBUTION_EXPIRED: 'E_ATTRIBUTION_EXPIRED',
|
|
21
|
+
E_ATTRIBUTION_HASH_INVALID: 'E_ATTRIBUTION_HASH_INVALID',
|
|
22
|
+
E_ATTRIBUTION_INVALID_FORMAT: 'E_ATTRIBUTION_INVALID_FORMAT',
|
|
23
|
+
E_ATTRIBUTION_INVALID_REF: 'E_ATTRIBUTION_INVALID_REF',
|
|
24
|
+
E_ATTRIBUTION_INVALID_WEIGHT: 'E_ATTRIBUTION_INVALID_WEIGHT',
|
|
25
|
+
E_ATTRIBUTION_MISSING_SOURCES: 'E_ATTRIBUTION_MISSING_SOURCES',
|
|
26
|
+
E_ATTRIBUTION_NOT_YET_VALID: 'E_ATTRIBUTION_NOT_YET_VALID',
|
|
27
|
+
E_ATTRIBUTION_RESOLUTION_FAILED: 'E_ATTRIBUTION_RESOLUTION_FAILED',
|
|
28
|
+
E_ATTRIBUTION_RESOLUTION_TIMEOUT: 'E_ATTRIBUTION_RESOLUTION_TIMEOUT',
|
|
29
|
+
E_ATTRIBUTION_SIZE_EXCEEDED: 'E_ATTRIBUTION_SIZE_EXCEEDED',
|
|
30
|
+
E_ATTRIBUTION_TOO_MANY_SOURCES: 'E_ATTRIBUTION_TOO_MANY_SOURCES',
|
|
31
|
+
E_ATTRIBUTION_UNKNOWN_USAGE: 'E_ATTRIBUTION_UNKNOWN_USAGE',
|
|
32
|
+
// Bundle error codes
|
|
33
|
+
E_BUNDLE_DUPLICATE_RECEIPT: 'E_BUNDLE_DUPLICATE_RECEIPT',
|
|
34
|
+
E_BUNDLE_HASH_MISMATCH: 'E_BUNDLE_HASH_MISMATCH',
|
|
35
|
+
E_BUNDLE_INVALID_FORMAT: 'E_BUNDLE_INVALID_FORMAT',
|
|
36
|
+
E_BUNDLE_KEY_MISSING: 'E_BUNDLE_KEY_MISSING',
|
|
37
|
+
E_BUNDLE_MANIFEST_INVALID: 'E_BUNDLE_MANIFEST_INVALID',
|
|
38
|
+
E_BUNDLE_MANIFEST_MISSING: 'E_BUNDLE_MANIFEST_MISSING',
|
|
39
|
+
E_BUNDLE_MISSING_KEYS: 'E_BUNDLE_MISSING_KEYS',
|
|
40
|
+
E_BUNDLE_MISSING_RECEIPTS: 'E_BUNDLE_MISSING_RECEIPTS',
|
|
41
|
+
E_BUNDLE_PATH_TRAVERSAL: 'E_BUNDLE_PATH_TRAVERSAL',
|
|
42
|
+
E_BUNDLE_POLICY_HASH_MISMATCH: 'E_BUNDLE_POLICY_HASH_MISMATCH',
|
|
43
|
+
E_BUNDLE_RECEIPT_INVALID: 'E_BUNDLE_RECEIPT_INVALID',
|
|
44
|
+
E_BUNDLE_RECEIPTS_UNORDERED: 'E_BUNDLE_RECEIPTS_UNORDERED',
|
|
45
|
+
E_BUNDLE_SIGNATURE_INVALID: 'E_BUNDLE_SIGNATURE_INVALID',
|
|
46
|
+
E_BUNDLE_SIZE_EXCEEDED: 'E_BUNDLE_SIZE_EXCEEDED',
|
|
47
|
+
E_BUNDLE_TIME_RANGE_INVALID: 'E_BUNDLE_TIME_RANGE_INVALID',
|
|
48
|
+
// Control error codes
|
|
49
|
+
E_CONTROL_DENIED: 'E_CONTROL_DENIED',
|
|
50
|
+
E_CONTROL_REVIEW_REQUIRED: 'E_CONTROL_REVIEW_REQUIRED',
|
|
51
|
+
// Dispute error codes
|
|
52
|
+
E_DISPUTE_DUPLICATE: 'E_DISPUTE_DUPLICATE',
|
|
53
|
+
E_DISPUTE_EXPIRED: 'E_DISPUTE_EXPIRED',
|
|
54
|
+
E_DISPUTE_INVALID_FORMAT: 'E_DISPUTE_INVALID_FORMAT',
|
|
55
|
+
E_DISPUTE_INVALID_GROUNDS: 'E_DISPUTE_INVALID_GROUNDS',
|
|
56
|
+
E_DISPUTE_INVALID_ID: 'E_DISPUTE_INVALID_ID',
|
|
57
|
+
E_DISPUTE_INVALID_STATE: 'E_DISPUTE_INVALID_STATE',
|
|
58
|
+
E_DISPUTE_INVALID_TARGET_TYPE: 'E_DISPUTE_INVALID_TARGET_TYPE',
|
|
59
|
+
E_DISPUTE_INVALID_TRANSITION: 'E_DISPUTE_INVALID_TRANSITION',
|
|
60
|
+
E_DISPUTE_INVALID_TYPE: 'E_DISPUTE_INVALID_TYPE',
|
|
61
|
+
E_DISPUTE_MISSING_RESOLUTION: 'E_DISPUTE_MISSING_RESOLUTION',
|
|
62
|
+
E_DISPUTE_NOT_YET_VALID: 'E_DISPUTE_NOT_YET_VALID',
|
|
63
|
+
E_DISPUTE_OTHER_REQUIRES_DESCRIPTION: 'E_DISPUTE_OTHER_REQUIRES_DESCRIPTION',
|
|
64
|
+
E_DISPUTE_RESOLUTION_NOT_ALLOWED: 'E_DISPUTE_RESOLUTION_NOT_ALLOWED',
|
|
65
|
+
E_DISPUTE_TARGET_NOT_FOUND: 'E_DISPUTE_TARGET_NOT_FOUND',
|
|
66
|
+
// Identity error codes
|
|
67
|
+
E_IDENTITY_BINDING_FUTURE: 'E_IDENTITY_BINDING_FUTURE',
|
|
68
|
+
E_IDENTITY_BINDING_MISMATCH: 'E_IDENTITY_BINDING_MISMATCH',
|
|
69
|
+
E_IDENTITY_BINDING_STALE: 'E_IDENTITY_BINDING_STALE',
|
|
70
|
+
E_IDENTITY_DIRECTORY_UNAVAILABLE: 'E_IDENTITY_DIRECTORY_UNAVAILABLE',
|
|
71
|
+
E_IDENTITY_EXPIRED: 'E_IDENTITY_EXPIRED',
|
|
72
|
+
E_IDENTITY_INVALID_FORMAT: 'E_IDENTITY_INVALID_FORMAT',
|
|
73
|
+
E_IDENTITY_KEY_EXPIRED: 'E_IDENTITY_KEY_EXPIRED',
|
|
74
|
+
E_IDENTITY_KEY_REVOKED: 'E_IDENTITY_KEY_REVOKED',
|
|
75
|
+
E_IDENTITY_KEY_UNKNOWN: 'E_IDENTITY_KEY_UNKNOWN',
|
|
76
|
+
E_IDENTITY_MISSING: 'E_IDENTITY_MISSING',
|
|
77
|
+
E_IDENTITY_NOT_YET_VALID: 'E_IDENTITY_NOT_YET_VALID',
|
|
78
|
+
E_IDENTITY_PROOF_UNSUPPORTED: 'E_IDENTITY_PROOF_UNSUPPORTED',
|
|
79
|
+
E_IDENTITY_SIG_INVALID: 'E_IDENTITY_SIG_INVALID',
|
|
80
|
+
// Infrastructure error codes
|
|
81
|
+
E_CIRCUIT_BREAKER_OPEN: 'E_CIRCUIT_BREAKER_OPEN',
|
|
82
|
+
E_INTERNAL: 'E_INTERNAL',
|
|
83
|
+
E_JWKS_FETCH_FAILED: 'E_JWKS_FETCH_FAILED',
|
|
84
|
+
E_RATE_LIMITED: 'E_RATE_LIMITED',
|
|
85
|
+
// Ucp error codes
|
|
86
|
+
E_UCP_EVIDENCE_SERIALIZATION_FAILED: 'E_UCP_EVIDENCE_SERIALIZATION_FAILED',
|
|
87
|
+
E_UCP_KEY_ALGORITHM_MISMATCH: 'E_UCP_KEY_ALGORITHM_MISMATCH',
|
|
88
|
+
E_UCP_KEY_CURVE_MISMATCH: 'E_UCP_KEY_CURVE_MISMATCH',
|
|
89
|
+
E_UCP_KEY_NOT_FOUND: 'E_UCP_KEY_NOT_FOUND',
|
|
90
|
+
E_UCP_ORDER_INVALID: 'E_UCP_ORDER_INVALID',
|
|
91
|
+
E_UCP_ORDER_MISSING_ID: 'E_UCP_ORDER_MISSING_ID',
|
|
92
|
+
E_UCP_ORDER_MISSING_LINE_ITEMS: 'E_UCP_ORDER_MISSING_LINE_ITEMS',
|
|
93
|
+
E_UCP_ORDER_MISSING_TOTALS: 'E_UCP_ORDER_MISSING_TOTALS',
|
|
94
|
+
E_UCP_PAYLOAD_EMPTY: 'E_UCP_PAYLOAD_EMPTY',
|
|
95
|
+
E_UCP_PAYLOAD_NOT_JSON: 'E_UCP_PAYLOAD_NOT_JSON',
|
|
96
|
+
E_UCP_PAYLOAD_TOO_LARGE: 'E_UCP_PAYLOAD_TOO_LARGE',
|
|
97
|
+
E_UCP_PROFILE_FETCH_FAILED: 'E_UCP_PROFILE_FETCH_FAILED',
|
|
98
|
+
E_UCP_PROFILE_INVALID: 'E_UCP_PROFILE_INVALID',
|
|
99
|
+
E_UCP_PROFILE_NO_SIGNING_KEYS: 'E_UCP_PROFILE_NO_SIGNING_KEYS',
|
|
100
|
+
E_UCP_SIGNATURE_ALGORITHM_UNSUPPORTED: 'E_UCP_SIGNATURE_ALGORITHM_UNSUPPORTED',
|
|
101
|
+
E_UCP_SIGNATURE_B64_INVALID: 'E_UCP_SIGNATURE_B64_INVALID',
|
|
102
|
+
E_UCP_SIGNATURE_INVALID: 'E_UCP_SIGNATURE_INVALID',
|
|
103
|
+
E_UCP_SIGNATURE_MALFORMED: 'E_UCP_SIGNATURE_MALFORMED',
|
|
104
|
+
E_UCP_SIGNATURE_MISSING: 'E_UCP_SIGNATURE_MISSING',
|
|
105
|
+
E_UCP_VERIFICATION_FAILED: 'E_UCP_VERIFICATION_FAILED',
|
|
106
|
+
// Validation error codes
|
|
107
|
+
E_EVIDENCE_NOT_JSON: 'E_EVIDENCE_NOT_JSON',
|
|
108
|
+
E_EXPIRED: 'E_EXPIRED',
|
|
109
|
+
E_INVALID_AMOUNT: 'E_INVALID_AMOUNT',
|
|
110
|
+
E_INVALID_AUDIENCE: 'E_INVALID_AUDIENCE',
|
|
111
|
+
E_INVALID_CURRENCY: 'E_INVALID_CURRENCY',
|
|
112
|
+
E_INVALID_FORMAT: 'E_INVALID_FORMAT',
|
|
113
|
+
E_INVALID_ISSUER: 'E_INVALID_ISSUER',
|
|
114
|
+
E_INVALID_RAIL: 'E_INVALID_RAIL',
|
|
115
|
+
E_INVALID_RECEIPT_ID: 'E_INVALID_RECEIPT_ID',
|
|
116
|
+
E_INVALID_SUBJECT: 'E_INVALID_SUBJECT',
|
|
117
|
+
E_MISSING_EXP: 'E_MISSING_EXP',
|
|
118
|
+
E_MISSING_REQUIRED_CLAIM: 'E_MISSING_REQUIRED_CLAIM',
|
|
119
|
+
E_NOT_YET_VALID: 'E_NOT_YET_VALID',
|
|
120
|
+
// Verification error codes
|
|
121
|
+
E_INVALID_SIGNATURE: 'E_INVALID_SIGNATURE',
|
|
122
|
+
E_KEY_NOT_FOUND: 'E_KEY_NOT_FOUND',
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Error definitions map with full metadata
|
|
126
|
+
*/
|
|
127
|
+
exports.ERRORS = {
|
|
128
|
+
// Attribution error codes
|
|
129
|
+
E_ATTRIBUTION_CHAIN_TOO_DEEP: {
|
|
130
|
+
code: 'E_ATTRIBUTION_CHAIN_TOO_DEEP',
|
|
131
|
+
http_status: 400,
|
|
132
|
+
title: 'Attribution Chain Too Deep',
|
|
133
|
+
description: 'Attribution chain exceeds maximum allowed depth (8)',
|
|
134
|
+
retriable: false,
|
|
135
|
+
category: 'attribution',
|
|
136
|
+
},
|
|
137
|
+
E_ATTRIBUTION_CIRCULAR_CHAIN: {
|
|
138
|
+
code: 'E_ATTRIBUTION_CIRCULAR_CHAIN',
|
|
139
|
+
http_status: 400,
|
|
140
|
+
title: 'Attribution Circular Chain',
|
|
141
|
+
description: 'Circular reference detected in attribution chain',
|
|
142
|
+
retriable: false,
|
|
143
|
+
category: 'attribution',
|
|
144
|
+
},
|
|
145
|
+
E_ATTRIBUTION_EXPIRED: {
|
|
146
|
+
code: 'E_ATTRIBUTION_EXPIRED',
|
|
147
|
+
http_status: 401,
|
|
148
|
+
title: 'Attribution Expired',
|
|
149
|
+
description: 'Attribution attestation has exceeded its expiration time',
|
|
150
|
+
retriable: false,
|
|
151
|
+
category: 'attribution',
|
|
152
|
+
},
|
|
153
|
+
E_ATTRIBUTION_HASH_INVALID: {
|
|
154
|
+
code: 'E_ATTRIBUTION_HASH_INVALID',
|
|
155
|
+
http_status: 400,
|
|
156
|
+
title: 'Attribution Hash Invalid',
|
|
157
|
+
description: 'Content hash structure is invalid (wrong algorithm, encoding, or value length)',
|
|
158
|
+
retriable: false,
|
|
159
|
+
category: 'attribution',
|
|
160
|
+
},
|
|
161
|
+
E_ATTRIBUTION_INVALID_FORMAT: {
|
|
162
|
+
code: 'E_ATTRIBUTION_INVALID_FORMAT',
|
|
163
|
+
http_status: 400,
|
|
164
|
+
title: 'Attribution Invalid Format',
|
|
165
|
+
description: 'Attribution attestation does not conform to schema',
|
|
166
|
+
retriable: false,
|
|
167
|
+
category: 'attribution',
|
|
168
|
+
},
|
|
169
|
+
E_ATTRIBUTION_INVALID_REF: {
|
|
170
|
+
code: 'E_ATTRIBUTION_INVALID_REF',
|
|
171
|
+
http_status: 400,
|
|
172
|
+
title: 'Attribution Invalid Reference',
|
|
173
|
+
description: 'Receipt reference format is invalid (must be jti:{id}, URL, or URN)',
|
|
174
|
+
retriable: false,
|
|
175
|
+
category: 'attribution',
|
|
176
|
+
},
|
|
177
|
+
E_ATTRIBUTION_INVALID_WEIGHT: {
|
|
178
|
+
code: 'E_ATTRIBUTION_INVALID_WEIGHT',
|
|
179
|
+
http_status: 400,
|
|
180
|
+
title: 'Attribution Invalid Weight',
|
|
181
|
+
description: 'Attribution weight is out of valid range (must be 0.0-1.0)',
|
|
182
|
+
retriable: false,
|
|
183
|
+
category: 'attribution',
|
|
184
|
+
},
|
|
185
|
+
E_ATTRIBUTION_MISSING_SOURCES: {
|
|
186
|
+
code: 'E_ATTRIBUTION_MISSING_SOURCES',
|
|
187
|
+
http_status: 400,
|
|
188
|
+
title: 'Attribution Missing Sources',
|
|
189
|
+
description: 'Attribution attestation has empty sources array',
|
|
190
|
+
retriable: false,
|
|
191
|
+
category: 'attribution',
|
|
192
|
+
},
|
|
193
|
+
E_ATTRIBUTION_NOT_YET_VALID: {
|
|
194
|
+
code: 'E_ATTRIBUTION_NOT_YET_VALID',
|
|
195
|
+
http_status: 401,
|
|
196
|
+
title: 'Attribution Not Yet Valid',
|
|
197
|
+
description: 'Attribution attestation issued_at time is in the future',
|
|
198
|
+
retriable: true,
|
|
199
|
+
category: 'attribution',
|
|
200
|
+
},
|
|
201
|
+
E_ATTRIBUTION_RESOLUTION_FAILED: {
|
|
202
|
+
code: 'E_ATTRIBUTION_RESOLUTION_FAILED',
|
|
203
|
+
http_status: 502,
|
|
204
|
+
title: 'Attribution Resolution Failed',
|
|
205
|
+
description: 'Failed to resolve receipt reference in attribution chain',
|
|
206
|
+
retriable: true,
|
|
207
|
+
category: 'attribution',
|
|
208
|
+
},
|
|
209
|
+
E_ATTRIBUTION_RESOLUTION_TIMEOUT: {
|
|
210
|
+
code: 'E_ATTRIBUTION_RESOLUTION_TIMEOUT',
|
|
211
|
+
http_status: 504,
|
|
212
|
+
title: 'Attribution Resolution Timeout',
|
|
213
|
+
description: 'Timeout while resolving receipt reference in attribution chain',
|
|
214
|
+
retriable: true,
|
|
215
|
+
category: 'attribution',
|
|
216
|
+
},
|
|
217
|
+
E_ATTRIBUTION_SIZE_EXCEEDED: {
|
|
218
|
+
code: 'E_ATTRIBUTION_SIZE_EXCEEDED',
|
|
219
|
+
http_status: 400,
|
|
220
|
+
title: 'Attribution Size Exceeded',
|
|
221
|
+
description: 'Attribution attestation exceeds maximum size (64KB)',
|
|
222
|
+
retriable: false,
|
|
223
|
+
category: 'attribution',
|
|
224
|
+
},
|
|
225
|
+
E_ATTRIBUTION_TOO_MANY_SOURCES: {
|
|
226
|
+
code: 'E_ATTRIBUTION_TOO_MANY_SOURCES',
|
|
227
|
+
http_status: 400,
|
|
228
|
+
title: 'Attribution Too Many Sources',
|
|
229
|
+
description: 'Attribution has too many sources (maximum 100)',
|
|
230
|
+
retriable: false,
|
|
231
|
+
category: 'attribution',
|
|
232
|
+
},
|
|
233
|
+
E_ATTRIBUTION_UNKNOWN_USAGE: {
|
|
234
|
+
code: 'E_ATTRIBUTION_UNKNOWN_USAGE',
|
|
235
|
+
http_status: 400,
|
|
236
|
+
title: 'Attribution Unknown Usage',
|
|
237
|
+
description: 'Attribution usage type is not recognized',
|
|
238
|
+
retriable: false,
|
|
239
|
+
category: 'attribution',
|
|
240
|
+
},
|
|
241
|
+
// Bundle error codes
|
|
242
|
+
E_BUNDLE_DUPLICATE_RECEIPT: {
|
|
243
|
+
code: 'E_BUNDLE_DUPLICATE_RECEIPT',
|
|
244
|
+
http_status: 400,
|
|
245
|
+
title: 'Bundle Duplicate Receipt',
|
|
246
|
+
description: 'Bundle contains multiple receipts with the same ID',
|
|
247
|
+
retriable: false,
|
|
248
|
+
category: 'bundle',
|
|
249
|
+
},
|
|
250
|
+
E_BUNDLE_HASH_MISMATCH: {
|
|
251
|
+
code: 'E_BUNDLE_HASH_MISMATCH',
|
|
252
|
+
http_status: 400,
|
|
253
|
+
title: 'Bundle Hash Mismatch',
|
|
254
|
+
description: 'File hash does not match value declared in manifest.json',
|
|
255
|
+
retriable: false,
|
|
256
|
+
category: 'bundle',
|
|
257
|
+
},
|
|
258
|
+
E_BUNDLE_INVALID_FORMAT: {
|
|
259
|
+
code: 'E_BUNDLE_INVALID_FORMAT',
|
|
260
|
+
http_status: 400,
|
|
261
|
+
title: 'Bundle Invalid Format',
|
|
262
|
+
description: 'Bundle archive structure is invalid (not a valid ZIP or missing required files)',
|
|
263
|
+
retriable: false,
|
|
264
|
+
category: 'bundle',
|
|
265
|
+
},
|
|
266
|
+
E_BUNDLE_KEY_MISSING: {
|
|
267
|
+
code: 'E_BUNDLE_KEY_MISSING',
|
|
268
|
+
http_status: 400,
|
|
269
|
+
title: 'Bundle Key Missing',
|
|
270
|
+
description: 'Required signing key not found in bundle (offline verification mode)',
|
|
271
|
+
retriable: false,
|
|
272
|
+
category: 'bundle',
|
|
273
|
+
},
|
|
274
|
+
E_BUNDLE_MANIFEST_INVALID: {
|
|
275
|
+
code: 'E_BUNDLE_MANIFEST_INVALID',
|
|
276
|
+
http_status: 400,
|
|
277
|
+
title: 'Bundle Manifest Invalid',
|
|
278
|
+
description: 'manifest.json does not conform to schema or contains invalid values',
|
|
279
|
+
retriable: false,
|
|
280
|
+
category: 'bundle',
|
|
281
|
+
},
|
|
282
|
+
E_BUNDLE_MANIFEST_MISSING: {
|
|
283
|
+
code: 'E_BUNDLE_MANIFEST_MISSING',
|
|
284
|
+
http_status: 400,
|
|
285
|
+
title: 'Bundle Manifest Missing',
|
|
286
|
+
description: 'manifest.json not found at bundle archive root',
|
|
287
|
+
retriable: false,
|
|
288
|
+
category: 'bundle',
|
|
289
|
+
},
|
|
290
|
+
E_BUNDLE_MISSING_KEYS: {
|
|
291
|
+
code: 'E_BUNDLE_MISSING_KEYS',
|
|
292
|
+
http_status: 400,
|
|
293
|
+
title: 'Bundle Missing Keys',
|
|
294
|
+
description: 'No verification keys provided in bundle JWKS',
|
|
295
|
+
retriable: false,
|
|
296
|
+
category: 'bundle',
|
|
297
|
+
},
|
|
298
|
+
E_BUNDLE_MISSING_RECEIPTS: {
|
|
299
|
+
code: 'E_BUNDLE_MISSING_RECEIPTS',
|
|
300
|
+
http_status: 400,
|
|
301
|
+
title: 'Bundle Missing Receipts',
|
|
302
|
+
description: 'No receipts provided when creating bundle',
|
|
303
|
+
retriable: false,
|
|
304
|
+
category: 'bundle',
|
|
305
|
+
},
|
|
306
|
+
E_BUNDLE_PATH_TRAVERSAL: {
|
|
307
|
+
code: 'E_BUNDLE_PATH_TRAVERSAL',
|
|
308
|
+
http_status: 400,
|
|
309
|
+
title: 'Bundle Path Traversal',
|
|
310
|
+
description: 'Bundle contains path traversal attack (zip-slip vulnerability)',
|
|
311
|
+
retriable: false,
|
|
312
|
+
category: 'bundle',
|
|
313
|
+
},
|
|
314
|
+
E_BUNDLE_POLICY_HASH_MISMATCH: {
|
|
315
|
+
code: 'E_BUNDLE_POLICY_HASH_MISMATCH',
|
|
316
|
+
http_status: 400,
|
|
317
|
+
title: 'Bundle Policy Hash Mismatch',
|
|
318
|
+
description: 'Policy snapshot hash does not match policy used to evaluate receipts',
|
|
319
|
+
retriable: false,
|
|
320
|
+
category: 'bundle',
|
|
321
|
+
},
|
|
322
|
+
E_BUNDLE_RECEIPT_INVALID: {
|
|
323
|
+
code: 'E_BUNDLE_RECEIPT_INVALID',
|
|
324
|
+
http_status: 400,
|
|
325
|
+
title: 'Bundle Receipt Invalid',
|
|
326
|
+
description: 'Receipt JWS in bundle is malformed or missing required claims',
|
|
327
|
+
retriable: false,
|
|
328
|
+
category: 'bundle',
|
|
329
|
+
},
|
|
330
|
+
E_BUNDLE_RECEIPTS_UNORDERED: {
|
|
331
|
+
code: 'E_BUNDLE_RECEIPTS_UNORDERED',
|
|
332
|
+
http_status: 400,
|
|
333
|
+
title: 'Bundle Receipts Unordered',
|
|
334
|
+
description: 'receipts.ndjson is not in deterministic order (issued_at, receipt_id, receipt_hash)',
|
|
335
|
+
retriable: false,
|
|
336
|
+
category: 'bundle',
|
|
337
|
+
},
|
|
338
|
+
E_BUNDLE_SIGNATURE_INVALID: {
|
|
339
|
+
code: 'E_BUNDLE_SIGNATURE_INVALID',
|
|
340
|
+
http_status: 400,
|
|
341
|
+
title: 'Bundle Signature Invalid',
|
|
342
|
+
description: 'bundle.sig JWS verification failed over manifest hash',
|
|
343
|
+
retriable: false,
|
|
344
|
+
category: 'bundle',
|
|
345
|
+
},
|
|
346
|
+
E_BUNDLE_SIZE_EXCEEDED: {
|
|
347
|
+
code: 'E_BUNDLE_SIZE_EXCEEDED',
|
|
348
|
+
http_status: 400,
|
|
349
|
+
title: 'Bundle Size Exceeded',
|
|
350
|
+
description: 'Bundle exceeds size limits (entry count, entry size, or total size)',
|
|
351
|
+
retriable: false,
|
|
352
|
+
category: 'bundle',
|
|
353
|
+
},
|
|
354
|
+
E_BUNDLE_TIME_RANGE_INVALID: {
|
|
355
|
+
code: 'E_BUNDLE_TIME_RANGE_INVALID',
|
|
356
|
+
http_status: 400,
|
|
357
|
+
title: 'Bundle Time Range Invalid',
|
|
358
|
+
description: 'Receipt issued_at is outside the bundle declared time_range',
|
|
359
|
+
retriable: false,
|
|
360
|
+
category: 'bundle',
|
|
361
|
+
},
|
|
362
|
+
// Control error codes
|
|
363
|
+
E_CONTROL_DENIED: {
|
|
364
|
+
code: 'E_CONTROL_DENIED',
|
|
365
|
+
http_status: 403,
|
|
366
|
+
title: 'Control Decision Denied',
|
|
367
|
+
description: 'Control engine denied authorization',
|
|
368
|
+
retriable: false,
|
|
369
|
+
category: 'control',
|
|
370
|
+
},
|
|
371
|
+
E_CONTROL_REVIEW_REQUIRED: {
|
|
372
|
+
code: 'E_CONTROL_REVIEW_REQUIRED',
|
|
373
|
+
http_status: 202,
|
|
374
|
+
title: 'Review Required',
|
|
375
|
+
description: 'Control engine requires manual review',
|
|
376
|
+
retriable: true,
|
|
377
|
+
category: 'control',
|
|
378
|
+
},
|
|
379
|
+
// Dispute error codes
|
|
380
|
+
E_DISPUTE_DUPLICATE: {
|
|
381
|
+
code: 'E_DISPUTE_DUPLICATE',
|
|
382
|
+
http_status: 409,
|
|
383
|
+
title: 'Dispute Duplicate',
|
|
384
|
+
description: 'A dispute with this ID already exists',
|
|
385
|
+
retriable: false,
|
|
386
|
+
category: 'dispute',
|
|
387
|
+
},
|
|
388
|
+
E_DISPUTE_EXPIRED: {
|
|
389
|
+
code: 'E_DISPUTE_EXPIRED',
|
|
390
|
+
http_status: 401,
|
|
391
|
+
title: 'Dispute Expired',
|
|
392
|
+
description: 'Dispute attestation has exceeded its expiration time',
|
|
393
|
+
retriable: false,
|
|
394
|
+
category: 'dispute',
|
|
395
|
+
},
|
|
396
|
+
E_DISPUTE_INVALID_FORMAT: {
|
|
397
|
+
code: 'E_DISPUTE_INVALID_FORMAT',
|
|
398
|
+
http_status: 400,
|
|
399
|
+
title: 'Dispute Invalid Format',
|
|
400
|
+
description: 'Dispute attestation does not conform to schema',
|
|
401
|
+
retriable: false,
|
|
402
|
+
category: 'dispute',
|
|
403
|
+
},
|
|
404
|
+
E_DISPUTE_INVALID_GROUNDS: {
|
|
405
|
+
code: 'E_DISPUTE_INVALID_GROUNDS',
|
|
406
|
+
http_status: 400,
|
|
407
|
+
title: 'Dispute Invalid Grounds',
|
|
408
|
+
description: 'Dispute grounds code is not recognized',
|
|
409
|
+
retriable: false,
|
|
410
|
+
category: 'dispute',
|
|
411
|
+
},
|
|
412
|
+
E_DISPUTE_INVALID_ID: {
|
|
413
|
+
code: 'E_DISPUTE_INVALID_ID',
|
|
414
|
+
http_status: 400,
|
|
415
|
+
title: 'Dispute Invalid ID',
|
|
416
|
+
description: 'Dispute ID is not a valid ULID format (26 uppercase alphanumeric characters)',
|
|
417
|
+
retriable: false,
|
|
418
|
+
category: 'dispute',
|
|
419
|
+
},
|
|
420
|
+
E_DISPUTE_INVALID_STATE: {
|
|
421
|
+
code: 'E_DISPUTE_INVALID_STATE',
|
|
422
|
+
http_status: 400,
|
|
423
|
+
title: 'Dispute Invalid State',
|
|
424
|
+
description: 'Dispute state is not recognized',
|
|
425
|
+
retriable: false,
|
|
426
|
+
category: 'dispute',
|
|
427
|
+
},
|
|
428
|
+
E_DISPUTE_INVALID_TARGET_TYPE: {
|
|
429
|
+
code: 'E_DISPUTE_INVALID_TARGET_TYPE',
|
|
430
|
+
http_status: 400,
|
|
431
|
+
title: 'Dispute Invalid Target Type',
|
|
432
|
+
description: 'Dispute target type is not recognized (must be receipt, attribution, identity, or policy)',
|
|
433
|
+
retriable: false,
|
|
434
|
+
category: 'dispute',
|
|
435
|
+
},
|
|
436
|
+
E_DISPUTE_INVALID_TRANSITION: {
|
|
437
|
+
code: 'E_DISPUTE_INVALID_TRANSITION',
|
|
438
|
+
http_status: 400,
|
|
439
|
+
title: 'Dispute Invalid Transition',
|
|
440
|
+
description: 'Invalid state transition for dispute lifecycle',
|
|
441
|
+
retriable: false,
|
|
442
|
+
category: 'dispute',
|
|
443
|
+
},
|
|
444
|
+
E_DISPUTE_INVALID_TYPE: {
|
|
445
|
+
code: 'E_DISPUTE_INVALID_TYPE',
|
|
446
|
+
http_status: 400,
|
|
447
|
+
title: 'Dispute Invalid Type',
|
|
448
|
+
description: 'Dispute type is not recognized',
|
|
449
|
+
retriable: false,
|
|
450
|
+
category: 'dispute',
|
|
451
|
+
},
|
|
452
|
+
E_DISPUTE_MISSING_RESOLUTION: {
|
|
453
|
+
code: 'E_DISPUTE_MISSING_RESOLUTION',
|
|
454
|
+
http_status: 400,
|
|
455
|
+
title: 'Dispute Missing Resolution',
|
|
456
|
+
description: 'Resolution is required for terminal states (resolved, rejected, final)',
|
|
457
|
+
retriable: false,
|
|
458
|
+
category: 'dispute',
|
|
459
|
+
},
|
|
460
|
+
E_DISPUTE_NOT_YET_VALID: {
|
|
461
|
+
code: 'E_DISPUTE_NOT_YET_VALID',
|
|
462
|
+
http_status: 401,
|
|
463
|
+
title: 'Dispute Not Yet Valid',
|
|
464
|
+
description: 'Dispute attestation issued_at time is in the future',
|
|
465
|
+
retriable: true,
|
|
466
|
+
category: 'dispute',
|
|
467
|
+
},
|
|
468
|
+
E_DISPUTE_OTHER_REQUIRES_DESCRIPTION: {
|
|
469
|
+
code: 'E_DISPUTE_OTHER_REQUIRES_DESCRIPTION',
|
|
470
|
+
http_status: 400,
|
|
471
|
+
title: 'Dispute Other Requires Description',
|
|
472
|
+
description: "Dispute type 'other' requires description of at least 50 characters",
|
|
473
|
+
retriable: false,
|
|
474
|
+
category: 'dispute',
|
|
475
|
+
},
|
|
476
|
+
E_DISPUTE_RESOLUTION_NOT_ALLOWED: {
|
|
477
|
+
code: 'E_DISPUTE_RESOLUTION_NOT_ALLOWED',
|
|
478
|
+
http_status: 400,
|
|
479
|
+
title: 'Dispute Resolution Not Allowed',
|
|
480
|
+
description: 'Resolution is only valid for terminal states',
|
|
481
|
+
retriable: false,
|
|
482
|
+
category: 'dispute',
|
|
483
|
+
},
|
|
484
|
+
E_DISPUTE_TARGET_NOT_FOUND: {
|
|
485
|
+
code: 'E_DISPUTE_TARGET_NOT_FOUND',
|
|
486
|
+
http_status: 404,
|
|
487
|
+
title: 'Dispute Target Not Found',
|
|
488
|
+
description: 'The target receipt, attribution, or identity being disputed was not found',
|
|
489
|
+
retriable: true,
|
|
490
|
+
category: 'dispute',
|
|
491
|
+
},
|
|
492
|
+
// Identity error codes
|
|
493
|
+
E_IDENTITY_BINDING_FUTURE: {
|
|
494
|
+
code: 'E_IDENTITY_BINDING_FUTURE',
|
|
495
|
+
http_status: 400,
|
|
496
|
+
title: 'Identity Binding Future',
|
|
497
|
+
description: 'Identity binding signed_at timestamp is in the future',
|
|
498
|
+
retriable: false,
|
|
499
|
+
category: 'identity',
|
|
500
|
+
},
|
|
501
|
+
E_IDENTITY_BINDING_MISMATCH: {
|
|
502
|
+
code: 'E_IDENTITY_BINDING_MISMATCH',
|
|
503
|
+
http_status: 400,
|
|
504
|
+
title: 'Identity Binding Mismatch',
|
|
505
|
+
description: 'Identity binding does not match the request being verified',
|
|
506
|
+
retriable: false,
|
|
507
|
+
category: 'identity',
|
|
508
|
+
},
|
|
509
|
+
E_IDENTITY_BINDING_STALE: {
|
|
510
|
+
code: 'E_IDENTITY_BINDING_STALE',
|
|
511
|
+
http_status: 401,
|
|
512
|
+
title: 'Identity Binding Stale',
|
|
513
|
+
description: 'Identity binding is too old and requires fresh binding',
|
|
514
|
+
retriable: true,
|
|
515
|
+
category: 'identity',
|
|
516
|
+
},
|
|
517
|
+
E_IDENTITY_DIRECTORY_UNAVAILABLE: {
|
|
518
|
+
code: 'E_IDENTITY_DIRECTORY_UNAVAILABLE',
|
|
519
|
+
http_status: 503,
|
|
520
|
+
title: 'Identity Directory Unavailable',
|
|
521
|
+
description: 'Failed to fetch agent key directory',
|
|
522
|
+
retriable: true,
|
|
523
|
+
category: 'identity',
|
|
524
|
+
},
|
|
525
|
+
E_IDENTITY_EXPIRED: {
|
|
526
|
+
code: 'E_IDENTITY_EXPIRED',
|
|
527
|
+
http_status: 401,
|
|
528
|
+
title: 'Identity Expired',
|
|
529
|
+
description: 'Agent identity attestation has exceeded its expiration time',
|
|
530
|
+
retriable: false,
|
|
531
|
+
category: 'identity',
|
|
532
|
+
},
|
|
533
|
+
E_IDENTITY_INVALID_FORMAT: {
|
|
534
|
+
code: 'E_IDENTITY_INVALID_FORMAT',
|
|
535
|
+
http_status: 400,
|
|
536
|
+
title: 'Identity Invalid Format',
|
|
537
|
+
description: 'Agent identity attestation does not conform to schema',
|
|
538
|
+
retriable: false,
|
|
539
|
+
category: 'identity',
|
|
540
|
+
},
|
|
541
|
+
E_IDENTITY_KEY_EXPIRED: {
|
|
542
|
+
code: 'E_IDENTITY_KEY_EXPIRED',
|
|
543
|
+
http_status: 401,
|
|
544
|
+
title: 'Identity Key Expired',
|
|
545
|
+
description: 'Agent signing key has expired per directory metadata',
|
|
546
|
+
retriable: false,
|
|
547
|
+
category: 'identity',
|
|
548
|
+
},
|
|
549
|
+
E_IDENTITY_KEY_REVOKED: {
|
|
550
|
+
code: 'E_IDENTITY_KEY_REVOKED',
|
|
551
|
+
http_status: 401,
|
|
552
|
+
title: 'Identity Key Revoked',
|
|
553
|
+
description: 'Agent signing key has been explicitly revoked',
|
|
554
|
+
retriable: false,
|
|
555
|
+
category: 'identity',
|
|
556
|
+
},
|
|
557
|
+
E_IDENTITY_KEY_UNKNOWN: {
|
|
558
|
+
code: 'E_IDENTITY_KEY_UNKNOWN',
|
|
559
|
+
http_status: 401,
|
|
560
|
+
title: 'Identity Key Unknown',
|
|
561
|
+
description: 'Key ID not found in agent key directory',
|
|
562
|
+
retriable: true,
|
|
563
|
+
category: 'identity',
|
|
564
|
+
},
|
|
565
|
+
E_IDENTITY_MISSING: {
|
|
566
|
+
code: 'E_IDENTITY_MISSING',
|
|
567
|
+
http_status: 401,
|
|
568
|
+
title: 'Identity Missing',
|
|
569
|
+
description: 'No agent identity attestation provided in request',
|
|
570
|
+
retriable: false,
|
|
571
|
+
category: 'identity',
|
|
572
|
+
},
|
|
573
|
+
E_IDENTITY_NOT_YET_VALID: {
|
|
574
|
+
code: 'E_IDENTITY_NOT_YET_VALID',
|
|
575
|
+
http_status: 401,
|
|
576
|
+
title: 'Identity Not Yet Valid',
|
|
577
|
+
description: 'Agent identity attestation issued_at time is in the future',
|
|
578
|
+
retriable: true,
|
|
579
|
+
category: 'identity',
|
|
580
|
+
},
|
|
581
|
+
E_IDENTITY_PROOF_UNSUPPORTED: {
|
|
582
|
+
code: 'E_IDENTITY_PROOF_UNSUPPORTED',
|
|
583
|
+
http_status: 400,
|
|
584
|
+
title: 'Identity Proof Unsupported',
|
|
585
|
+
description: 'Agent identity proof method is not supported',
|
|
586
|
+
retriable: false,
|
|
587
|
+
category: 'identity',
|
|
588
|
+
},
|
|
589
|
+
E_IDENTITY_SIG_INVALID: {
|
|
590
|
+
code: 'E_IDENTITY_SIG_INVALID',
|
|
591
|
+
http_status: 401,
|
|
592
|
+
title: 'Identity Signature Invalid',
|
|
593
|
+
description: 'Agent identity proof signature verification failed',
|
|
594
|
+
retriable: false,
|
|
595
|
+
category: 'identity',
|
|
596
|
+
},
|
|
597
|
+
// Infrastructure error codes
|
|
598
|
+
E_CIRCUIT_BREAKER_OPEN: {
|
|
599
|
+
code: 'E_CIRCUIT_BREAKER_OPEN',
|
|
600
|
+
http_status: 503,
|
|
601
|
+
title: 'Circuit Breaker Open',
|
|
602
|
+
description: 'Service temporarily unavailable due to circuit breaker',
|
|
603
|
+
retriable: true,
|
|
604
|
+
category: 'infrastructure',
|
|
605
|
+
},
|
|
606
|
+
E_INTERNAL: {
|
|
607
|
+
code: 'E_INTERNAL',
|
|
608
|
+
http_status: 500,
|
|
609
|
+
title: 'Internal Error',
|
|
610
|
+
description: 'An unexpected internal error occurred during verification',
|
|
611
|
+
retriable: true,
|
|
612
|
+
category: 'infrastructure',
|
|
613
|
+
},
|
|
614
|
+
E_JWKS_FETCH_FAILED: {
|
|
615
|
+
code: 'E_JWKS_FETCH_FAILED',
|
|
616
|
+
http_status: 503,
|
|
617
|
+
title: 'JWKS Fetch Failed',
|
|
618
|
+
description: 'Failed to fetch public keys from JWKS endpoint',
|
|
619
|
+
retriable: true,
|
|
620
|
+
category: 'infrastructure',
|
|
621
|
+
},
|
|
622
|
+
E_RATE_LIMITED: {
|
|
623
|
+
code: 'E_RATE_LIMITED',
|
|
624
|
+
http_status: 429,
|
|
625
|
+
title: 'Rate Limited',
|
|
626
|
+
description: 'Too many requests, please retry later',
|
|
627
|
+
retriable: true,
|
|
628
|
+
category: 'infrastructure',
|
|
629
|
+
},
|
|
630
|
+
// Ucp error codes
|
|
631
|
+
E_UCP_EVIDENCE_SERIALIZATION_FAILED: {
|
|
632
|
+
code: 'E_UCP_EVIDENCE_SERIALIZATION_FAILED',
|
|
633
|
+
http_status: 500,
|
|
634
|
+
title: 'UCP Evidence Serialization Failed',
|
|
635
|
+
description: 'Failed to serialize UCP evidence to YAML format',
|
|
636
|
+
retriable: false,
|
|
637
|
+
category: 'ucp',
|
|
638
|
+
},
|
|
639
|
+
E_UCP_KEY_ALGORITHM_MISMATCH: {
|
|
640
|
+
code: 'E_UCP_KEY_ALGORITHM_MISMATCH',
|
|
641
|
+
http_status: 401,
|
|
642
|
+
title: 'UCP Key Algorithm Mismatch',
|
|
643
|
+
description: 'Key type is not EC as required for ECDSA signatures',
|
|
644
|
+
retriable: false,
|
|
645
|
+
category: 'ucp',
|
|
646
|
+
},
|
|
647
|
+
E_UCP_KEY_CURVE_MISMATCH: {
|
|
648
|
+
code: 'E_UCP_KEY_CURVE_MISMATCH',
|
|
649
|
+
http_status: 401,
|
|
650
|
+
title: 'UCP Key Curve Mismatch',
|
|
651
|
+
description: 'Key curve does not match signature algorithm (ES256=P-256, ES384=P-384, ES512=P-521)',
|
|
652
|
+
retriable: false,
|
|
653
|
+
category: 'ucp',
|
|
654
|
+
},
|
|
655
|
+
E_UCP_KEY_NOT_FOUND: {
|
|
656
|
+
code: 'E_UCP_KEY_NOT_FOUND',
|
|
657
|
+
http_status: 401,
|
|
658
|
+
title: 'UCP Key Not Found',
|
|
659
|
+
description: 'Key ID from signature not found in business UCP profile',
|
|
660
|
+
retriable: true,
|
|
661
|
+
category: 'ucp',
|
|
662
|
+
},
|
|
663
|
+
E_UCP_ORDER_INVALID: {
|
|
664
|
+
code: 'E_UCP_ORDER_INVALID',
|
|
665
|
+
http_status: 400,
|
|
666
|
+
title: 'UCP Order Invalid',
|
|
667
|
+
description: 'UCP order object does not conform to expected schema',
|
|
668
|
+
retriable: false,
|
|
669
|
+
category: 'ucp',
|
|
670
|
+
},
|
|
671
|
+
E_UCP_ORDER_MISSING_ID: {
|
|
672
|
+
code: 'E_UCP_ORDER_MISSING_ID',
|
|
673
|
+
http_status: 400,
|
|
674
|
+
title: 'UCP Order Missing ID',
|
|
675
|
+
description: 'UCP order is missing required id field',
|
|
676
|
+
retriable: false,
|
|
677
|
+
category: 'ucp',
|
|
678
|
+
},
|
|
679
|
+
E_UCP_ORDER_MISSING_LINE_ITEMS: {
|
|
680
|
+
code: 'E_UCP_ORDER_MISSING_LINE_ITEMS',
|
|
681
|
+
http_status: 400,
|
|
682
|
+
title: 'UCP Order Missing Line Items',
|
|
683
|
+
description: 'UCP order is missing required line_items array',
|
|
684
|
+
retriable: false,
|
|
685
|
+
category: 'ucp',
|
|
686
|
+
},
|
|
687
|
+
E_UCP_ORDER_MISSING_TOTALS: {
|
|
688
|
+
code: 'E_UCP_ORDER_MISSING_TOTALS',
|
|
689
|
+
http_status: 400,
|
|
690
|
+
title: 'UCP Order Missing Totals',
|
|
691
|
+
description: 'UCP order is missing required totals array or total entry',
|
|
692
|
+
retriable: false,
|
|
693
|
+
category: 'ucp',
|
|
694
|
+
},
|
|
695
|
+
E_UCP_PAYLOAD_EMPTY: {
|
|
696
|
+
code: 'E_UCP_PAYLOAD_EMPTY',
|
|
697
|
+
http_status: 400,
|
|
698
|
+
title: 'UCP Payload Empty',
|
|
699
|
+
description: 'Webhook request body is empty',
|
|
700
|
+
retriable: false,
|
|
701
|
+
category: 'ucp',
|
|
702
|
+
},
|
|
703
|
+
E_UCP_PAYLOAD_NOT_JSON: {
|
|
704
|
+
code: 'E_UCP_PAYLOAD_NOT_JSON',
|
|
705
|
+
http_status: 400,
|
|
706
|
+
title: 'UCP Payload Not JSON',
|
|
707
|
+
description: 'Webhook request body is not valid JSON',
|
|
708
|
+
retriable: false,
|
|
709
|
+
category: 'ucp',
|
|
710
|
+
},
|
|
711
|
+
E_UCP_PAYLOAD_TOO_LARGE: {
|
|
712
|
+
code: 'E_UCP_PAYLOAD_TOO_LARGE',
|
|
713
|
+
http_status: 400,
|
|
714
|
+
title: 'UCP Payload Too Large',
|
|
715
|
+
description: 'Webhook request body exceeds maximum allowed size',
|
|
716
|
+
retriable: false,
|
|
717
|
+
category: 'ucp',
|
|
718
|
+
},
|
|
719
|
+
E_UCP_PROFILE_FETCH_FAILED: {
|
|
720
|
+
code: 'E_UCP_PROFILE_FETCH_FAILED',
|
|
721
|
+
http_status: 502,
|
|
722
|
+
title: 'UCP Profile Fetch Failed',
|
|
723
|
+
description: 'Failed to fetch business UCP profile from /.well-known/ucp',
|
|
724
|
+
retriable: true,
|
|
725
|
+
category: 'ucp',
|
|
726
|
+
},
|
|
727
|
+
E_UCP_PROFILE_INVALID: {
|
|
728
|
+
code: 'E_UCP_PROFILE_INVALID',
|
|
729
|
+
http_status: 502,
|
|
730
|
+
title: 'UCP Profile Invalid',
|
|
731
|
+
description: 'Business UCP profile does not conform to expected schema',
|
|
732
|
+
retriable: false,
|
|
733
|
+
category: 'ucp',
|
|
734
|
+
},
|
|
735
|
+
E_UCP_PROFILE_NO_SIGNING_KEYS: {
|
|
736
|
+
code: 'E_UCP_PROFILE_NO_SIGNING_KEYS',
|
|
737
|
+
http_status: 502,
|
|
738
|
+
title: 'UCP Profile No Signing Keys',
|
|
739
|
+
description: 'Business UCP profile has empty or missing signing_keys array',
|
|
740
|
+
retriable: false,
|
|
741
|
+
category: 'ucp',
|
|
742
|
+
},
|
|
743
|
+
E_UCP_SIGNATURE_ALGORITHM_UNSUPPORTED: {
|
|
744
|
+
code: 'E_UCP_SIGNATURE_ALGORITHM_UNSUPPORTED',
|
|
745
|
+
http_status: 400,
|
|
746
|
+
title: 'UCP Signature Algorithm Unsupported',
|
|
747
|
+
description: 'Signature algorithm is not ES256, ES384, or ES512',
|
|
748
|
+
retriable: false,
|
|
749
|
+
category: 'ucp',
|
|
750
|
+
},
|
|
751
|
+
E_UCP_SIGNATURE_B64_INVALID: {
|
|
752
|
+
code: 'E_UCP_SIGNATURE_B64_INVALID',
|
|
753
|
+
http_status: 400,
|
|
754
|
+
title: 'UCP Signature b64 Invalid',
|
|
755
|
+
description: "b64=false requires 'b64' in 'crit' array per RFC 7797",
|
|
756
|
+
retriable: false,
|
|
757
|
+
category: 'ucp',
|
|
758
|
+
},
|
|
759
|
+
E_UCP_SIGNATURE_INVALID: {
|
|
760
|
+
code: 'E_UCP_SIGNATURE_INVALID',
|
|
761
|
+
http_status: 401,
|
|
762
|
+
title: 'UCP Signature Invalid',
|
|
763
|
+
description: 'Webhook signature verification failed against payload',
|
|
764
|
+
retriable: false,
|
|
765
|
+
category: 'ucp',
|
|
766
|
+
},
|
|
767
|
+
E_UCP_SIGNATURE_MALFORMED: {
|
|
768
|
+
code: 'E_UCP_SIGNATURE_MALFORMED',
|
|
769
|
+
http_status: 400,
|
|
770
|
+
title: 'UCP Signature Malformed',
|
|
771
|
+
description: 'Request-Signature header is not a valid detached JWS (RFC 7797)',
|
|
772
|
+
retriable: false,
|
|
773
|
+
category: 'ucp',
|
|
774
|
+
},
|
|
775
|
+
E_UCP_SIGNATURE_MISSING: {
|
|
776
|
+
code: 'E_UCP_SIGNATURE_MISSING',
|
|
777
|
+
http_status: 400,
|
|
778
|
+
title: 'UCP Signature Missing',
|
|
779
|
+
description: 'Request-Signature header is missing from UCP webhook request',
|
|
780
|
+
retriable: false,
|
|
781
|
+
category: 'ucp',
|
|
782
|
+
},
|
|
783
|
+
E_UCP_VERIFICATION_FAILED: {
|
|
784
|
+
code: 'E_UCP_VERIFICATION_FAILED',
|
|
785
|
+
http_status: 401,
|
|
786
|
+
title: 'UCP Verification Failed',
|
|
787
|
+
description: 'All verification attempts failed (raw and JCS canonicalized)',
|
|
788
|
+
retriable: false,
|
|
789
|
+
category: 'ucp',
|
|
790
|
+
},
|
|
791
|
+
// Validation error codes
|
|
792
|
+
E_EVIDENCE_NOT_JSON: {
|
|
793
|
+
code: 'E_EVIDENCE_NOT_JSON',
|
|
794
|
+
http_status: 400,
|
|
795
|
+
title: 'Evidence Not JSON-Safe',
|
|
796
|
+
description: 'Evidence contains non-JSON-safe values (NaN, Infinity, undefined, BigInt, Date, Map, Set, functions, symbols, class instances, or cycles)',
|
|
797
|
+
retriable: false,
|
|
798
|
+
category: 'validation',
|
|
799
|
+
},
|
|
800
|
+
E_EXPIRED: {
|
|
801
|
+
code: 'E_EXPIRED',
|
|
802
|
+
http_status: 400,
|
|
803
|
+
title: 'Receipt Expired',
|
|
804
|
+
description: 'Receipt has exceeded its expiration time',
|
|
805
|
+
retriable: false,
|
|
806
|
+
category: 'validation',
|
|
807
|
+
},
|
|
808
|
+
E_INVALID_AMOUNT: {
|
|
809
|
+
code: 'E_INVALID_AMOUNT',
|
|
810
|
+
http_status: 400,
|
|
811
|
+
title: 'Invalid Amount',
|
|
812
|
+
description: 'Payment amount is invalid or out of allowed range',
|
|
813
|
+
retriable: false,
|
|
814
|
+
category: 'validation',
|
|
815
|
+
},
|
|
816
|
+
E_INVALID_AUDIENCE: {
|
|
817
|
+
code: 'E_INVALID_AUDIENCE',
|
|
818
|
+
http_status: 400,
|
|
819
|
+
title: 'Invalid Audience',
|
|
820
|
+
description: 'Receipt audience claim does not match expected value',
|
|
821
|
+
retriable: false,
|
|
822
|
+
category: 'validation',
|
|
823
|
+
},
|
|
824
|
+
E_INVALID_CURRENCY: {
|
|
825
|
+
code: 'E_INVALID_CURRENCY',
|
|
826
|
+
http_status: 400,
|
|
827
|
+
title: 'Invalid Currency',
|
|
828
|
+
description: 'Currency code is not a valid ISO 4217 code',
|
|
829
|
+
retriable: false,
|
|
830
|
+
category: 'validation',
|
|
831
|
+
},
|
|
832
|
+
E_INVALID_FORMAT: {
|
|
833
|
+
code: 'E_INVALID_FORMAT',
|
|
834
|
+
http_status: 400,
|
|
835
|
+
title: 'Invalid Format',
|
|
836
|
+
description: 'Receipt does not conform to JWS format',
|
|
837
|
+
retriable: false,
|
|
838
|
+
category: 'validation',
|
|
839
|
+
},
|
|
840
|
+
E_INVALID_ISSUER: {
|
|
841
|
+
code: 'E_INVALID_ISSUER',
|
|
842
|
+
http_status: 400,
|
|
843
|
+
title: 'Invalid Issuer',
|
|
844
|
+
description: 'Receipt issuer claim is invalid or untrusted',
|
|
845
|
+
retriable: false,
|
|
846
|
+
category: 'validation',
|
|
847
|
+
},
|
|
848
|
+
E_INVALID_RAIL: {
|
|
849
|
+
code: 'E_INVALID_RAIL',
|
|
850
|
+
http_status: 400,
|
|
851
|
+
title: 'Invalid Payment Rail',
|
|
852
|
+
description: 'Payment rail identifier is not recognized',
|
|
853
|
+
retriable: false,
|
|
854
|
+
category: 'validation',
|
|
855
|
+
},
|
|
856
|
+
E_INVALID_RECEIPT_ID: {
|
|
857
|
+
code: 'E_INVALID_RECEIPT_ID',
|
|
858
|
+
http_status: 400,
|
|
859
|
+
title: 'Invalid Receipt ID',
|
|
860
|
+
description: 'Receipt ID (rid) does not match expected value',
|
|
861
|
+
retriable: false,
|
|
862
|
+
category: 'validation',
|
|
863
|
+
},
|
|
864
|
+
E_INVALID_SUBJECT: {
|
|
865
|
+
code: 'E_INVALID_SUBJECT',
|
|
866
|
+
http_status: 400,
|
|
867
|
+
title: 'Invalid Subject',
|
|
868
|
+
description: 'Receipt subject claim does not match expected value',
|
|
869
|
+
retriable: false,
|
|
870
|
+
category: 'validation',
|
|
871
|
+
},
|
|
872
|
+
E_MISSING_EXP: {
|
|
873
|
+
code: 'E_MISSING_EXP',
|
|
874
|
+
http_status: 400,
|
|
875
|
+
title: 'Missing Expiration',
|
|
876
|
+
description: 'Receipt is missing required exp claim',
|
|
877
|
+
retriable: false,
|
|
878
|
+
category: 'validation',
|
|
879
|
+
},
|
|
880
|
+
E_MISSING_REQUIRED_CLAIM: {
|
|
881
|
+
code: 'E_MISSING_REQUIRED_CLAIM',
|
|
882
|
+
http_status: 400,
|
|
883
|
+
title: 'Missing Required Claim',
|
|
884
|
+
description: 'Receipt is missing a required JWT claim',
|
|
885
|
+
retriable: false,
|
|
886
|
+
category: 'validation',
|
|
887
|
+
},
|
|
888
|
+
E_NOT_YET_VALID: {
|
|
889
|
+
code: 'E_NOT_YET_VALID',
|
|
890
|
+
http_status: 400,
|
|
891
|
+
title: 'Not Yet Valid',
|
|
892
|
+
description: 'Receipt nbf (not before) time is in the future',
|
|
893
|
+
retriable: true,
|
|
894
|
+
category: 'validation',
|
|
895
|
+
},
|
|
896
|
+
// Verification error codes
|
|
897
|
+
E_INVALID_SIGNATURE: {
|
|
898
|
+
code: 'E_INVALID_SIGNATURE',
|
|
899
|
+
http_status: 400,
|
|
900
|
+
title: 'Invalid Signature',
|
|
901
|
+
description: 'Receipt signature verification failed',
|
|
902
|
+
retriable: false,
|
|
903
|
+
category: 'verification',
|
|
904
|
+
},
|
|
905
|
+
E_KEY_NOT_FOUND: {
|
|
906
|
+
code: 'E_KEY_NOT_FOUND',
|
|
907
|
+
http_status: 400,
|
|
908
|
+
title: 'Key Not Found',
|
|
909
|
+
description: 'Public key with specified kid not found in JWKS',
|
|
910
|
+
retriable: false,
|
|
911
|
+
category: 'verification',
|
|
912
|
+
},
|
|
913
|
+
};
|
|
914
|
+
/**
|
|
915
|
+
* Get error definition by code
|
|
916
|
+
*/
|
|
917
|
+
function getError(code) {
|
|
918
|
+
return exports.ERRORS[code];
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Check if error is retriable
|
|
922
|
+
*/
|
|
923
|
+
function isRetriable(code) {
|
|
924
|
+
return exports.ERRORS[code]?.retriable ?? false;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Bundle error codes (for @peac/audit)
|
|
928
|
+
*/
|
|
929
|
+
exports.BUNDLE_ERRORS = {
|
|
930
|
+
DUPLICATE_RECEIPT: 'E_BUNDLE_DUPLICATE_RECEIPT',
|
|
931
|
+
HASH_MISMATCH: 'E_BUNDLE_HASH_MISMATCH',
|
|
932
|
+
INVALID_FORMAT: 'E_BUNDLE_INVALID_FORMAT',
|
|
933
|
+
KEY_MISSING: 'E_BUNDLE_KEY_MISSING',
|
|
934
|
+
MANIFEST_INVALID: 'E_BUNDLE_MANIFEST_INVALID',
|
|
935
|
+
MANIFEST_MISSING: 'E_BUNDLE_MANIFEST_MISSING',
|
|
936
|
+
MISSING_KEYS: 'E_BUNDLE_MISSING_KEYS',
|
|
937
|
+
MISSING_RECEIPTS: 'E_BUNDLE_MISSING_RECEIPTS',
|
|
938
|
+
PATH_TRAVERSAL: 'E_BUNDLE_PATH_TRAVERSAL',
|
|
939
|
+
POLICY_HASH_MISMATCH: 'E_BUNDLE_POLICY_HASH_MISMATCH',
|
|
940
|
+
RECEIPT_INVALID: 'E_BUNDLE_RECEIPT_INVALID',
|
|
941
|
+
RECEIPTS_UNORDERED: 'E_BUNDLE_RECEIPTS_UNORDERED',
|
|
942
|
+
SIGNATURE_INVALID: 'E_BUNDLE_SIGNATURE_INVALID',
|
|
943
|
+
SIZE_EXCEEDED: 'E_BUNDLE_SIZE_EXCEEDED',
|
|
944
|
+
TIME_RANGE_INVALID: 'E_BUNDLE_TIME_RANGE_INVALID',
|
|
945
|
+
};
|
|
946
|
+
/**
|
|
947
|
+
* Dispute error codes
|
|
948
|
+
*/
|
|
949
|
+
exports.DISPUTE_ERRORS = {
|
|
950
|
+
DUPLICATE: 'E_DISPUTE_DUPLICATE',
|
|
951
|
+
EXPIRED: 'E_DISPUTE_EXPIRED',
|
|
952
|
+
INVALID_FORMAT: 'E_DISPUTE_INVALID_FORMAT',
|
|
953
|
+
INVALID_GROUNDS: 'E_DISPUTE_INVALID_GROUNDS',
|
|
954
|
+
INVALID_ID: 'E_DISPUTE_INVALID_ID',
|
|
955
|
+
INVALID_STATE: 'E_DISPUTE_INVALID_STATE',
|
|
956
|
+
INVALID_TARGET_TYPE: 'E_DISPUTE_INVALID_TARGET_TYPE',
|
|
957
|
+
INVALID_TRANSITION: 'E_DISPUTE_INVALID_TRANSITION',
|
|
958
|
+
INVALID_TYPE: 'E_DISPUTE_INVALID_TYPE',
|
|
959
|
+
MISSING_RESOLUTION: 'E_DISPUTE_MISSING_RESOLUTION',
|
|
960
|
+
NOT_YET_VALID: 'E_DISPUTE_NOT_YET_VALID',
|
|
961
|
+
OTHER_REQUIRES_DESCRIPTION: 'E_DISPUTE_OTHER_REQUIRES_DESCRIPTION',
|
|
962
|
+
RESOLUTION_NOT_ALLOWED: 'E_DISPUTE_RESOLUTION_NOT_ALLOWED',
|
|
963
|
+
TARGET_NOT_FOUND: 'E_DISPUTE_TARGET_NOT_FOUND',
|
|
964
|
+
};
|
|
965
|
+
//# sourceMappingURL=errors.generated.js.map
|