@clawbureau/clawverify-core 0.1.0
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 +21 -0
- package/README.md +40 -0
- package/dist/crypto.d.ts +27 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +124 -0
- package/dist/crypto.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/jcs.d.ts +13 -0
- package/dist/jcs.d.ts.map +1 -0
- package/dist/jcs.js +43 -0
- package/dist/jcs.js.map +1 -0
- package/dist/model-identity.d.ts +46 -0
- package/dist/model-identity.d.ts.map +1 -0
- package/dist/model-identity.js +233 -0
- package/dist/model-identity.js.map +1 -0
- package/dist/schema-registry.d.ts +99 -0
- package/dist/schema-registry.d.ts.map +1 -0
- package/dist/schema-registry.js +259 -0
- package/dist/schema-registry.js.map +1 -0
- package/dist/schema-validation.d.ts +35 -0
- package/dist/schema-validation.d.ts.map +1 -0
- package/dist/schema-validation.js +156 -0
- package/dist/schema-validation.js.map +1 -0
- package/dist/schema-validators.generated.d.ts +158 -0
- package/dist/schema-validators.generated.d.ts.map +1 -0
- package/dist/schema-validators.generated.js +19186 -0
- package/dist/schema-validators.generated.js.map +1 -0
- package/dist/types.d.ts +910 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +33 -0
- package/dist/types.js.map +1 -0
- package/dist/verify-audit-result-attestation.d.ts +32 -0
- package/dist/verify-audit-result-attestation.d.ts.map +1 -0
- package/dist/verify-audit-result-attestation.js +396 -0
- package/dist/verify-audit-result-attestation.js.map +1 -0
- package/dist/verify-derivation-attestation.d.ts +30 -0
- package/dist/verify-derivation-attestation.d.ts.map +1 -0
- package/dist/verify-derivation-attestation.js +371 -0
- package/dist/verify-derivation-attestation.js.map +1 -0
- package/dist/verify-execution-attestation.d.ts +32 -0
- package/dist/verify-execution-attestation.d.ts.map +1 -0
- package/dist/verify-execution-attestation.js +578 -0
- package/dist/verify-execution-attestation.js.map +1 -0
- package/dist/verify-export-bundle.d.ts +14 -0
- package/dist/verify-export-bundle.d.ts.map +1 -0
- package/dist/verify-export-bundle.js +307 -0
- package/dist/verify-export-bundle.js.map +1 -0
- package/dist/verify-log-inclusion-proof.d.ts +16 -0
- package/dist/verify-log-inclusion-proof.d.ts.map +1 -0
- package/dist/verify-log-inclusion-proof.js +216 -0
- package/dist/verify-log-inclusion-proof.js.map +1 -0
- package/dist/verify-proof-bundle.d.ts +48 -0
- package/dist/verify-proof-bundle.d.ts.map +1 -0
- package/dist/verify-proof-bundle.js +1708 -0
- package/dist/verify-proof-bundle.js.map +1 -0
- package/dist/verify-receipt.d.ts +30 -0
- package/dist/verify-receipt.d.ts.map +1 -0
- package/dist/verify-receipt.js +408 -0
- package/dist/verify-receipt.js.map +1 -0
- package/dist/verify-web-receipt.d.ts +21 -0
- package/dist/verify-web-receipt.d.ts.map +1 -0
- package/dist/verify-web-receipt.js +341 -0
- package/dist/verify-web-receipt.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derivation Attestation Verification
|
|
3
|
+
* CVF-US-017: Verify derivation attestations (Prepare analogue)
|
|
4
|
+
*/
|
|
5
|
+
import { isAllowedVersion, isAllowedType, isAllowedAlgorithm, isAllowedHashAlgorithm, isValidDidFormat, isValidBase64Url, isValidIsoDate, } from './schema-registry.js';
|
|
6
|
+
import { computeHash, base64UrlDecode, extractPublicKeyFromDidKey, verifySignature, } from './crypto.js';
|
|
7
|
+
import { validateDerivationAttestationEnvelopeV1 } from './schema-validation.js';
|
|
8
|
+
import { verifyLogInclusionProof } from './verify-log-inclusion-proof.js';
|
|
9
|
+
function isRecord(x) {
|
|
10
|
+
return typeof x === 'object' && x !== null && !Array.isArray(x);
|
|
11
|
+
}
|
|
12
|
+
function normalizeModelIdentityTier(tier) {
|
|
13
|
+
if (tier === 'closed_opaque')
|
|
14
|
+
return 'closed_opaque';
|
|
15
|
+
if (tier === 'closed_provider_manifest')
|
|
16
|
+
return 'closed_provider_manifest';
|
|
17
|
+
if (tier === 'openweights_hashable')
|
|
18
|
+
return 'openweights_hashable';
|
|
19
|
+
if (tier === 'tee_measured')
|
|
20
|
+
return 'tee_measured';
|
|
21
|
+
return 'unknown';
|
|
22
|
+
}
|
|
23
|
+
function extractModelSummary(identity) {
|
|
24
|
+
if (!isRecord(identity))
|
|
25
|
+
return {};
|
|
26
|
+
const tier = normalizeModelIdentityTier(identity.tier);
|
|
27
|
+
const model = isRecord(identity.model) ? identity.model : null;
|
|
28
|
+
const provider = model && typeof model.provider === 'string' ? model.provider : undefined;
|
|
29
|
+
const name = model && typeof model.name === 'string' ? model.name : undefined;
|
|
30
|
+
return { provider, name, tier };
|
|
31
|
+
}
|
|
32
|
+
function validateEnvelopeStructure(envelope) {
|
|
33
|
+
if (typeof envelope !== 'object' || envelope === null)
|
|
34
|
+
return false;
|
|
35
|
+
const e = envelope;
|
|
36
|
+
return ('envelope_version' in e &&
|
|
37
|
+
'envelope_type' in e &&
|
|
38
|
+
'payload' in e &&
|
|
39
|
+
'payload_hash_b64u' in e &&
|
|
40
|
+
'hash_algorithm' in e &&
|
|
41
|
+
'signature_b64u' in e &&
|
|
42
|
+
'algorithm' in e &&
|
|
43
|
+
'signer_did' in e &&
|
|
44
|
+
'issued_at' in e);
|
|
45
|
+
}
|
|
46
|
+
export async function verifyDerivationAttestation(envelope, options = {}) {
|
|
47
|
+
const now = new Date().toISOString();
|
|
48
|
+
// 1) Envelope structure
|
|
49
|
+
if (!validateEnvelopeStructure(envelope)) {
|
|
50
|
+
return {
|
|
51
|
+
result: {
|
|
52
|
+
status: 'INVALID',
|
|
53
|
+
reason: 'Malformed envelope: missing required fields',
|
|
54
|
+
verified_at: now,
|
|
55
|
+
},
|
|
56
|
+
error: {
|
|
57
|
+
code: 'MALFORMED_ENVELOPE',
|
|
58
|
+
message: 'Envelope is missing required fields or has invalid structure',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// 2) Allowlisted version
|
|
63
|
+
if (!isAllowedVersion(envelope.envelope_version)) {
|
|
64
|
+
return {
|
|
65
|
+
result: {
|
|
66
|
+
status: 'INVALID',
|
|
67
|
+
reason: `Unknown envelope version: ${envelope.envelope_version}`,
|
|
68
|
+
verified_at: now,
|
|
69
|
+
},
|
|
70
|
+
error: {
|
|
71
|
+
code: 'UNKNOWN_ENVELOPE_VERSION',
|
|
72
|
+
message: `Envelope version "${envelope.envelope_version}" is not in the allowlist`,
|
|
73
|
+
field: 'envelope_version',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// 3) Allowlisted type
|
|
78
|
+
if (!isAllowedType(envelope.envelope_type)) {
|
|
79
|
+
return {
|
|
80
|
+
result: {
|
|
81
|
+
status: 'INVALID',
|
|
82
|
+
reason: `Unknown envelope type: ${envelope.envelope_type}`,
|
|
83
|
+
verified_at: now,
|
|
84
|
+
},
|
|
85
|
+
error: {
|
|
86
|
+
code: 'UNKNOWN_ENVELOPE_TYPE',
|
|
87
|
+
message: `Envelope type "${envelope.envelope_type}" is not in the allowlist`,
|
|
88
|
+
field: 'envelope_type',
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// 4) Correct endpoint type
|
|
93
|
+
if (envelope.envelope_type !== 'derivation_attestation') {
|
|
94
|
+
return {
|
|
95
|
+
result: {
|
|
96
|
+
status: 'INVALID',
|
|
97
|
+
reason: `Expected derivation_attestation envelope, got: ${envelope.envelope_type}`,
|
|
98
|
+
verified_at: now,
|
|
99
|
+
},
|
|
100
|
+
error: {
|
|
101
|
+
code: 'UNKNOWN_ENVELOPE_TYPE',
|
|
102
|
+
message: 'This endpoint only accepts derivation_attestation envelopes',
|
|
103
|
+
field: 'envelope_type',
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// 5) Allowlisted algorithms
|
|
108
|
+
if (!isAllowedAlgorithm(envelope.algorithm)) {
|
|
109
|
+
return {
|
|
110
|
+
result: {
|
|
111
|
+
status: 'INVALID',
|
|
112
|
+
reason: `Unknown signature algorithm: ${envelope.algorithm}`,
|
|
113
|
+
verified_at: now,
|
|
114
|
+
},
|
|
115
|
+
error: {
|
|
116
|
+
code: 'UNKNOWN_ALGORITHM',
|
|
117
|
+
message: `Signature algorithm "${envelope.algorithm}" is not in the allowlist`,
|
|
118
|
+
field: 'algorithm',
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (!isAllowedHashAlgorithm(envelope.hash_algorithm)) {
|
|
123
|
+
return {
|
|
124
|
+
result: {
|
|
125
|
+
status: 'INVALID',
|
|
126
|
+
reason: `Unknown hash algorithm: ${envelope.hash_algorithm}`,
|
|
127
|
+
verified_at: now,
|
|
128
|
+
},
|
|
129
|
+
error: {
|
|
130
|
+
code: 'UNKNOWN_HASH_ALGORITHM',
|
|
131
|
+
message: `Hash algorithm "${envelope.hash_algorithm}" is not in the allowlist`,
|
|
132
|
+
field: 'hash_algorithm',
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// 6) Strict JSON schema validation (Ajv standalone)
|
|
137
|
+
const schemaResult = validateDerivationAttestationEnvelopeV1(envelope);
|
|
138
|
+
if (!schemaResult.valid) {
|
|
139
|
+
return {
|
|
140
|
+
result: {
|
|
141
|
+
status: 'INVALID',
|
|
142
|
+
reason: schemaResult.message,
|
|
143
|
+
envelope_type: envelope.envelope_type,
|
|
144
|
+
signer_did: envelope.signer_did,
|
|
145
|
+
verified_at: now,
|
|
146
|
+
},
|
|
147
|
+
error: {
|
|
148
|
+
code: 'SCHEMA_VALIDATION_FAILED',
|
|
149
|
+
message: schemaResult.message,
|
|
150
|
+
field: schemaResult.field,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
// 7) DID format
|
|
155
|
+
if (!isValidDidFormat(envelope.signer_did)) {
|
|
156
|
+
return {
|
|
157
|
+
result: {
|
|
158
|
+
status: 'INVALID',
|
|
159
|
+
reason: `Invalid DID format: ${envelope.signer_did}`,
|
|
160
|
+
verified_at: now,
|
|
161
|
+
},
|
|
162
|
+
error: {
|
|
163
|
+
code: 'INVALID_DID_FORMAT',
|
|
164
|
+
message: 'Signer DID does not match expected format (did:key:... or did:web:...)',
|
|
165
|
+
field: 'signer_did',
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// 8) Fail-closed allowlist
|
|
170
|
+
if (!options.allowlistedSignerDids || options.allowlistedSignerDids.length === 0) {
|
|
171
|
+
return {
|
|
172
|
+
result: {
|
|
173
|
+
status: 'INVALID',
|
|
174
|
+
reason: 'Derivation attestation signer allowlist not configured',
|
|
175
|
+
envelope_type: envelope.envelope_type,
|
|
176
|
+
signer_did: envelope.signer_did,
|
|
177
|
+
verified_at: now,
|
|
178
|
+
},
|
|
179
|
+
error: {
|
|
180
|
+
code: 'DEPENDENCY_NOT_CONFIGURED',
|
|
181
|
+
message: 'Derivation attestation signer allowlist is not configured. Set DERIVATION_ATTESTATION_SIGNER_DIDS to enable verification.',
|
|
182
|
+
field: 'env.DERIVATION_ATTESTATION_SIGNER_DIDS',
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (!options.allowlistedSignerDids.includes(envelope.signer_did)) {
|
|
187
|
+
return {
|
|
188
|
+
result: {
|
|
189
|
+
status: 'INVALID',
|
|
190
|
+
reason: 'Attestation signer DID is not allowlisted',
|
|
191
|
+
envelope_type: envelope.envelope_type,
|
|
192
|
+
signer_did: envelope.signer_did,
|
|
193
|
+
verified_at: now,
|
|
194
|
+
},
|
|
195
|
+
error: {
|
|
196
|
+
code: 'CLAIM_NOT_FOUND',
|
|
197
|
+
message: `Signer DID '${envelope.signer_did}' is not in the allowlisted derivation attester list`,
|
|
198
|
+
field: 'signer_did',
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
// 9) issued_at
|
|
203
|
+
if (!isValidIsoDate(envelope.issued_at)) {
|
|
204
|
+
return {
|
|
205
|
+
result: {
|
|
206
|
+
status: 'INVALID',
|
|
207
|
+
reason: 'Invalid issued_at date format',
|
|
208
|
+
verified_at: now,
|
|
209
|
+
},
|
|
210
|
+
error: {
|
|
211
|
+
code: 'MALFORMED_ENVELOPE',
|
|
212
|
+
message: 'issued_at must be a valid ISO 8601 date string',
|
|
213
|
+
field: 'issued_at',
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
// 10) base64url fields
|
|
218
|
+
if (!isValidBase64Url(envelope.payload_hash_b64u)) {
|
|
219
|
+
return {
|
|
220
|
+
result: {
|
|
221
|
+
status: 'INVALID',
|
|
222
|
+
reason: 'Invalid payload_hash_b64u format',
|
|
223
|
+
verified_at: now,
|
|
224
|
+
},
|
|
225
|
+
error: {
|
|
226
|
+
code: 'MALFORMED_ENVELOPE',
|
|
227
|
+
message: 'payload_hash_b64u must be a valid base64url string',
|
|
228
|
+
field: 'payload_hash_b64u',
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (!isValidBase64Url(envelope.signature_b64u)) {
|
|
233
|
+
return {
|
|
234
|
+
result: {
|
|
235
|
+
status: 'INVALID',
|
|
236
|
+
reason: 'Invalid signature_b64u format',
|
|
237
|
+
verified_at: now,
|
|
238
|
+
},
|
|
239
|
+
error: {
|
|
240
|
+
code: 'MALFORMED_ENVELOPE',
|
|
241
|
+
message: 'signature_b64u must be a valid base64url string',
|
|
242
|
+
field: 'signature_b64u',
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
// 11) Hash recompute
|
|
247
|
+
try {
|
|
248
|
+
const computedHash = await computeHash(envelope.payload, envelope.hash_algorithm);
|
|
249
|
+
if (computedHash !== envelope.payload_hash_b64u) {
|
|
250
|
+
return {
|
|
251
|
+
result: {
|
|
252
|
+
status: 'INVALID',
|
|
253
|
+
reason: 'Payload hash mismatch: envelope may have been tampered with',
|
|
254
|
+
verified_at: now,
|
|
255
|
+
},
|
|
256
|
+
error: {
|
|
257
|
+
code: 'HASH_MISMATCH',
|
|
258
|
+
message: 'Computed payload hash does not match envelope hash',
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
catch (err) {
|
|
264
|
+
return {
|
|
265
|
+
result: {
|
|
266
|
+
status: 'INVALID',
|
|
267
|
+
reason: `Hash computation failed: ${err instanceof Error ? err.message : 'unknown error'}`,
|
|
268
|
+
verified_at: now,
|
|
269
|
+
},
|
|
270
|
+
error: {
|
|
271
|
+
code: 'HASH_MISMATCH',
|
|
272
|
+
message: 'Failed to compute payload hash',
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
// 12) Key extraction (did:key only)
|
|
277
|
+
const publicKeyBytes = extractPublicKeyFromDidKey(envelope.signer_did);
|
|
278
|
+
if (!publicKeyBytes) {
|
|
279
|
+
return {
|
|
280
|
+
result: {
|
|
281
|
+
status: 'INVALID',
|
|
282
|
+
reason: 'Could not extract public key from signer DID',
|
|
283
|
+
verified_at: now,
|
|
284
|
+
},
|
|
285
|
+
error: {
|
|
286
|
+
code: 'INVALID_DID_FORMAT',
|
|
287
|
+
message: 'Unable to extract Ed25519 public key from did:key. Ensure the DID uses the Ed25519 multicodec prefix.',
|
|
288
|
+
field: 'signer_did',
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
// 13) Signature verify
|
|
293
|
+
try {
|
|
294
|
+
const signatureBytes = base64UrlDecode(envelope.signature_b64u);
|
|
295
|
+
const messageBytes = new TextEncoder().encode(envelope.payload_hash_b64u);
|
|
296
|
+
const ok = await verifySignature(envelope.algorithm, publicKeyBytes, signatureBytes, messageBytes);
|
|
297
|
+
if (!ok) {
|
|
298
|
+
return {
|
|
299
|
+
result: {
|
|
300
|
+
status: 'INVALID',
|
|
301
|
+
reason: 'Signature verification failed',
|
|
302
|
+
verified_at: now,
|
|
303
|
+
},
|
|
304
|
+
error: {
|
|
305
|
+
code: 'SIGNATURE_INVALID',
|
|
306
|
+
message: 'The Ed25519 signature does not match the payload hash',
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch (err) {
|
|
312
|
+
return {
|
|
313
|
+
result: {
|
|
314
|
+
status: 'INVALID',
|
|
315
|
+
reason: `Signature verification error: ${err instanceof Error ? err.message : 'unknown error'}`,
|
|
316
|
+
verified_at: now,
|
|
317
|
+
},
|
|
318
|
+
error: {
|
|
319
|
+
code: 'SIGNATURE_INVALID',
|
|
320
|
+
message: 'Failed to verify signature',
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
const payloadRec = envelope.payload;
|
|
325
|
+
// 14) Optional clawlogs inclusion proof validation (fail-closed if supplied)
|
|
326
|
+
let inclusionProofValidated;
|
|
327
|
+
if (isRecord(payloadRec.clawlogs) && payloadRec.clawlogs.inclusion_proof !== undefined) {
|
|
328
|
+
const proofVerification = await verifyLogInclusionProof(payloadRec.clawlogs.inclusion_proof);
|
|
329
|
+
if (!proofVerification.valid) {
|
|
330
|
+
return {
|
|
331
|
+
result: {
|
|
332
|
+
status: 'INVALID',
|
|
333
|
+
reason: `Invalid clawlogs inclusion proof: ${proofVerification.reason ?? 'verification failed'}`,
|
|
334
|
+
envelope_type: envelope.envelope_type,
|
|
335
|
+
signer_did: envelope.signer_did,
|
|
336
|
+
verified_at: now,
|
|
337
|
+
},
|
|
338
|
+
error: proofVerification.error ??
|
|
339
|
+
{
|
|
340
|
+
code: 'INCLUSION_PROOF_INVALID',
|
|
341
|
+
message: 'Invalid clawlogs inclusion proof',
|
|
342
|
+
field: 'payload.clawlogs.inclusion_proof',
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
inclusionProofValidated = true;
|
|
347
|
+
}
|
|
348
|
+
// 15) Summary extraction
|
|
349
|
+
const derivationId = typeof payloadRec.derivation_id === 'string' ? payloadRec.derivation_id : undefined;
|
|
350
|
+
let transformKind;
|
|
351
|
+
if (isRecord(payloadRec.transform) && typeof payloadRec.transform.kind === 'string') {
|
|
352
|
+
transformKind = payloadRec.transform.kind;
|
|
353
|
+
}
|
|
354
|
+
const inputSummary = extractModelSummary(payloadRec.input_model);
|
|
355
|
+
const outputSummary = extractModelSummary(payloadRec.output_model);
|
|
356
|
+
return {
|
|
357
|
+
result: {
|
|
358
|
+
status: 'VALID',
|
|
359
|
+
reason: 'Derivation attestation verified successfully',
|
|
360
|
+
envelope_type: envelope.envelope_type,
|
|
361
|
+
signer_did: envelope.signer_did,
|
|
362
|
+
verified_at: now,
|
|
363
|
+
},
|
|
364
|
+
derivation_id: derivationId,
|
|
365
|
+
transform_kind: transformKind,
|
|
366
|
+
input_model: inputSummary,
|
|
367
|
+
output_model: outputSummary,
|
|
368
|
+
clawlogs_inclusion_proof_validated: inclusionProofValidated,
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=verify-derivation-attestation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-derivation-attestation.js","sourceRoot":"","sources":["../src/verify-derivation-attestation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,uCAAuC,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAU1E,SAA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E,GAAG;SACjB;QACD,aAAa,EAAE,YAAY;QAC3B,cAAc,EAAE,aAAa;QAC7B,WAAW,EAAE,YAAY;QACzB,YAAY,EAAE,aAAa;QAC3B,kCAAkC,EAAE,uBAAuB;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Attestation Verification
|
|
3
|
+
* CEA-US-010: Verify sandbox execution attestations
|
|
4
|
+
*/
|
|
5
|
+
import type { ExecutionAttestationPayload, VerificationResult, VerificationError } from './types.js';
|
|
6
|
+
export interface ExecutionAttestationVerifierOptions {
|
|
7
|
+
/** Allowlisted execution attestation signer DIDs (did:key:...). */
|
|
8
|
+
allowlistedSignerDids?: readonly string[];
|
|
9
|
+
/** Allowlisted TEE root IDs for tee_execution attestations. */
|
|
10
|
+
teeRootAllowlist?: readonly string[];
|
|
11
|
+
/** Allowlisted TCB versions for tee_execution attestations. */
|
|
12
|
+
teeTcbAllowlist?: readonly string[];
|
|
13
|
+
/** Revoked TEE root IDs (denylist). */
|
|
14
|
+
teeRootRevoked?: readonly string[];
|
|
15
|
+
/** Revoked TCB versions (denylist). */
|
|
16
|
+
teeTcbRevoked?: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function verifyExecutionAttestation(envelope: unknown, options?: ExecutionAttestationVerifierOptions): Promise<{
|
|
19
|
+
result: VerificationResult;
|
|
20
|
+
attestation_id?: string;
|
|
21
|
+
execution_type?: ExecutionAttestationPayload['execution_type'];
|
|
22
|
+
agent_did?: string;
|
|
23
|
+
attester_did?: string;
|
|
24
|
+
run_id?: string;
|
|
25
|
+
proof_bundle_hash_b64u?: string;
|
|
26
|
+
signer_did?: string;
|
|
27
|
+
allowlisted?: boolean;
|
|
28
|
+
tee_root_id?: string;
|
|
29
|
+
tee_tcb_version?: string;
|
|
30
|
+
error?: VerificationError;
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=verify-execution-attestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-execution-attestation.d.ts","sourceRoot":"","sources":["../src/verify-execution-attestation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,2BAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAkBpB,MAAM,WAAW,mCAAmC;IAClD,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAE1C,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC,+DAA+D;IAC/D,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEpC,uCAAuC;IACvC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEnC,uCAAuC;IACvC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AA6ED,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE,mCAAwC,GAChD,OAAO,CAAC;IACT,MAAM,EAAE,kBAAkB,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B,CAAC,CAuiBD"}
|