Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: plugin-sgx #2872

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/plugin-sgx/src/providers/sgxAttestationProvider.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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
}
}

Expand Down
Loading