tinfoil 0.9.1 → 0.10.0
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/README.md +34 -0
- package/dist/ai-sdk-provider.js +8 -3
- package/dist/config.d.ts +4 -11
- package/dist/config.js +4 -11
- package/dist/encrypted-body-fetch.d.ts +3 -5
- package/dist/encrypted-body-fetch.js +34 -93
- package/dist/esm/ai-sdk-provider.js +8 -3
- package/dist/esm/config.d.ts +4 -11
- package/dist/esm/config.js +4 -11
- package/dist/esm/encrypted-body-fetch.d.ts +3 -5
- package/dist/esm/encrypted-body-fetch.js +29 -54
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/router.d.ts +11 -0
- package/dist/esm/router.js +33 -0
- package/dist/esm/secure-client.d.ts +3 -2
- package/dist/esm/secure-client.js +116 -13
- package/dist/esm/tinfoilai.js +5 -3
- package/dist/esm/unverified-client.d.ts +2 -2
- package/dist/esm/unverified-client.js +30 -2
- package/dist/esm/verifier.d.ts +4 -1
- package/dist/esm/verifier.js +16 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/router.d.ts +11 -0
- package/dist/router.js +36 -0
- package/dist/secure-client.d.ts +3 -2
- package/dist/secure-client.js +116 -13
- package/dist/tinfoilai.js +5 -3
- package/dist/unverified-client.d.ts +2 -2
- package/dist/unverified-client.js +30 -2
- package/dist/verifier.d.ts +4 -1
- package/dist/verifier.js +16 -4
- package/package.json +2 -2
package/dist/verifier.d.ts
CHANGED
|
@@ -37,6 +37,9 @@ export interface VerificationDocument {
|
|
|
37
37
|
verifyCode: VerificationStepState;
|
|
38
38
|
verifyEnclave: VerificationStepState;
|
|
39
39
|
compareMeasurements: VerificationStepState;
|
|
40
|
+
createTransport?: VerificationStepState;
|
|
41
|
+
verifyHPKEKey?: VerificationStepState;
|
|
42
|
+
otherError?: VerificationStepState;
|
|
40
43
|
};
|
|
41
44
|
}
|
|
42
45
|
export interface MeasurementComparisonResult {
|
|
@@ -84,7 +87,7 @@ export declare class Verifier {
|
|
|
84
87
|
private static executeWithWasm;
|
|
85
88
|
/**
|
|
86
89
|
* Fetch the latest release digest from GitHub
|
|
87
|
-
* @param configRepo - Repository name (e.g., "tinfoilsh/confidential-
|
|
90
|
+
* @param configRepo - Repository name (e.g., "tinfoilsh/confidential-model-router")
|
|
88
91
|
* @returns The digest hash
|
|
89
92
|
*/
|
|
90
93
|
fetchLatestDigest(configRepo?: string): Promise<string>;
|
package/dist/verifier.js
CHANGED
|
@@ -163,7 +163,8 @@ function compareMeasurementsError(codeMeasurement, runtimeMeasurement) {
|
|
|
163
163
|
}
|
|
164
164
|
if (codeMeasurement.type === PLATFORM_TYPES.SNP_TDX_MULTI_PLATFORM_V1) {
|
|
165
165
|
switch (runtimeMeasurement.type) {
|
|
166
|
-
case PLATFORM_TYPES.TDX_GUEST_V1:
|
|
166
|
+
case PLATFORM_TYPES.TDX_GUEST_V1:
|
|
167
|
+
case PLATFORM_TYPES.TDX_GUEST_V2: {
|
|
167
168
|
if (codeMeasurement.registers.length < 3 || runtimeMeasurement.registers.length < 4) {
|
|
168
169
|
return new Error(MEASUREMENT_ERROR_MESSAGES.FEW_REGISTERS);
|
|
169
170
|
}
|
|
@@ -233,8 +234,10 @@ function compareMeasurements(codeMeasurement, runtimeMeasurement) {
|
|
|
233
234
|
*/
|
|
234
235
|
class Verifier {
|
|
235
236
|
constructor(options) {
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
if (!options?.serverURL) {
|
|
238
|
+
throw new Error("serverURL is required for Verifier");
|
|
239
|
+
}
|
|
240
|
+
this.serverURL = new URL(options.serverURL).hostname;
|
|
238
241
|
this.configRepo = options?.configRepo ?? config_1.TINFOIL_CONFIG.INFERENCE_PROXY_REPO;
|
|
239
242
|
}
|
|
240
243
|
/**
|
|
@@ -295,7 +298,7 @@ class Verifier {
|
|
|
295
298
|
}
|
|
296
299
|
/**
|
|
297
300
|
* Fetch the latest release digest from GitHub
|
|
298
|
-
* @param configRepo - Repository name (e.g., "tinfoilsh/confidential-
|
|
301
|
+
* @param configRepo - Repository name (e.g., "tinfoilsh/confidential-model-router")
|
|
299
302
|
* @returns The digest hash
|
|
300
303
|
*/
|
|
301
304
|
async fetchLatestDigest(configRepo) {
|
|
@@ -478,6 +481,15 @@ class Verifier {
|
|
|
478
481
|
}
|
|
479
482
|
catch (error) {
|
|
480
483
|
steps.fetchDigest = { status: 'failed', error: error.message };
|
|
484
|
+
this.lastVerificationDocument = {
|
|
485
|
+
configRepo: this.configRepo,
|
|
486
|
+
enclaveHost: this.serverURL,
|
|
487
|
+
releaseDigest: '',
|
|
488
|
+
codeMeasurement: { type: '', registers: [] },
|
|
489
|
+
enclaveMeasurement: { measurement: { type: '', registers: [] } },
|
|
490
|
+
securityVerified: false,
|
|
491
|
+
steps,
|
|
492
|
+
};
|
|
481
493
|
throw error;
|
|
482
494
|
}
|
|
483
495
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinfoil",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Tinfoil secure OpenAI client wrapper",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@ai-sdk/openai-compatible": "^1.0.10",
|
|
82
82
|
"ai": "^5.0.19",
|
|
83
83
|
"dotenv": "^17.2.1",
|
|
84
|
-
"ehbp": "^0.0.
|
|
84
|
+
"ehbp": "^0.0.4",
|
|
85
85
|
"openai": "^5.13.1",
|
|
86
86
|
"ts-node": "^10.9.2"
|
|
87
87
|
},
|