@dmarket/p2p-tracker-core 1.0.4-SNAPSHOT-development.92 → 1.0.4-SNAPSHOT-development.120
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/VERSION +6 -6
- package/dmarket-p2p-tracker-core-domain.mjs +2736 -2346
- package/dmarket-p2p-tracker-core-domain.mjs.map +1 -1
- package/kotlinx-coroutines-core.mjs +7 -7
- package/kotlinx-coroutines-core.mjs.map +1 -1
- package/kotlinx-io-kotlinx-io-bytestring.mjs +30 -30
- package/kotlinx-io-kotlinx-io-core.mjs +451 -451
- package/ktor-ktor-client-core.mjs +1875 -1871
- package/ktor-ktor-client-core.mjs.map +1 -1
- package/ktor-ktor-events.mjs +5 -5
- package/ktor-ktor-http-cio.mjs +313 -313
- package/ktor-ktor-http.mjs +625 -625
- package/ktor-ktor-io.mjs +602 -602
- package/ktor-ktor-utils.mjs +661 -661
- package/ktor-ktor-websockets.mjs +367 -367
- package/p2p-tracker-core.mjs +7006 -5972
- package/p2p-tracker-core.mjs.map +1 -1
- package/package.json +1 -1
- package/pkg/README.md +21 -9
- package/pkg/client_wasm.d.ts +4 -0
- package/pkg/client_wasm.js +4 -0
- package/pkg/client_wasm_bg.wasm +0 -0
- package/transport/README.md +81 -13
- package/transport/dist/channel.d.ts.map +1 -1
- package/transport/dist/channel.js.map +1 -1
- package/transport/dist/index.d.ts +2 -0
- package/transport/dist/index.d.ts.map +1 -1
- package/transport/dist/index.js +3 -2
- package/transport/dist/index.js.map +1 -1
- package/transport/dist/node.d.ts +4 -0
- package/transport/dist/node.d.ts.map +1 -0
- package/transport/dist/node.js +62 -0
- package/transport/dist/node.js.map +1 -0
- package/transport/dist/prover.d.ts +2 -0
- package/transport/dist/prover.d.ts.map +1 -1
- package/transport/dist/prover.js.map +1 -1
- package/transport/dist/tcp.d.ts +38 -0
- package/transport/dist/tcp.d.ts.map +1 -0
- package/transport/dist/tcp.js +88 -0
- package/transport/dist/tcp.js.map +1 -0
- package/transport/dist/types.d.ts +1 -1
- package/transport/package.json +7 -1
package/package.json
CHANGED
package/pkg/README.md
CHANGED
|
@@ -42,11 +42,12 @@ that indexes into one). Logging config: `LoggingConfig` / `LoggingLevel` /
|
|
|
42
42
|
`CrateLogFilter`. `progressCb` receives `{ step, progress, message, source:
|
|
43
43
|
"wasm" }` at each `ProgressStage` boundary.
|
|
44
44
|
|
|
45
|
-
The IO channels are **not** opened
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
The IO channels are **not** opened in WASM. The transport that performs the
|
|
46
|
+
`Sec-WebSocket-Protocol` bearer handshake and supplies the two channels lives in
|
|
47
|
+
[`ts/`](ts/README.md). The target can use `connectProxy` in a browser or
|
|
48
|
+
`connectTcp` in a TCP-capable host (Node, Electron, or a native bridge).
|
|
49
|
+
Both deliver raw bytes; the prover performs MPC-TLS. The client consumes the
|
|
50
|
+
injected `IoChannel` (the interface is exported into the `.d.ts` from a
|
|
50
51
|
`typescript_custom_section` in `src/io.rs` — the single source of truth).
|
|
51
52
|
|
|
52
53
|
## Build & packaging
|
|
@@ -71,10 +72,21 @@ a fast unoptimized build.
|
|
|
71
72
|
|
|
72
73
|
## The JS/TS transport → [`ts/`](ts/README.md)
|
|
73
74
|
|
|
74
|
-
`client-wasm-transport
|
|
75
|
-
|
|
76
|
-
`
|
|
77
|
-
|
|
75
|
+
`client-wasm-transport` supplies `connectNotary`, `connectProxy`, and the
|
|
76
|
+
host-injected `connectTcp` / `TcpIoChannel`. Its separate
|
|
77
|
+
`client-wasm-transport/node` export opens Node TCP sockets directly, without
|
|
78
|
+
adding Node imports to browser bundles. See its README for examples.
|
|
79
|
+
|
|
80
|
+
For native mobile Rust clients, enable `client-core`'s `tcp` feature and pass
|
|
81
|
+
`client_core::connect_tcp((host, port)).await?` as `issue()`'s target stream.
|
|
82
|
+
The caller still supplies the authenticated notary channel and a Tokio runtime.
|
|
83
|
+
Other mobile runtimes can supply their own futures-io stream instead.
|
|
84
|
+
|
|
85
|
+
Transport support does not change the WASM execution environment: the shipped
|
|
86
|
+
threaded package still needs browser Web Workers and cross-origin isolation.
|
|
87
|
+
Electron can run it in a suitable renderer with TCP supplied by the host; plain
|
|
88
|
+
Node needs a compatible WASM worker/bootstrap integration. This change does not
|
|
89
|
+
add mobile platform bindings to the scaffolded `client-cffi` crate.
|
|
78
90
|
|
|
79
91
|
## Running end-to-end → [`RUN_E2E.md`](RUN_E2E.md) (deferred scope)
|
|
80
92
|
|
package/pkg/client_wasm.d.ts
CHANGED
|
@@ -231,6 +231,10 @@ export function present(attestation_bytes: Uint8Array, secrets_bytes: Uint8Array
|
|
|
231
231
|
* exchange — yielding a notary-signed attestation validated against the
|
|
232
232
|
* prover's own view.
|
|
233
233
|
*
|
|
234
|
+
* `server_io` must carry raw target bytes, either over a direct TCP socket
|
|
235
|
+
* supplied by the host or through a WebSocket-to-TCP proxy. Do not perform TLS
|
|
236
|
+
* in the host: this function performs MPC-TLS over that byte stream.
|
|
237
|
+
*
|
|
234
238
|
* - `config` — the locked issuance surface ([`IssuanceConfig`]).
|
|
235
239
|
* - `request` — the single HTTP request to prove ([`HttpRequest`]).
|
|
236
240
|
* - `progress_cb` — optional; invoked at each `ProgressStage` boundary with
|
package/pkg/client_wasm.js
CHANGED
|
@@ -183,6 +183,10 @@ export function present(attestation_bytes, secrets_bytes, policy) {
|
|
|
183
183
|
* exchange — yielding a notary-signed attestation validated against the
|
|
184
184
|
* prover's own view.
|
|
185
185
|
*
|
|
186
|
+
* `server_io` must carry raw target bytes, either over a direct TCP socket
|
|
187
|
+
* supplied by the host or through a WebSocket-to-TCP proxy. Do not perform TLS
|
|
188
|
+
* in the host: this function performs MPC-TLS over that byte stream.
|
|
189
|
+
*
|
|
186
190
|
* - `config` — the locked issuance surface ([`IssuanceConfig`]).
|
|
187
191
|
* - `request` — the single HTTP request to prove ([`HttpRequest`]).
|
|
188
192
|
* - `progress_cb` — optional; invoked at each `ProgressStage` boundary with
|
package/pkg/client_wasm_bg.wasm
CHANGED
|
Binary file
|
package/transport/README.md
CHANGED
|
@@ -4,11 +4,9 @@ The TS companion to the `client-wasm` browser-extension prover. Two layers,
|
|
|
4
4
|
both **wasm-free at runtime** (the emitted `dist/` contains no import of the
|
|
5
5
|
wasm pkg — a load-bearing invariant, see below):
|
|
6
6
|
|
|
7
|
-
- **Transport** — the
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
tungstenite, so the transport lives here and is injected across the wasm
|
|
11
|
-
boundary).
|
|
7
|
+
- **Transport** — the `IoChannel`s that [`prove()`](../pkg) consumes:
|
|
8
|
+
authenticated WebSocket to the notary, and either a WebSocket-to-TCP proxy
|
|
9
|
+
or a direct host TCP connection to the target.
|
|
12
10
|
- **Prover façade** — `createProver(wasm)`: a pass-through mirror of the wasm
|
|
13
11
|
API (`initialize` / `prove` / `present`, same call shapes) over a
|
|
14
12
|
**caller-injected** pkg module. It owns the setup (the pkg's default
|
|
@@ -24,6 +22,9 @@ wasm pkg — a load-bearing invariant, see below):
|
|
|
24
22
|
| `ClientWasmModule` | type | the injected-module contract (`import * as wasm from ".../pkg/client_wasm.js"` satisfies it) |
|
|
25
23
|
| `connectNotary(url, token, opts?)` | transport | the notary MPC channel, authenticated by the `Sec-WebSocket-Protocol` bearer subprotocol |
|
|
26
24
|
| `connectProxy(proxyBase, host, port, opts?)` | transport | the target byte pipe, tunnelled `WS → p2p-wss-proxy → TCP` |
|
|
25
|
+
| `connectTcp(host, port, { connect })` | transport | direct target TCP through an injected host connector |
|
|
26
|
+
| `TcpIoChannel` / `TcpSocket` / `TcpConnectOptions` | transport / types | adapt host Web Streams to `IoChannel` |
|
|
27
|
+
| `connectTcp(host, port = 443)` from `client-wasm-transport/node` | transport | direct target TCP using Node's `net` module |
|
|
27
28
|
| `WsIoChannel` | transport | the `WebSocket`→`IoChannel` adapter both helpers return |
|
|
28
29
|
| `NOTARY_SUBPROTOCOL` | transport | `"tlsn.notary.v2"` — the notary subprotocol marker |
|
|
29
30
|
| DTO types | types | `IssuanceConfig`, `HttpRequest`/`HttpResponse`, `RevealPolicy`, `BodyReveal`, `RootStore`, `LoggingConfig`, `ProveOutput`, `ProveProgress`/`ProgressCallback`, `IoChannel` |
|
|
@@ -69,6 +70,68 @@ const presentation = prover.present(out.attestation, out.secrets, {
|
|
|
69
70
|
// POST `presentation` (Uint8Array) to your validating backend.
|
|
70
71
|
```
|
|
71
72
|
|
|
73
|
+
## Direct TCP for desktop and native hosts
|
|
74
|
+
|
|
75
|
+
In a Node-capable host, replace the target proxy channel with:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { connectTcp } from "client-wasm-transport/node";
|
|
79
|
+
|
|
80
|
+
const serverIo = await connectTcp("api.example.com", 443);
|
|
81
|
+
try {
|
|
82
|
+
const out = await prover.prove(
|
|
83
|
+
notaryIo, serverIo,
|
|
84
|
+
{ serverName: "api.example.com" },
|
|
85
|
+
{ method: "GET", uri: "/v1/resource" },
|
|
86
|
+
);
|
|
87
|
+
// Persist out.attestation and out.secrets together.
|
|
88
|
+
} finally {
|
|
89
|
+
await serverIo.close();
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The `/node` entry uses `node:net`, enables `TCP_NODELAY`, and waits for the
|
|
94
|
+
socket to connect. It adapts the read and write sides independently to Web Streams.
|
|
95
|
+
Peer EOF ends reads; the write side stays open until `close()` flushes pending
|
|
96
|
+
writes and releases the socket.
|
|
97
|
+
Connection and stream errors reject the corresponding operation.
|
|
98
|
+
The main browser entry has no Node imports.
|
|
99
|
+
|
|
100
|
+
A native bridge can instead supply a connector through the main entry:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { connectTcp } from "client-wasm-transport";
|
|
104
|
+
|
|
105
|
+
const serverIo = await connectTcp("api.example.com", 443, {
|
|
106
|
+
connect: (host, port) => nativeBridge.openTcp(host, port),
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`nativeBridge.openTcp` is implemented by your host and returns a `TcpSocket`:
|
|
111
|
+
unlocked binary Web `ReadableStream` / `WritableStream` objects plus an async
|
|
112
|
+
`close()` that releases the socket and unblocks reads. It must resolve after
|
|
113
|
+
connecting with Nagle disabled, and clean up any failed connection itself.
|
|
114
|
+
For a bridge that already supplies `IoChannel`, pass that channel directly to
|
|
115
|
+
`prove()`; no adapter is required.
|
|
116
|
+
|
|
117
|
+
Both paths carry **raw TCP**, without a TLS handshake in the host. MPC-TLS
|
|
118
|
+
runs inside the prover. The destination host/port controls routing;
|
|
119
|
+
`config.serverName` still controls SNI and certificate identity and may differ
|
|
120
|
+
from the destination IP. The notary continues to use `connectNotary`.
|
|
121
|
+
The caller owns connection timeouts and should close both channels in `finally`
|
|
122
|
+
when an issuance fails.
|
|
123
|
+
|
|
124
|
+
`TcpIoChannel` skips empty chunks, returns `null` only at EOF, propagates IO
|
|
125
|
+
errors, copies outgoing bytes before yielding, and waits for pending writes
|
|
126
|
+
before closing. Repeated `close()` calls share the same promise.
|
|
127
|
+
|
|
128
|
+
This adds a transport for desktop npm hosts; the shipped WASM binary still
|
|
129
|
+
uses browser Web Workers. Electron needs a suitable renderer and host bridge;
|
|
130
|
+
plain Node needs a compatible WASM worker/bootstrap integration. A TCP adapter
|
|
131
|
+
alone does not supply that runtime. Native mobile Rust integrations can use
|
|
132
|
+
`client-core` with `features = ["tcp"]`, a Tokio runtime, and
|
|
133
|
+
`client_core::connect_tcp((host, port))` as the target stream for `issue()`.
|
|
134
|
+
|
|
72
135
|
## Why injection instead of `import ... from "client-wasm"` (load-bearing)
|
|
73
136
|
|
|
74
137
|
This package is **inlined** by its consumer's bundle (the extension's
|
|
@@ -105,8 +168,8 @@ fallback.
|
|
|
105
168
|
|
|
106
169
|
## The `IoChannel` contract
|
|
107
170
|
|
|
108
|
-
`WsIoChannel`
|
|
109
|
-
declared locally in `src/types.ts` (so this package's `.d.ts` never references
|
|
171
|
+
`WsIoChannel` and `TcpIoChannel` implement the interface the wasm side expects.
|
|
172
|
+
The shape is declared locally in `src/types.ts` (so this package's `.d.ts` never references
|
|
110
173
|
the unpublished pkg) and **compile-time asserted identical** to the generated
|
|
111
174
|
`../pkg/client_wasm.d.ts` — which is itself generated from the Rust
|
|
112
175
|
`typescript_custom_section` in `../src/io.rs`, the single source of truth —
|
|
@@ -114,13 +177,13 @@ by `src/wasm-compat.ts`:
|
|
|
114
177
|
|
|
115
178
|
```ts
|
|
116
179
|
interface IoChannel {
|
|
117
|
-
read(): Promise<Uint8Array | null>; // next inbound
|
|
180
|
+
read(): Promise<Uint8Array | null>; // next inbound chunk, or null on EOF
|
|
118
181
|
write(data: Uint8Array): Promise<void>;
|
|
119
182
|
close(): Promise<void>;
|
|
120
183
|
}
|
|
121
184
|
```
|
|
122
185
|
|
|
123
|
-
|
|
186
|
+
WebSocket semantics (mirroring the native `WsByteStream`): `read()` returns one inbound
|
|
124
187
|
binary frame per call (the Rust adapter buffers leftovers, so frame boundaries
|
|
125
188
|
needn't align with reads); a socket close/error resolves `read()` with `null`
|
|
126
189
|
(EOF → `Ok(0)` in Rust); empty frames are skipped, not treated as EOF;
|
|
@@ -140,6 +203,8 @@ queue in `io.rs` is satisfied immediately here).
|
|
|
140
203
|
JOURNAL toplevel/06): `connectProxy` opens
|
|
141
204
|
`ws://<proxyBase>/?host=<host>&port=<port>` (no subprotocol/auth) and the
|
|
142
205
|
worker relays bytes to a raw TCP socket. MPC-TLS runs over this pipe.
|
|
206
|
+
- **Server (direct TCP)** — a TCP-capable host uses `connectTcp` to supply the
|
|
207
|
+
same raw byte pipe without a proxy.
|
|
143
208
|
|
|
144
209
|
## Building & typechecking
|
|
145
210
|
|
|
@@ -152,16 +217,19 @@ with `grep -rE 'from "client-wasm"' dist/` → nothing).
|
|
|
152
217
|
|
|
153
218
|
```sh
|
|
154
219
|
../build.sh # 1. build the wasm pkg (produces ../pkg/client_wasm.d.ts)
|
|
155
|
-
npm install # 2. dev-only (TypeScript); no runtime deps
|
|
220
|
+
npm install # 2. dev-only (TypeScript + Node types); no runtime deps
|
|
156
221
|
npm run typecheck # tsc --noEmit — includes the wasm-compat drift check
|
|
157
222
|
npm run build # emit dist/ (ESM + .d.ts)
|
|
223
|
+
npm test # build + adapter and loopback TCP tests
|
|
158
224
|
```
|
|
159
225
|
|
|
160
226
|
## Running outside a browser (Node)
|
|
161
227
|
|
|
162
|
-
`
|
|
163
|
-
|
|
164
|
-
|
|
228
|
+
`connectNotary` / `connectProxy` use the global `WebSocket` by default. To use
|
|
229
|
+
another implementation, pass
|
|
230
|
+
`connectNotary(url, token, { WebSocketImpl: WsFromNodePackage })`.
|
|
231
|
+
Use the `/node` entry above for a direct TCP target. See its runtime caveat
|
|
232
|
+
before attempting to initialize the browser WASM package in plain Node.
|
|
165
233
|
|
|
166
234
|
## Integrator note (cross-origin isolation)
|
|
167
235
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;CAC7D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,WAAY,YAAW,SAAS;;IAW3C,YAAY,EAAE,EAAE,SAAS,EAgCxB;IAED,qEAAqE;IACrE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAEzB;IAED,uEAAuE;IACvE,IAAI,QAAQ,IAAI,MAAM,CAErB;IAyBD,IAAI,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAKjC;IAEK,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAe3C;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAcrB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,WAAW;IACb,GAAG,CAAY;IACxB,kEAAkE;IACzD,MAAM,GAAiB,EAAE,CAAC;IACnC,gEAAgE;IACvD,QAAQ,GAA2C,EAAE,CAAC;IAC/D,8EAA8E;IACrE,MAAM,CAAgB;IAC/B,+EAA+E;IAC/E,OAAO,GAAG,KAAK,CAAC;IAEhB,YAAY,EAAa;QACvB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,oEAAoE;QACpE,8EAA8E;QAC9E,EAAE,CAAC,UAAU,GAAG,aAAa,CAAC;QAE9B,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAClD,IAAI,EAAE,CAAC,UAAU,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;gBACrC,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7D,wEAAwE;YACxE,gEAAgE;YAChE,EAAE,CAAC,gBAAgB,CACjB,OAAO,EACP,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,sCAAsC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,EAC3E,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;YACF,EAAE,CAAC,gBAAgB,CA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IAAI,CAAC,MAAM,EAAE,CAAC;YACd,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACpE,IAAI,CAAC;gBACH,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACnB,CAAC;YAAC,MAAM,CAAC;gBACP,kEAAkE;gBAClE,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,4EAA4E;AAC5E,SAAS,OAAO,CAAC,IAAa;IAC5B,IAAI,IAAI,YAAY,WAAW;QAAE,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC7D,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAuB,CAAC;QACrC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACvE,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpE,oEAAoE;IACpE,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -2,6 +2,8 @@ export { WsIoChannel } from "./channel.js";
|
|
|
2
2
|
export type { WebSocketCtor } from "./channel.js";
|
|
3
3
|
export { NOTARY_SUBPROTOCOL, connectNotary, connectProxy } from "./transport.js";
|
|
4
4
|
export type { ConnectOptions } from "./transport.js";
|
|
5
|
+
export { connectTcp, TcpIoChannel } from "./tcp.js";
|
|
6
|
+
export type { TcpSocket, TcpConnectOptions } from "./tcp.js";
|
|
5
7
|
export { createProver } from "./prover.js";
|
|
6
8
|
export type { ClientWasmModule, Prover } from "./prover.js";
|
|
7
9
|
export type { BodyReveal, CrateLogFilter, HttpRequest, HttpResponse, IoChannel, IssuanceConfig, LoggingConfig, LoggingLevel, ProgressCallback, ProveOutput, ProveProgress, RevealPolicy, RootStore, RootStorePreset, } from "./types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjF,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE5D,YAAY,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjF,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE5D,YAAY,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
package/transport/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Two layers, both wasm-free at runtime (this package emits **no** import of
|
|
4
4
|
// the wasm pkg — load-bearing for the extension bundle, see ./prover.ts):
|
|
5
5
|
//
|
|
6
|
-
// - **Transport
|
|
7
|
-
//
|
|
6
|
+
// - **Transport**: WebSocket or host-provided TCP `IoChannel`s for prove().
|
|
7
|
+
// Node's TCP connector is separately exported from /node.
|
|
8
8
|
// - **Prover façade** (`createProver`): a pass-through mirror of the wasm
|
|
9
9
|
// API (`initialize` / `prove` / `present`) over a caller-injected pkg
|
|
10
10
|
// module — owns instantiation + rayon-pool setup and the wire
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
// compile-time-checked against the generated pkg in ./wasm-compat.ts.
|
|
15
15
|
export { WsIoChannel } from "./channel.js";
|
|
16
16
|
export { NOTARY_SUBPROTOCOL, connectNotary, connectProxy } from "./transport.js";
|
|
17
|
+
export { connectTcp, TcpIoChannel } from "./tcp.js";
|
|
17
18
|
export { createProver } from "./prover.js";
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,8DAA8D;AAC9D,4EAA4E;AAC5E,0EAA0E;AAC1E,kEAAkE;AAClE,mBAAmB;AACnB,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5E,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAuD1E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Kept behind the /node entry point so browser bundles never import node:*.
|
|
2
|
+
import { once } from "node:events";
|
|
3
|
+
import { createConnection } from "node:net";
|
|
4
|
+
import { finished, Readable } from "node:stream";
|
|
5
|
+
import { connectTcp as connectWithHost } from "./tcp.js";
|
|
6
|
+
/** Open a raw Node TCP target socket, ready to pass as prove()'s serverIo. */
|
|
7
|
+
export function connectTcp(host, port = 443) {
|
|
8
|
+
return connectWithHost(host, port, {
|
|
9
|
+
async connect(host, port) {
|
|
10
|
+
// Let TcpIoChannel close the writer after flushing accepted writes.
|
|
11
|
+
// Otherwise peer EOF auto-ends the socket's writable side; Node 18's
|
|
12
|
+
// Duplex.toWeb then errors the Web writer before channel.close().
|
|
13
|
+
const socket = createConnection({ host, port, noDelay: true, allowHalfOpen: true });
|
|
14
|
+
// Node 18's Duplex.toWeb waits for BOTH socket halves before reporting
|
|
15
|
+
// either EOF or write completion. Adapt them independently instead.
|
|
16
|
+
// The read iterator must not destroy the write side when it reaches EOF.
|
|
17
|
+
const readable = Readable.toWeb(Readable.from(socket.iterator({ destroyOnReturn: false }), { objectMode: false }));
|
|
18
|
+
const writable = new WritableStream({
|
|
19
|
+
start(controller) {
|
|
20
|
+
// Install stream error handlers before awaiting the connection.
|
|
21
|
+
socket.on("error", (error) => controller.error(error));
|
|
22
|
+
},
|
|
23
|
+
write(data) {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
socket.write(data, (error) => error ? reject(error) : resolve());
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
close() {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const cleanup = finished(socket, { readable: false }, (error) => {
|
|
31
|
+
cleanup();
|
|
32
|
+
error ? reject(error) : resolve();
|
|
33
|
+
});
|
|
34
|
+
socket.end();
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
abort() {
|
|
38
|
+
socket.destroy();
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
try {
|
|
42
|
+
await once(socket, "connect");
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
socket.destroy();
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
readable,
|
|
50
|
+
writable,
|
|
51
|
+
async close() {
|
|
52
|
+
if (socket.closed)
|
|
53
|
+
return;
|
|
54
|
+
const closed = new Promise((resolve) => socket.once("close", () => resolve()));
|
|
55
|
+
socket.destroy();
|
|
56
|
+
await closed;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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71,8 @@ export interface Prover {
|
|
|
71
71
|
* `wasm.prove` with the conversions applied (request/response `body` bytes,
|
|
72
72
|
* typed progress callback) and the returned wasm handle copied out and
|
|
73
73
|
* freed. Runs `initialize()` with defaults first if it was never called.
|
|
74
|
+
* `serverIo` may be a direct TCP channel or a WS-to-TCP proxy channel;
|
|
75
|
+
* either supplies raw bytes, with TLS performed inside the prover.
|
|
74
76
|
*/
|
|
75
77
|
prove(notaryIo: IoChannel, serverIo: IoChannel, config: IssuanceConfig, request: HttpRequest, progressCb?: ProgressCallback | null): Promise<ProveOutput>;
|
|
76
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover.d.ts","sourceRoot":"","sources":["../src/prover.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,WAAW,EAEX,SAAS,EACT,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACb,MAAM,YAAY,CAAC;AAQpB,uFAAuF;AACvF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;CAC7C;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IACjC,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AAC,EAAE,aAAa,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtF;;;;;;;;;OASG;IACH,KAAK,CACH,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,EACpB,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,GACnC,OAAO,CAAC,WAAW,CAAC,CAAC;IAExB;;;;;;;;;;OAUG;IACH,OAAO,CACL,gBAAgB,EAAE,UAAU,EAC5B,YAAY,EAAE,UAAU,EACxB,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,GAC3B,UAAU,CAAC;CACf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAE3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover.js","sourceRoot":"","sources":["../src/prover.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,oDAAoD;AACpD,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,kEAAkE;AAClE,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,4EAA4E;AAC5E,uEAAuE;AACvE,kDAAkD;AAClD,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,2DAA2D;
|
|
1
|
+
{"version":3,"file":"prover.js","sourceRoot":"","sources":["../src/prover.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,oDAAoD;AACpD,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,kE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E,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IoChannel } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* An established raw TCP socket supplied by the host (Node, Electron, or a
|
|
4
|
+
* native bridge). No TLS or WebSocket framing: the prover owns TLS.
|
|
5
|
+
* Both streams must be unlocked, binary, and propagate socket errors.
|
|
6
|
+
*/
|
|
7
|
+
export interface TcpSocket {
|
|
8
|
+
readable: {
|
|
9
|
+
getReader(): ReadableStreamDefaultReader<Uint8Array>;
|
|
10
|
+
};
|
|
11
|
+
writable: {
|
|
12
|
+
getWriter(): WritableStreamDefaultWriter<Uint8Array>;
|
|
13
|
+
};
|
|
14
|
+
/** Release the socket, including its read side. Must unblock pending reads. */
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface TcpConnectOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Resolve only once connected, with TCP_NODELAY enabled. The host owns DNS,
|
|
20
|
+
* permissions, connection timeouts, and cleanup if connecting fails.
|
|
21
|
+
*/
|
|
22
|
+
connect(host: string, port: number): Promise<TcpSocket>;
|
|
23
|
+
}
|
|
24
|
+
/** A host TCP socket adapted to the same IoChannel accepted by prove(). */
|
|
25
|
+
export declare class TcpIoChannel implements IoChannel {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(socket: TcpSocket);
|
|
28
|
+
read(): Promise<Uint8Array | null>;
|
|
29
|
+
write(data: Uint8Array): Promise<void>;
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Open a direct TCP target channel through a host connector. Ordinary browser
|
|
34
|
+
* pages need connectProxy; Node users can import connectTcp from the /node
|
|
35
|
+
* entry point, which supplies the connector.
|
|
36
|
+
*/
|
|
37
|
+
export declare function connectTcp(host: string, port: number, opts: TcpConnectOptions): Promise<TcpIoChannel>;
|
|
38
|
+
//# sourceMappingURL=tcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tcp.d.ts","sourceRoot":"","sources":["../src/tcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IAGxB,QAAQ,EAAE;QAAE,SAAS,IAAI,2BAA2B,CAAC,UAAU,CAAC,CAAA;KAAE,CAAC;IACnE,QAAQ,EAAE;QAAE,SAAS,IAAI,2BAA2B,CAAC,UAAU,CAAC,CAAA;KAAE,CAAC;IACnE,+EAA+E;IAC/E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACzD;AAED,2EAA2E;AAC3E,qBAAa,YAAa,YAAW,SAAS;;IAO5C,YAAY,MAAM,EAAE,SAAS,EAa5B;IAEK,IAAI,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAQvC;IAEK,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3C;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CASrB;CAgBF;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,YAAY,CAAC,CAWvB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** A host TCP socket adapted to the same IoChannel accepted by prove(). */
|
|
2
|
+
export class TcpIoChannel {
|
|
3
|
+
#socket;
|
|
4
|
+
#reader;
|
|
5
|
+
#writer;
|
|
6
|
+
#closePromise;
|
|
7
|
+
#writeEnded = false;
|
|
8
|
+
constructor(socket) {
|
|
9
|
+
this.#socket = socket;
|
|
10
|
+
this.#reader = socket.readable.getReader();
|
|
11
|
+
try {
|
|
12
|
+
this.#writer = socket.writable.getWriter();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
this.#reader.releaseLock();
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
// Stream errors are surfaced by read/write/close, even when they arrive
|
|
19
|
+
// while WASM is busy doing MPC computation and no operation is pending.
|
|
20
|
+
this.#reader.closed.catch(() => { });
|
|
21
|
+
this.#writer.closed.then(() => { this.#writeEnded = true; }, () => { });
|
|
22
|
+
}
|
|
23
|
+
async read() {
|
|
24
|
+
if (this.#closePromise)
|
|
25
|
+
return null;
|
|
26
|
+
for (;;) {
|
|
27
|
+
const { value, done } = await this.#reader.read();
|
|
28
|
+
if (done)
|
|
29
|
+
return null;
|
|
30
|
+
// Rust treats an empty chunk as EOF; only an actual stream end is EOF.
|
|
31
|
+
if (value.byteLength !== 0)
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async write(data) {
|
|
36
|
+
if (this.#closePromise)
|
|
37
|
+
throw new Error("cannot write: TCP channel is closed");
|
|
38
|
+
// Own the bytes before yielding. WASM may reuse its shared memory and a
|
|
39
|
+
// Node Buffer's slice() would only create another view of the same bytes.
|
|
40
|
+
await this.#writer.write(new Uint8Array(data));
|
|
41
|
+
}
|
|
42
|
+
close() {
|
|
43
|
+
if (!this.#closePromise) {
|
|
44
|
+
this.#closePromise = this.#close();
|
|
45
|
+
// JsIoAdapter currently starts close without awaiting its promise.
|
|
46
|
+
// Prevent an unhandled rejection there; explicit callers still receive
|
|
47
|
+
// the original rejected promise and can observe cleanup failures.
|
|
48
|
+
this.#closePromise.catch(() => { });
|
|
49
|
+
}
|
|
50
|
+
return this.#closePromise;
|
|
51
|
+
}
|
|
52
|
+
async #close() {
|
|
53
|
+
try {
|
|
54
|
+
// Web Streams serializes this after all accepted writes.
|
|
55
|
+
if (!this.#writeEnded)
|
|
56
|
+
await this.#writer.close();
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
try {
|
|
60
|
+
await this.#socket.close();
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
await this.#reader.cancel().catch(() => { });
|
|
64
|
+
this.#reader.releaseLock();
|
|
65
|
+
this.#writer.releaseLock();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Open a direct TCP target channel through a host connector. Ordinary browser
|
|
72
|
+
* pages need connectProxy; Node users can import connectTcp from the /node
|
|
73
|
+
* entry point, which supplies the connector.
|
|
74
|
+
*/
|
|
75
|
+
export async function connectTcp(host, port, opts) {
|
|
76
|
+
if (!host || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
77
|
+
throw new Error("TCP destination requires a host and a port between 1 and 65535");
|
|
78
|
+
}
|
|
79
|
+
const socket = await opts.connect(host, port);
|
|
80
|
+
try {
|
|
81
|
+
return new TcpIoChannel(socket);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
await socket.close().catch(() => { });
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=tcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tcp.js","sourceRoot":"","sources":["../src/tcp.ts"],"names":[],"mappings":"AAwBA,2EAA2E;AAC3E,MAAM,OAAO,YAAY;IACd,OAAO,CAAY;IACnB,OAAO,CAA0C;IACjD,OAAO,CAA0C;IAC1D,aAAa,CAAiB;IAC9B,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,MAAiB;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;QAC3C,IAAI,CAAC;YACH,IAAI,CAAC,OAAO,GAAG,M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CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The duplex byte channel `prove()` drives. Mirrors the `IoChannel`
|
|
3
3
|
* `typescript_custom_section` in `client-wasm/src/io.rs` (asserted identical
|
|
4
|
-
* in `wasm-compat.ts`); implemented by `WsIoChannel`.
|
|
4
|
+
* in `wasm-compat.ts`); implemented by `WsIoChannel` and `TcpIoChannel`.
|
|
5
5
|
*/
|
|
6
6
|
export interface IoChannel {
|
|
7
7
|
/** Next inbound chunk, or `null` on EOF (Rust maps it to `Ok(0)`). */
|
package/transport/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "client-wasm-transport",
|
|
3
3
|
"version": "0.2.0",
|
|
4
|
-
"description": "WebSocket
|
|
4
|
+
"description": "WebSocket and direct TCP transports + injection-based prover façade for client-wasm.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./node": {
|
|
14
|
+
"types": "./dist/node.d.ts",
|
|
15
|
+
"default": "./dist/node.js"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"files": [
|
|
@@ -19,10 +23,12 @@
|
|
|
19
23
|
"scripts": {
|
|
20
24
|
"build": "tsc -p tsconfig.json",
|
|
21
25
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
26
|
+
"test": "npm run build && node --test test/*.test.mjs",
|
|
22
27
|
"clean": "rm -rf dist"
|
|
23
28
|
},
|
|
24
29
|
"sideEffects": false,
|
|
25
30
|
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.0.0",
|
|
26
32
|
"typescript": ">=5.6.0"
|
|
27
33
|
}
|
|
28
34
|
}
|