tinfoil 0.8.1 → 0.8.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.
@@ -141,7 +141,8 @@ function compareMeasurementsError(codeMeasurement, runtimeMeasurement) {
141
141
  }
142
142
  return null;
143
143
  }
144
- case PLATFORM_TYPES.SEV_GUEST_V1: {
144
+ case PLATFORM_TYPES.SEV_GUEST_V1:
145
+ case PLATFORM_TYPES.SEV_GUEST_V2: {
145
146
  if (codeMeasurement.registers.length < 1 || runtimeMeasurement.registers.length < 1) {
146
147
  return new Error(MEASUREMENT_ERROR_MESSAGES.FEW_REGISTERS);
147
148
  }
@@ -438,10 +439,10 @@ export class Verifier {
438
439
  this.verifyEnclave(this.serverURL),
439
440
  ]);
440
441
  // Compare measurements using platform-specific logic
441
- const measurementsMatch = compareMeasurements(codeMeasurement, attestation.measurement);
442
- if (!measurementsMatch) {
442
+ const measurementsMatchError = compareMeasurementsError(codeMeasurement, attestation.measurement);
443
+ if (measurementsMatchError) {
443
444
  throw new Error(`Measurement verification failed: Code measurement (${codeMeasurement.type}) ` +
444
- `does not match runtime measurement (${attestation.measurement.type})`);
445
+ `does not match runtime measurement (${attestation.measurement.type}): ${measurementsMatchError.message}`);
445
446
  }
446
447
  // Persist a full verification document for later retrieval by clients
447
448
  this.lastVerificationDocument = {
package/dist/verifier.js CHANGED
@@ -180,7 +180,8 @@ function compareMeasurementsError(codeMeasurement, runtimeMeasurement) {
180
180
  }
181
181
  return null;
182
182
  }
183
- case PLATFORM_TYPES.SEV_GUEST_V1: {
183
+ case PLATFORM_TYPES.SEV_GUEST_V1:
184
+ case PLATFORM_TYPES.SEV_GUEST_V2: {
184
185
  if (codeMeasurement.registers.length < 1 || runtimeMeasurement.registers.length < 1) {
185
186
  return new Error(MEASUREMENT_ERROR_MESSAGES.FEW_REGISTERS);
186
187
  }
@@ -477,10 +478,10 @@ class Verifier {
477
478
  this.verifyEnclave(this.serverURL),
478
479
  ]);
479
480
  // Compare measurements using platform-specific logic
480
- const measurementsMatch = compareMeasurements(codeMeasurement, attestation.measurement);
481
- if (!measurementsMatch) {
481
+ const measurementsMatchError = compareMeasurementsError(codeMeasurement, attestation.measurement);
482
+ if (measurementsMatchError) {
482
483
  throw new Error(`Measurement verification failed: Code measurement (${codeMeasurement.type}) ` +
483
- `does not match runtime measurement (${attestation.measurement.type})`);
484
+ `does not match runtime measurement (${attestation.measurement.type}): ${measurementsMatchError.message}`);
484
485
  }
485
486
  // Persist a full verification document for later retrieval by clients
486
487
  this.lastVerificationDocument = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinfoil",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Tinfoil secure OpenAI client wrapper",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",