@peac/audit 0.10.9
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/README.md +133 -0
- package/dist/bundle.d.ts +97 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +209 -0
- package/dist/bundle.js.map +1 -0
- package/dist/dispute-bundle-types.d.ts +303 -0
- package/dist/dispute-bundle-types.d.ts.map +1 -0
- package/dist/dispute-bundle-types.js +31 -0
- package/dist/dispute-bundle-types.js.map +1 -0
- package/dist/dispute-bundle.d.ts +54 -0
- package/dist/dispute-bundle.d.ts.map +1 -0
- package/dist/dispute-bundle.js +838 -0
- package/dist/dispute-bundle.js.map +1 -0
- package/dist/entry.d.ts +76 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +237 -0
- package/dist/entry.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonl.d.ts +111 -0
- package/dist/jsonl.d.ts.map +1 -0
- package/dist/jsonl.js +182 -0
- package/dist/jsonl.js.map +1 -0
- package/dist/types.d.ts +191 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/verification-report.d.ts +48 -0
- package/dist/verification-report.d.ts.map +1 -0
- package/dist/verification-report.js +556 -0
- package/dist/verification-report.js.map +1 -0
- package/dist/workflow-dag.d.ts +112 -0
- package/dist/workflow-dag.d.ts.map +1 -0
- package/dist/workflow-dag.js +409 -0
- package/dist/workflow-dag.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispute Bundle Types (v0.9.30+)
|
|
3
|
+
*
|
|
4
|
+
* DisputeBundle is a ZIP archive containing receipts, keys, and policy
|
|
5
|
+
* for offline verification and audit. Distinct from CaseBundle (JSONL).
|
|
6
|
+
*
|
|
7
|
+
* Key design principles:
|
|
8
|
+
* 1. ZIP is transport container, not what we hash
|
|
9
|
+
* 2. Deterministic integrity at content layer (JCS-canonicalized manifest)
|
|
10
|
+
* 3. receipts.ndjson format for determinism + streaming
|
|
11
|
+
* 4. bundle.sig for authenticity
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Bundle format version.
|
|
15
|
+
* Normalized in v0.10.0 to peac-<artifact>/<major>.<minor> pattern.
|
|
16
|
+
* The `kind` field distinguishes bundle types (dispute, audit, etc.).
|
|
17
|
+
*/
|
|
18
|
+
export declare const BUNDLE_VERSION: "peac-bundle/0.1";
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use BUNDLE_VERSION instead. Will be removed in v1.0.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DISPUTE_BUNDLE_VERSION: "peac-bundle/0.1";
|
|
23
|
+
/**
|
|
24
|
+
* Verification report format version.
|
|
25
|
+
* Normalized in v0.10.0 to peac-<artifact>/<major>.<minor> pattern.
|
|
26
|
+
*/
|
|
27
|
+
export declare const VERIFICATION_REPORT_VERSION: "peac-verification-report/0.1";
|
|
28
|
+
/**
|
|
29
|
+
* Bundle kind - identifies the purpose of the bundle.
|
|
30
|
+
*/
|
|
31
|
+
export type BundleKind = 'dispute' | 'audit' | 'archive';
|
|
32
|
+
/**
|
|
33
|
+
* File entry in the bundle manifest.
|
|
34
|
+
* Each file has a SHA-256 hash for integrity verification.
|
|
35
|
+
*/
|
|
36
|
+
export interface ManifestFileEntry {
|
|
37
|
+
/** Relative path within the bundle (e.g., "receipts.ndjson", "keys/keys.json") */
|
|
38
|
+
path: string;
|
|
39
|
+
/** SHA-256 hash of file contents (hex-encoded, lowercase) */
|
|
40
|
+
sha256: string;
|
|
41
|
+
/** File size in bytes */
|
|
42
|
+
size: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Receipt entry in the manifest.
|
|
46
|
+
* Provides receipt metadata for ordering and lookup.
|
|
47
|
+
*/
|
|
48
|
+
export interface ManifestReceiptEntry {
|
|
49
|
+
/** Receipt ID (from claims.jti) */
|
|
50
|
+
receipt_id: string;
|
|
51
|
+
/** When the receipt was issued (ISO 8601) */
|
|
52
|
+
issued_at: string;
|
|
53
|
+
/** SHA-256 hash of the JWS bytes (for deduplication and ordering) */
|
|
54
|
+
receipt_hash: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Key entry in the manifest.
|
|
58
|
+
* Maps key IDs to their algorithms.
|
|
59
|
+
*/
|
|
60
|
+
export interface ManifestKeyEntry {
|
|
61
|
+
/** Key ID (kid from JWK) */
|
|
62
|
+
kid: string;
|
|
63
|
+
/** Key algorithm (e.g., "EdDSA") */
|
|
64
|
+
alg: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Bundle time range.
|
|
68
|
+
* All receipts must have issued_at within this range.
|
|
69
|
+
*/
|
|
70
|
+
export interface BundleTimeRange {
|
|
71
|
+
/** Earliest receipt issued_at (ISO 8601) */
|
|
72
|
+
start: string;
|
|
73
|
+
/** Latest receipt issued_at (ISO 8601) */
|
|
74
|
+
end: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Bundle reference - identifies what this bundle is for.
|
|
78
|
+
* Format: sha256:<hex> for hash-based refs, or ULID/UUID for ID refs.
|
|
79
|
+
*/
|
|
80
|
+
export interface BundleRef {
|
|
81
|
+
/** Reference type */
|
|
82
|
+
type: 'dispute' | 'receipt' | 'audit_case' | 'external';
|
|
83
|
+
/** Reference ID (ULID, UUID, or sha256:<hex> hash) */
|
|
84
|
+
id: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Bundle manifest (manifest.json).
|
|
88
|
+
*
|
|
89
|
+
* The manifest is the source of truth for bundle integrity.
|
|
90
|
+
* `content_hash` is sha256:<hex> of JCS(manifest without content_hash).
|
|
91
|
+
*/
|
|
92
|
+
export interface DisputeBundleManifest {
|
|
93
|
+
/** Bundle format version (peac-bundle/0.1) */
|
|
94
|
+
version: typeof BUNDLE_VERSION;
|
|
95
|
+
/** Bundle kind - what type of bundle this is */
|
|
96
|
+
kind: BundleKind;
|
|
97
|
+
/** Unique bundle identifier (ULID) */
|
|
98
|
+
bundle_id: string;
|
|
99
|
+
/** What this bundle references (replaces dispute_ref) */
|
|
100
|
+
refs: BundleRef[];
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Use refs instead. Will be removed in v1.0.
|
|
103
|
+
* Dispute reference this bundle is for (ULID)
|
|
104
|
+
*/
|
|
105
|
+
dispute_ref?: string;
|
|
106
|
+
/** Who created the bundle (URI) */
|
|
107
|
+
created_by: string;
|
|
108
|
+
/** When the bundle was created (ISO 8601) */
|
|
109
|
+
created_at: string;
|
|
110
|
+
/** Time range covered by receipts */
|
|
111
|
+
time_range: BundleTimeRange;
|
|
112
|
+
/** Receipt entries (sorted by issued_at, then receipt_id, then receipt_hash) */
|
|
113
|
+
receipts: ManifestReceiptEntry[];
|
|
114
|
+
/** Key entries (sorted by kid) */
|
|
115
|
+
keys: ManifestKeyEntry[];
|
|
116
|
+
/** All files in the bundle (sorted by path) */
|
|
117
|
+
files: ManifestFileEntry[];
|
|
118
|
+
/** sha256:<hex> hash of policy.yaml if included */
|
|
119
|
+
policy_hash?: string;
|
|
120
|
+
/** sha256:<hex> of JCS(manifest without content_hash) - deterministic bundle hash */
|
|
121
|
+
content_hash: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Options for creating a dispute bundle.
|
|
125
|
+
*/
|
|
126
|
+
export interface CreateDisputeBundleOptions {
|
|
127
|
+
/** Bundle kind (defaults to 'dispute') */
|
|
128
|
+
kind?: BundleKind;
|
|
129
|
+
/** Bundle references (what this bundle is for) */
|
|
130
|
+
refs?: BundleRef[];
|
|
131
|
+
/**
|
|
132
|
+
* @deprecated Use refs instead. Will be removed in v1.0.
|
|
133
|
+
* Dispute reference (ULID)
|
|
134
|
+
*/
|
|
135
|
+
dispute_ref?: string;
|
|
136
|
+
/** Who is creating the bundle (URI) */
|
|
137
|
+
created_by: string;
|
|
138
|
+
/** Receipt JWS strings to include */
|
|
139
|
+
receipts: string[];
|
|
140
|
+
/** JWKS containing public keys for verification */
|
|
141
|
+
keys: JsonWebKeySet;
|
|
142
|
+
/** Optional policy YAML content */
|
|
143
|
+
policy?: string;
|
|
144
|
+
/** Optional bundle ID (generated if not provided) */
|
|
145
|
+
bundle_id?: string;
|
|
146
|
+
/** Optional created_at timestamp (for deterministic fixtures) */
|
|
147
|
+
created_at?: string;
|
|
148
|
+
/** Optional signing key for bundle.sig (Ed25519 private key, 32 bytes) */
|
|
149
|
+
signing_key?: Uint8Array;
|
|
150
|
+
/** Key ID for bundle.sig (required if signing_key is provided) */
|
|
151
|
+
signing_kid?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* JSON Web Key Set (JWKS) structure.
|
|
155
|
+
*/
|
|
156
|
+
export interface JsonWebKeySet {
|
|
157
|
+
keys: JsonWebKey[];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* JSON Web Key (JWK) with required fields for PEAC.
|
|
161
|
+
*/
|
|
162
|
+
export interface JsonWebKey {
|
|
163
|
+
/** Key type (e.g., "OKP" for Ed25519) */
|
|
164
|
+
kty: string;
|
|
165
|
+
/** Key ID */
|
|
166
|
+
kid: string;
|
|
167
|
+
/** Algorithm (e.g., "EdDSA") */
|
|
168
|
+
alg?: string;
|
|
169
|
+
/** Curve (e.g., "Ed25519") */
|
|
170
|
+
crv?: string;
|
|
171
|
+
/** Public key (base64url) */
|
|
172
|
+
x?: string;
|
|
173
|
+
/** Key use (e.g., "sig") */
|
|
174
|
+
use?: string;
|
|
175
|
+
/** Additional properties */
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Result of reading a dispute bundle.
|
|
180
|
+
*/
|
|
181
|
+
export interface DisputeBundleContents {
|
|
182
|
+
/** Parsed manifest */
|
|
183
|
+
manifest: DisputeBundleManifest;
|
|
184
|
+
/** Receipt JWS strings by receipt_id */
|
|
185
|
+
receipts: Map<string, string>;
|
|
186
|
+
/** JWKS containing all keys */
|
|
187
|
+
keys: JsonWebKeySet;
|
|
188
|
+
/** Policy content if present */
|
|
189
|
+
policy?: string;
|
|
190
|
+
/** bundle.sig JWS if present */
|
|
191
|
+
bundle_sig?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Receipt verification result.
|
|
195
|
+
*/
|
|
196
|
+
export interface ReceiptVerificationResult {
|
|
197
|
+
/** Receipt ID */
|
|
198
|
+
receipt_id: string;
|
|
199
|
+
/** Whether signature is valid */
|
|
200
|
+
signature_valid: boolean;
|
|
201
|
+
/** Whether claims are valid */
|
|
202
|
+
claims_valid: boolean;
|
|
203
|
+
/** Key ID used to sign */
|
|
204
|
+
key_id?: string;
|
|
205
|
+
/** Error codes if invalid */
|
|
206
|
+
errors: string[];
|
|
207
|
+
/** Parsed claims if valid */
|
|
208
|
+
claims?: Record<string, unknown>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Key usage tracking.
|
|
212
|
+
*/
|
|
213
|
+
export interface KeyUsageEntry {
|
|
214
|
+
/** Key ID */
|
|
215
|
+
kid: string;
|
|
216
|
+
/** Number of receipts signed with this key */
|
|
217
|
+
receipts_signed: number;
|
|
218
|
+
/** Receipt IDs signed with this key */
|
|
219
|
+
receipt_ids: string[];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Auditor-friendly summary.
|
|
223
|
+
*/
|
|
224
|
+
export interface AuditorSummary {
|
|
225
|
+
/** One-line headline (e.g., "17/20 receipts valid") */
|
|
226
|
+
headline: string;
|
|
227
|
+
/** List of issues found */
|
|
228
|
+
issues: string[];
|
|
229
|
+
/** Recommendation based on findings */
|
|
230
|
+
recommendation: 'valid' | 'invalid' | 'needs_review';
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Bundle signature verification result.
|
|
234
|
+
*/
|
|
235
|
+
export interface BundleSignatureResult {
|
|
236
|
+
/** Whether bundle.sig was present */
|
|
237
|
+
present: boolean;
|
|
238
|
+
/** Whether the signature is valid (only set if present) */
|
|
239
|
+
valid?: boolean;
|
|
240
|
+
/** Key ID used to sign the bundle (only set if present) */
|
|
241
|
+
key_id?: string;
|
|
242
|
+
/** Error if signature verification failed */
|
|
243
|
+
error?: string;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Deterministic verification report.
|
|
247
|
+
*
|
|
248
|
+
* This is the canonical output format for bundle verification.
|
|
249
|
+
* `report_hash` is SHA-256 of JCS(report without report_hash).
|
|
250
|
+
*/
|
|
251
|
+
export interface VerificationReport {
|
|
252
|
+
/** Report format version */
|
|
253
|
+
version: typeof VERIFICATION_REPORT_VERSION;
|
|
254
|
+
/** Bundle content hash (from manifest) */
|
|
255
|
+
bundle_content_hash: string;
|
|
256
|
+
/** Bundle signature verification result */
|
|
257
|
+
bundle_signature: BundleSignatureResult;
|
|
258
|
+
/** Summary counts */
|
|
259
|
+
summary: {
|
|
260
|
+
total_receipts: number;
|
|
261
|
+
valid: number;
|
|
262
|
+
invalid: number;
|
|
263
|
+
};
|
|
264
|
+
/** Individual receipt results (sorted by receipt_id) */
|
|
265
|
+
receipts: ReceiptVerificationResult[];
|
|
266
|
+
/** Keys used in verification (sorted by kid) */
|
|
267
|
+
keys_used: KeyUsageEntry[];
|
|
268
|
+
/** Human-friendly summary */
|
|
269
|
+
auditor_summary: AuditorSummary;
|
|
270
|
+
/** SHA-256 of JCS(report without report_hash) - deterministic report hash */
|
|
271
|
+
report_hash: string;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Options for bundle verification.
|
|
275
|
+
*/
|
|
276
|
+
export interface VerifyBundleOptions {
|
|
277
|
+
/** Use only keys from the bundle (no external key fetching) */
|
|
278
|
+
offline: boolean;
|
|
279
|
+
/** Custom time for validation (defaults to now) */
|
|
280
|
+
now?: Date;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Bundle read/write error.
|
|
284
|
+
*/
|
|
285
|
+
export interface BundleError {
|
|
286
|
+
/** Error code (E_BUNDLE_*) */
|
|
287
|
+
code: string;
|
|
288
|
+
/** Human-readable message */
|
|
289
|
+
message: string;
|
|
290
|
+
/** Additional context */
|
|
291
|
+
details?: Record<string, unknown>;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Result type for bundle operations.
|
|
295
|
+
*/
|
|
296
|
+
export type BundleResult<T> = {
|
|
297
|
+
ok: true;
|
|
298
|
+
value: T;
|
|
299
|
+
} | {
|
|
300
|
+
ok: false;
|
|
301
|
+
error: BundleError;
|
|
302
|
+
};
|
|
303
|
+
//# sourceMappingURL=dispute-bundle-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispute-bundle-types.d.ts","sourceRoot":"","sources":["../src/dispute-bundle-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAG,iBAA0B,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,sBAAsB,mBAAiB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAG,8BAAuC,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,kFAAkF;IAClF,IAAI,EAAE,MAAM,CAAC;IAEb,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IAEf,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IAEnB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAElB,qEAAqE;IACrE,YAAY,EAAE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IAE5B,2CAA2C;IAC3C,gBAAgB,EAAE,qBAAqB,CAAC;IAExC,qBAAqB;IACrB,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,wDAAwD;IACxD,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IAEtC,gDAAgD;IAChD,SAAS,EAAE,aAAa,EAAE,CAAC;IAE3B,6BAA6B;IAC7B,eAAe,EAAE,cAAc,CAAC;IAEhC,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;IAEjB,mDAAmD;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Dispute Bundle Types (v0.9.30+)
|
|
4
|
+
*
|
|
5
|
+
* DisputeBundle is a ZIP archive containing receipts, keys, and policy
|
|
6
|
+
* for offline verification and audit. Distinct from CaseBundle (JSONL).
|
|
7
|
+
*
|
|
8
|
+
* Key design principles:
|
|
9
|
+
* 1. ZIP is transport container, not what we hash
|
|
10
|
+
* 2. Deterministic integrity at content layer (JCS-canonicalized manifest)
|
|
11
|
+
* 3. receipts.ndjson format for determinism + streaming
|
|
12
|
+
* 4. bundle.sig for authenticity
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.VERIFICATION_REPORT_VERSION = exports.DISPUTE_BUNDLE_VERSION = exports.BUNDLE_VERSION = void 0;
|
|
16
|
+
/**
|
|
17
|
+
* Bundle format version.
|
|
18
|
+
* Normalized in v0.10.0 to peac-<artifact>/<major>.<minor> pattern.
|
|
19
|
+
* The `kind` field distinguishes bundle types (dispute, audit, etc.).
|
|
20
|
+
*/
|
|
21
|
+
exports.BUNDLE_VERSION = 'peac-bundle/0.1';
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use BUNDLE_VERSION instead. Will be removed in v1.0.
|
|
24
|
+
*/
|
|
25
|
+
exports.DISPUTE_BUNDLE_VERSION = exports.BUNDLE_VERSION;
|
|
26
|
+
/**
|
|
27
|
+
* Verification report format version.
|
|
28
|
+
* Normalized in v0.10.0 to peac-<artifact>/<major>.<minor> pattern.
|
|
29
|
+
*/
|
|
30
|
+
exports.VERIFICATION_REPORT_VERSION = 'peac-verification-report/0.1';
|
|
31
|
+
//# sourceMappingURL=dispute-bundle-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispute-bundle-types.js","sourceRoot":"","sources":["../src/dispute-bundle-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH;;;;GAIG;AACU,QAAA,cAAc,GAAG,iBAA0B,CAAC;AAEzD;;GAEG;AACU,QAAA,sBAAsB,GAAG,sBAAc,CAAC;AAErD;;;GAGG;AACU,QAAA,2BAA2B,GAAG,8BAAuC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispute Bundle (v0.9.30+)
|
|
3
|
+
*
|
|
4
|
+
* DisputeBundle is a ZIP archive containing receipts, keys, and policy
|
|
5
|
+
* for offline verification and audit.
|
|
6
|
+
*
|
|
7
|
+
* Key design principles:
|
|
8
|
+
* 1. ZIP is transport container, not what we hash - deterministic integrity at content layer
|
|
9
|
+
* 2. bundle.sig provides authenticity (JWS over content_hash)
|
|
10
|
+
* 3. receipts.ndjson format for determinism + streaming
|
|
11
|
+
* 4. Real Ed25519 signature verification
|
|
12
|
+
*/
|
|
13
|
+
import type { BundleResult, CreateDisputeBundleOptions, DisputeBundleContents, DisputeBundleManifest } from './dispute-bundle-types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Re-export BUNDLE_ERRORS as BundleErrorCodes for backwards compatibility
|
|
16
|
+
* @deprecated Use BUNDLE_ERRORS from @peac/kernel directly
|
|
17
|
+
*/
|
|
18
|
+
export declare const BundleErrorCodes: {
|
|
19
|
+
readonly DUPLICATE_RECEIPT: "E_BUNDLE_DUPLICATE_RECEIPT";
|
|
20
|
+
readonly HASH_MISMATCH: "E_BUNDLE_HASH_MISMATCH";
|
|
21
|
+
readonly INVALID_FORMAT: "E_BUNDLE_INVALID_FORMAT";
|
|
22
|
+
readonly KEY_MISSING: "E_BUNDLE_KEY_MISSING";
|
|
23
|
+
readonly MANIFEST_INVALID: "E_BUNDLE_MANIFEST_INVALID";
|
|
24
|
+
readonly MANIFEST_MISSING: "E_BUNDLE_MANIFEST_MISSING";
|
|
25
|
+
readonly MISSING_KEYS: "E_BUNDLE_MISSING_KEYS";
|
|
26
|
+
readonly MISSING_RECEIPTS: "E_BUNDLE_MISSING_RECEIPTS";
|
|
27
|
+
readonly PATH_TRAVERSAL: "E_BUNDLE_PATH_TRAVERSAL";
|
|
28
|
+
readonly POLICY_HASH_MISMATCH: "E_BUNDLE_POLICY_HASH_MISMATCH";
|
|
29
|
+
readonly RECEIPTS_UNORDERED: "E_BUNDLE_RECEIPTS_UNORDERED";
|
|
30
|
+
readonly RECEIPT_INVALID: "E_BUNDLE_RECEIPT_INVALID";
|
|
31
|
+
readonly SIGNATURE_INVALID: "E_BUNDLE_SIGNATURE_INVALID";
|
|
32
|
+
readonly SIZE_EXCEEDED: "E_BUNDLE_SIZE_EXCEEDED";
|
|
33
|
+
readonly TIME_RANGE_INVALID: "E_BUNDLE_TIME_RANGE_INVALID";
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Create a dispute bundle from receipts, keys, and optional policy.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createDisputeBundle(options: CreateDisputeBundleOptions): Promise<BundleResult<Buffer>>;
|
|
39
|
+
/**
|
|
40
|
+
* Read and parse a dispute bundle from a ZIP buffer.
|
|
41
|
+
*/
|
|
42
|
+
export declare function readDisputeBundle(zipBuffer: Buffer): Promise<BundleResult<DisputeBundleContents>>;
|
|
43
|
+
/**
|
|
44
|
+
* Verify bundle integrity without verifying receipt signatures.
|
|
45
|
+
*/
|
|
46
|
+
export declare function verifyBundleIntegrity(zipBuffer: Buffer): Promise<BundleResult<{
|
|
47
|
+
manifest: DisputeBundleManifest;
|
|
48
|
+
}>>;
|
|
49
|
+
/**
|
|
50
|
+
* Get the content hash of a bundle without fully parsing it.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getBundleContentHash(zipBuffer: Buffer): Promise<BundleResult<string>>;
|
|
53
|
+
export { BundleErrorCodes as BUNDLE_ERROR_CODES };
|
|
54
|
+
//# sourceMappingURL=dispute-bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispute-bundle.d.ts","sourceRoot":"","sources":["../src/dispute-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,KAAK,EAEV,YAAY,EAEZ,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EAMtB,MAAM,2BAA2B,CAAC;AA2BnC;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;CAAgB,CAAC;AAwL9C;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CA4Q/B;AA6BD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAqL9C;AAwND;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,YAAY,CAAC;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,CAAC,CAAC,CAM5D;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAyE3F;AAGD,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAC"}
|