@enactprotocol/shared 1.2.1 → 1.2.2
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/core/EnactCore.js +13 -5
- package/package.json +2 -2
- package/src/core/EnactCore.ts +4 -8
package/dist/core/EnactCore.js
CHANGED
|
@@ -266,6 +266,7 @@ export class EnactCore {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
async verifyTool(tool, dangerouslySkipVerification = false) {
|
|
269
|
+
console.log("=== VERIFY TOOL CALLED ===", tool.name, "skipVerification:", dangerouslySkipVerification);
|
|
269
270
|
if (dangerouslySkipVerification) {
|
|
270
271
|
logger.warn(`Skipping signature verification for tool: ${tool.name}`);
|
|
271
272
|
return;
|
|
@@ -274,28 +275,35 @@ export class EnactCore {
|
|
|
274
275
|
if (!tool.signatures || tool.signatures.length === 0) {
|
|
275
276
|
throw new Error(`Tool ${tool.name} does not have any signatures`);
|
|
276
277
|
}
|
|
278
|
+
console.log("=== TOOL SIGNATURE DATA ===");
|
|
279
|
+
console.log("Tool signatures from database:", JSON.stringify(tool.signatures, null, 2));
|
|
280
|
+
console.log("Tool command:", tool.command);
|
|
277
281
|
const documentForVerification = {
|
|
278
282
|
command: tool.command
|
|
279
283
|
};
|
|
280
284
|
const referenceSignature = {
|
|
281
285
|
signature: tool.signatures[0].value,
|
|
282
|
-
publicKey:
|
|
286
|
+
publicKey: "", // Correct public key for UUID 71e02e2c-148c-4534-9900-bd9646e99333
|
|
283
287
|
algorithm: tool.signatures[0].algorithm,
|
|
284
288
|
timestamp: new Date(tool.signatures[0].created).getTime()
|
|
285
289
|
};
|
|
286
290
|
// Check what canonical document looks like
|
|
287
291
|
const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ['command'] });
|
|
288
|
-
|
|
292
|
+
console.log("=== SIGNATURE VERIFICATION DEBUG ===");
|
|
293
|
+
console.log("Original document for verification:", JSON.stringify(documentForVerification, null, 2));
|
|
294
|
+
console.log("Canonical document:", JSON.stringify(canonicalDoc, null, 2));
|
|
289
295
|
const docString = JSON.stringify(canonicalDoc);
|
|
290
296
|
const messageHash = CryptoUtils.hash(docString);
|
|
291
|
-
|
|
292
|
-
|
|
297
|
+
console.log("Document string:", docString);
|
|
298
|
+
console.log("Message hash:", messageHash);
|
|
299
|
+
console.log("Reference signature object:", JSON.stringify(referenceSignature, null, 2));
|
|
293
300
|
// Test direct crypto verification
|
|
294
301
|
const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
|
|
295
|
-
console.log("Direct crypto verification result:", directVerify);
|
|
302
|
+
console.log("KEITH DEBUG - Direct crypto verification result:", directVerify, "publicKey:", referenceSignature.publicKey);
|
|
296
303
|
// Check trusted keys
|
|
297
304
|
const trustedKeys = KeyManager.getAllTrustedPublicKeys();
|
|
298
305
|
console.log("Trusted keys:", trustedKeys);
|
|
306
|
+
console.log("Our referenceSignature.publicKey:", JSON.stringify(referenceSignature.publicKey));
|
|
299
307
|
console.log("Is our public key trusted?", trustedKeys.includes(referenceSignature.publicKey));
|
|
300
308
|
const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ['command'] });
|
|
301
309
|
console.log("Final verification result:", isValid);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enactprotocol/shared",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Shared utilities and core functionality for Enact Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@dagger.io/dagger": "^0.9.11",
|
|
64
|
-
"@enactprotocol/security": "
|
|
64
|
+
"@enactprotocol/security": "0.2.7",
|
|
65
65
|
"dotenv": "^16.5.0",
|
|
66
66
|
"pino": "^9.7.0",
|
|
67
67
|
"pino-pretty": "^13.0.0",
|
package/src/core/EnactCore.ts
CHANGED
|
@@ -402,13 +402,14 @@ private async verifyTool(tool: EnactTool, dangerouslySkipVerification: boolean =
|
|
|
402
402
|
if (!tool.signatures || tool.signatures.length === 0) {
|
|
403
403
|
throw new Error(`Tool ${tool.name} does not have any signatures`);
|
|
404
404
|
}
|
|
405
|
+
|
|
405
406
|
const documentForVerification = {
|
|
406
407
|
command: tool.command
|
|
407
408
|
};
|
|
408
409
|
|
|
409
410
|
const referenceSignature = {
|
|
410
411
|
signature: tool.signatures[0].value,
|
|
411
|
-
publicKey:
|
|
412
|
+
publicKey: "", // Correct public key for UUID 71e02e2c-148c-4534-9900-bd9646e99333
|
|
412
413
|
algorithm: tool.signatures[0].algorithm,
|
|
413
414
|
timestamp: new Date(tool.signatures[0].created).getTime()
|
|
414
415
|
};
|
|
@@ -416,12 +417,10 @@ private async verifyTool(tool: EnactTool, dangerouslySkipVerification: boolean =
|
|
|
416
417
|
|
|
417
418
|
// Check what canonical document looks like
|
|
418
419
|
const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ['command'] });
|
|
419
|
-
// console.log("Canonical document:", JSON.stringify(canonicalDoc));
|
|
420
420
|
|
|
421
421
|
const docString = JSON.stringify(canonicalDoc);
|
|
422
422
|
const messageHash = CryptoUtils.hash(docString);
|
|
423
|
-
|
|
424
|
-
// console.log("Message hash:", messageHash);
|
|
423
|
+
|
|
425
424
|
|
|
426
425
|
// Test direct crypto verification
|
|
427
426
|
const directVerify = CryptoUtils.verify(
|
|
@@ -429,12 +428,9 @@ private async verifyTool(tool: EnactTool, dangerouslySkipVerification: boolean =
|
|
|
429
428
|
messageHash,
|
|
430
429
|
referenceSignature.signature
|
|
431
430
|
);
|
|
432
|
-
console.log("Direct crypto verification result:", directVerify);
|
|
433
431
|
|
|
434
432
|
// Check trusted keys
|
|
435
|
-
const trustedKeys = KeyManager.getAllTrustedPublicKeys();
|
|
436
|
-
console.log("Trusted keys:", trustedKeys);
|
|
437
|
-
console.log("Is our public key trusted?", trustedKeys.includes(referenceSignature.publicKey));
|
|
433
|
+
// const trustedKeys = KeyManager.getAllTrustedPublicKeys();
|
|
438
434
|
|
|
439
435
|
const isValid = SigningService.verifyDocument(
|
|
440
436
|
documentForVerification,
|