@zeke-02/tinfoil 0.0.6 → 0.0.8
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.
|
@@ -6,7 +6,6 @@ exports.encryptedBodyRequest = encryptedBodyRequest;
|
|
|
6
6
|
exports.createEncryptedBodyFetch = createEncryptedBodyFetch;
|
|
7
7
|
exports.getTransportForOrigin = getTransportForOrigin;
|
|
8
8
|
const ehbp_1 = require("@zeke-02/ehbp");
|
|
9
|
-
const fetch_adapter_1 = require("./fetch-adapter");
|
|
10
9
|
// Public API
|
|
11
10
|
async function getHPKEKey(enclaveURL) {
|
|
12
11
|
const url = new URL(enclaveURL);
|
|
@@ -14,8 +13,7 @@ async function getHPKEKey(enclaveURL) {
|
|
|
14
13
|
if (keysURL.protocol !== "https:") {
|
|
15
14
|
throw new Error(`HTTPS is required for remote key retrieval. Invalid protocol: ${keysURL.protocol}`);
|
|
16
15
|
}
|
|
17
|
-
const
|
|
18
|
-
const response = await fetchFn(keysURL.toString());
|
|
16
|
+
const response = await fetch(keysURL.toString());
|
|
19
17
|
if (!response.ok) {
|
|
20
18
|
throw new Error(`Failed to get server public key: ${response.status}`);
|
|
21
19
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Identity, Transport, PROTOCOL } from "@zeke-02/ehbp";
|
|
2
|
-
import { getFetch } from "./fetch-adapter.mjs";
|
|
3
2
|
// Public API
|
|
4
3
|
export async function getHPKEKey(enclaveURL) {
|
|
5
4
|
const url = new URL(enclaveURL);
|
|
@@ -7,8 +6,7 @@ export async function getHPKEKey(enclaveURL) {
|
|
|
7
6
|
if (keysURL.protocol !== "https:") {
|
|
8
7
|
throw new Error(`HTTPS is required for remote key retrieval. Invalid protocol: ${keysURL.protocol}`);
|
|
9
8
|
}
|
|
10
|
-
const
|
|
11
|
-
const response = await fetchFn(keysURL.toString());
|
|
9
|
+
const response = await fetch(keysURL.toString());
|
|
12
10
|
if (!response.ok) {
|
|
13
11
|
throw new Error(`Failed to get server public key: ${response.status}`);
|
|
14
12
|
}
|
|
@@ -124,6 +124,7 @@ export class SecureClient {
|
|
|
124
124
|
}
|
|
125
125
|
catch (error) {
|
|
126
126
|
if (this.verificationDocument) {
|
|
127
|
+
console.log("secure-client error", error);
|
|
127
128
|
const errorMessage = error.message;
|
|
128
129
|
if (errorMessage.includes("HPKE public key mismatch")) {
|
|
129
130
|
this.verificationDocument.steps.verifyHPKEKey = {
|
package/dist/esm/verifier.mjs
CHANGED
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
* - `suppressWasmLogs(suppress?)` → void - control WASM log output
|
|
66
66
|
*/
|
|
67
67
|
import { TINFOIL_CONFIG } from "./config.mjs";
|
|
68
|
-
import { getFetch } from "./fetch-adapter.mjs";
|
|
69
68
|
let cachedTextEncoder = null;
|
|
70
69
|
function getTextEncoder() {
|
|
71
70
|
if (!cachedTextEncoder) {
|
|
@@ -119,8 +118,7 @@ export class Verifier {
|
|
|
119
118
|
await initializeWasmGlobals();
|
|
120
119
|
const goInstance = new globalThis.Go();
|
|
121
120
|
// Load WASM module
|
|
122
|
-
const
|
|
123
|
-
const wasmResponse = await fetchFn(Verifier.defaultWasmUrl);
|
|
121
|
+
const wasmResponse = await fetch(Verifier.defaultWasmUrl);
|
|
124
122
|
if (!wasmResponse.ok) {
|
|
125
123
|
throw new Error(`Failed to fetch WASM: ${wasmResponse.status} ${wasmResponse.statusText}`);
|
|
126
124
|
}
|
package/dist/secure-client.js
CHANGED
|
@@ -127,6 +127,7 @@ class SecureClient {
|
|
|
127
127
|
}
|
|
128
128
|
catch (error) {
|
|
129
129
|
if (this.verificationDocument) {
|
|
130
|
+
console.log("secure-client error", error);
|
|
130
131
|
const errorMessage = error.message;
|
|
131
132
|
if (errorMessage.includes("HPKE public key mismatch")) {
|
|
132
133
|
this.verificationDocument.steps.verifyHPKEKey = {
|
package/dist/verifier.js
CHANGED
|
@@ -102,7 +102,6 @@ exports.suppressWasmLogs = suppressWasmLogs;
|
|
|
102
102
|
* - `suppressWasmLogs(suppress?)` → void - control WASM log output
|
|
103
103
|
*/
|
|
104
104
|
const config_1 = require("./config");
|
|
105
|
-
const fetch_adapter_1 = require("./fetch-adapter");
|
|
106
105
|
let cachedTextEncoder = null;
|
|
107
106
|
function getTextEncoder() {
|
|
108
107
|
if (!cachedTextEncoder) {
|
|
@@ -156,8 +155,7 @@ class Verifier {
|
|
|
156
155
|
await initializeWasmGlobals();
|
|
157
156
|
const goInstance = new globalThis.Go();
|
|
158
157
|
// Load WASM module
|
|
159
|
-
const
|
|
160
|
-
const wasmResponse = await fetchFn(Verifier.defaultWasmUrl);
|
|
158
|
+
const wasmResponse = await fetch(Verifier.defaultWasmUrl);
|
|
161
159
|
if (!wasmResponse.ok) {
|
|
162
160
|
throw new Error(`Failed to fetch WASM: ${wasmResponse.status} ${wasmResponse.statusText}`);
|
|
163
161
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeke-02/tinfoil",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Tinfoil secure OpenAI client wrapper for Tauri v2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.mjs",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@ai-sdk/openai-compatible": "^1.0.10",
|
|
88
88
|
"@tauri-apps/plugin-http": "^2.5.2",
|
|
89
|
-
"@zeke-02/ehbp": "^0.0.
|
|
89
|
+
"@zeke-02/ehbp": "^0.0.3",
|
|
90
90
|
"ai": "^5.0.19",
|
|
91
91
|
"dotenv": "^17.2.1",
|
|
92
92
|
"openai": "^5.13.1",
|
|
@@ -100,4 +100,4 @@
|
|
|
100
100
|
"jsdom": "^25.0.0",
|
|
101
101
|
"typescript": "^5.9.2"
|
|
102
102
|
}
|
|
103
|
-
}
|
|
103
|
+
}
|