diff --git a/packages/plugin-sgx/src/providers/sgxAttestationProvider.ts b/packages/plugin-sgx/src/providers/sgxAttestationProvider.ts index 1e8852d62c6..e00db7c296e 100644 --- a/packages/plugin-sgx/src/providers/sgxAttestationProvider.ts +++ b/packages/plugin-sgx/src/providers/sgxAttestationProvider.ts @@ -1,7 +1,7 @@ import type { IAgentRuntime, Memory, Provider, State } from "@elizaos/core"; import type { SgxAttestation } from "../types/attestation"; -import { promises as fs } from 'fs'; -import { createHash } from 'crypto'; +import { promises as fs } from 'node:fs'; // Fix: Use node: protocol +import { createHash } from 'node:crypto'; // Fix: Use node: protocol // Function to calculate SHA-256 and return a Buffer (32 bytes) function calculateSHA256(input: string): Buffer { @@ -19,7 +19,8 @@ class SgxAttestationProvider { private readonly USER_REPORT_DATA_PATH: string = "/dev/attestation/user_report_data"; private readonly QUOTE_PATH: string = "/dev/attestation/quote"; - constructor() {} + // Remove unnecessary constructor + // constructor() {} async generateAttestation( reportData: string @@ -76,7 +77,8 @@ class SgxAttestationProvider { throw new Error("quote without EOF"); } - return '0x' + quoteData.subarray(0, realLen + 1).toString('hex'); + //return '0x' + quoteData.subarray(0, realLen + 1).toString('hex'); + return `0x${quoteData.subarray(0, realLen + 1).toString('hex')}`; // Fix: Use template literal } }