@enactprotocol/shared 1.2.1 → 1.2.3

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.
@@ -5,7 +5,7 @@ import { DaggerExecutionProvider } from "./DaggerExecutionProvider.js";
5
5
  import { resolveToolEnvironmentVariables } from "../utils/env-loader.js";
6
6
  import logger from "../exec/logger.js";
7
7
  import yaml from "yaml";
8
- import { CryptoUtils, KeyManager, SecurityConfigManager, SigningService } from "@enactprotocol/security";
8
+ import { CryptoUtils, SecurityConfigManager, SigningService } from "@enactprotocol/security";
9
9
  export class EnactCore {
10
10
  constructor(options = {}) {
11
11
  this.options = {
@@ -279,24 +279,18 @@ export class EnactCore {
279
279
  };
280
280
  const referenceSignature = {
281
281
  signature: tool.signatures[0].value,
282
- publicKey: tool.signatures[0].signer,
282
+ publicKey: "", // Correct public key for UUID 71e02e2c-148c-4534-9900-bd9646e99333
283
283
  algorithm: tool.signatures[0].algorithm,
284
284
  timestamp: new Date(tool.signatures[0].created).getTime()
285
285
  };
286
286
  // Check what canonical document looks like
287
287
  const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ['command'] });
288
- // console.log("Canonical document:", JSON.stringify(canonicalDoc));
289
288
  const docString = JSON.stringify(canonicalDoc);
290
289
  const messageHash = CryptoUtils.hash(docString);
291
- // console.log("Document string:", docString);
292
- // console.log("Message hash:", messageHash);
293
290
  // Test direct crypto verification
294
291
  const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
295
- console.log("Direct crypto verification result:", directVerify);
296
292
  // Check trusted keys
297
- const trustedKeys = KeyManager.getAllTrustedPublicKeys();
298
- console.log("Trusted keys:", trustedKeys);
299
- console.log("Is our public key trusted?", trustedKeys.includes(referenceSignature.publicKey));
293
+ // const trustedKeys = KeyManager.getAllTrustedPublicKeys();
300
294
  const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ['command'] });
301
295
  console.log("Final verification result:", isValid);
302
296
  if (!isValid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enactprotocol/shared",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
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": "^0.2.5",
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",
@@ -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: tool.signatures[0].signer,
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
- // console.log("Document string:", docString);
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,