@dmarket/p2p-tracker-core 0.1.0-SNAPSHOT.99 → 1.0.1-beta

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.
Files changed (66) hide show
  1. package/VERSION +14 -0
  2. package/dmarket-p2p-tracker-core-domain.mjs +11510 -4975
  3. package/dmarket-p2p-tracker-core-domain.mjs.map +1 -1
  4. package/kotlin-kotlin-stdlib.mjs +3168 -2664
  5. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  6. package/kotlinx-atomicfu.mjs +13 -13
  7. package/kotlinx-coroutines-core.mjs +2758 -2428
  8. package/kotlinx-coroutines-core.mjs.map +1 -1
  9. package/kotlinx-io-kotlinx-io-bytestring.mjs +44 -44
  10. package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
  11. package/kotlinx-io-kotlinx-io-core.mjs +517 -497
  12. package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
  13. package/kotlinx-serialization-kotlinx-serialization-core.mjs +1791 -1790
  14. package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
  15. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1586 -1564
  16. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  17. package/ktor-ktor-client-core.mjs +3047 -3048
  18. package/ktor-ktor-client-core.mjs.map +1 -1
  19. package/ktor-ktor-events.mjs +6 -6
  20. package/ktor-ktor-http-cio.mjs +491 -491
  21. package/ktor-ktor-http.mjs +666 -646
  22. package/ktor-ktor-http.mjs.map +1 -1
  23. package/ktor-ktor-io.mjs +1145 -1059
  24. package/ktor-ktor-io.mjs.map +1 -1
  25. package/ktor-ktor-utils.mjs +794 -786
  26. package/ktor-ktor-utils.mjs.map +1 -1
  27. package/ktor-ktor-websockets.mjs +855 -799
  28. package/ktor-ktor-websockets.mjs.map +1 -1
  29. package/p2p-tracker-core.d.mts +110 -40
  30. package/p2p-tracker-core.mjs +28378 -11117
  31. package/p2p-tracker-core.mjs.map +1 -1
  32. package/package.json +2 -4
  33. package/pkg/README.md +92 -0
  34. package/pkg/client_wasm.d.ts +312 -0
  35. package/pkg/client_wasm.js +1187 -0
  36. package/pkg/client_wasm_bg.wasm +0 -0
  37. package/pkg/client_wasm_bg.wasm.d.ts +32 -0
  38. package/pkg/package.json +19 -0
  39. package/pkg/snippets/web-spawn-05868593a72e2d44/js/spawn.js +73 -0
  40. package/pkg/spawn.js +73 -0
  41. package/transport/README.md +172 -0
  42. package/transport/dist/channel.d.ts +48 -0
  43. package/transport/dist/channel.d.ts.map +1 -0
  44. package/transport/dist/channel.js +150 -0
  45. package/transport/dist/channel.js.map +1 -0
  46. package/transport/dist/index.d.ts +8 -0
  47. package/transport/dist/index.d.ts.map +1 -0
  48. package/transport/dist/index.js +18 -0
  49. package/transport/dist/index.js.map +1 -0
  50. package/transport/dist/prover.d.ts +103 -0
  51. package/transport/dist/prover.d.ts.map +1 -0
  52. package/transport/dist/prover.js +139 -0
  53. package/transport/dist/prover.js.map +1 -0
  54. package/transport/dist/transport.d.ts +31 -0
  55. package/transport/dist/transport.d.ts.map +1 -0
  56. package/transport/dist/transport.js +75 -0
  57. package/transport/dist/transport.js.map +1 -0
  58. package/transport/dist/types.d.ts +162 -0
  59. package/transport/dist/types.d.ts.map +1 -0
  60. package/transport/dist/types.js +21 -0
  61. package/transport/dist/types.js.map +1 -0
  62. package/transport/dist/wasm-compat.d.ts +2 -0
  63. package/transport/dist/wasm-compat.d.ts.map +1 -0
  64. package/transport/dist/wasm-compat.js +15 -0
  65. package/transport/dist/wasm-compat.js.map +1 -0
  66. package/transport/package.json +28 -0
@@ -0,0 +1,103 @@
1
+ import type { HttpRequest, IoChannel, IssuanceConfig, LoggingConfig, LoggingLevel, CrateLogFilter, ProgressCallback, ProveOutput, RevealPolicy } from "./types.js";
2
+ /** Wire shape of the generated `LoggingConfig` (required-but-nullable, snake_case). */
3
+ export interface WasmLoggingConfig {
4
+ level: LoggingLevel | undefined;
5
+ crate_filters: CrateLogFilter[] | undefined;
6
+ }
7
+ /** Wire shape of the generated `HttpRequest` (`body` is tsify `number[]`). */
8
+ export interface WasmHttpRequest {
9
+ method: string;
10
+ uri: string;
11
+ headers?: [string, string][];
12
+ body?: number[];
13
+ }
14
+ /** Wire shape of the generated `HttpResponse` (`body` is tsify `number[]`). */
15
+ export interface WasmHttpResponse {
16
+ status: number;
17
+ headers: [string, string][];
18
+ body: number[];
19
+ }
20
+ /**
21
+ * The members of the generated `ProveOutput` class the façade reads. The
22
+ * getters copy out of wasm memory, so after reading all three the handle is
23
+ * `free()`d eagerly rather than left to `[Symbol.dispose]`.
24
+ */
25
+ export interface WasmProveOutput {
26
+ readonly attestation: Uint8Array;
27
+ readonly secrets: Uint8Array;
28
+ readonly response: WasmHttpResponse;
29
+ free(): void;
30
+ }
31
+ /**
32
+ * The subset of the generated wasm module `createProver` drives — exactly
33
+ * what `import * as wasm from ".../pkg/client_wasm.js"` provides
34
+ * (`wasm-compat.ts` asserts the generated module satisfies this). The
35
+ * web-spawn glue (`startSpawner`, `web_spawn_*`) is deliberately not part of
36
+ * the contract: it is called by the pkg's own worker snippet through the
37
+ * pkg's module identity and is meaningless behind a façade (journal 21).
38
+ */
39
+ export interface ClientWasmModule {
40
+ /**
41
+ * wasm-pack `--target web`'s default-export `init` (`__wbg_init`): fetches
42
+ * and instantiates the `.wasm` relative to the pkg module. Optional so a
43
+ * pre-instantiated or hand-assembled module can be injected; when present,
44
+ * the façade calls it (once) before anything else.
45
+ */
46
+ default?: () => Promise<unknown>;
47
+ initialize(loggingConfig: WasmLoggingConfig | null | undefined, threadCount: number): Promise<void>;
48
+ prove(notaryIo: IoChannel, serverIo: IoChannel, config: IssuanceConfig, request: WasmHttpRequest, progressCb?: ProgressCallback | null): Promise<WasmProveOutput>;
49
+ present(attestationBytes: Uint8Array, secretsBytes: Uint8Array, policy?: RevealPolicy | null): Uint8Array;
50
+ }
51
+ /**
52
+ * The pass-through prover surface: the wasm API's three calls with the same
53
+ * shapes, minus the setup and wire warts (see each method).
54
+ */
55
+ export interface Prover {
56
+ /**
57
+ * One-time setup: instantiates the wasm module (the pkg's default `init()`,
58
+ * if the injected module carries one) and starts logging + the rayon thread
59
+ * pool (`wasm.initialize`). Idempotent — concurrent and repeat calls share
60
+ * one underlying run; arguments of later calls are ignored. On failure the
61
+ * memo is released so a genuine retry (e.g. after fixing COOP/COEP) re-runs.
62
+ *
63
+ * `threadCount` defaults to `navigator.hardwareConcurrency` clamped to
64
+ * [1, 8] (8 is the extension harness default).
65
+ */
66
+ initialize(loggingConfig?: LoggingConfig | null, threadCount?: number): Promise<void>;
67
+ /**
68
+ * One full issuance over the two injected IO channels — MPC-TLS with the
69
+ * notary over `notaryIo`, the single HTTP exchange with the target over
70
+ * `serverIo` — yielding the notary-signed attestation. Pass-through to
71
+ * `wasm.prove` with the conversions applied (request/response `body` bytes,
72
+ * typed progress callback) and the returned wasm handle copied out and
73
+ * freed. Runs `initialize()` with defaults first if it was never called.
74
+ */
75
+ prove(notaryIo: IoChannel, serverIo: IoChannel, config: IssuanceConfig, request: HttpRequest, progressCb?: ProgressCallback | null): Promise<ProveOutput>;
76
+ /**
77
+ * Builds a verifiable `Presentation` from a persisted
78
+ * `(attestation, secrets)` pair, revealing exactly what `policy` permits —
79
+ * pass-through to `wasm.present`. Offline (no notary, no network, no rayon
80
+ * pool), but the wasm module must be *instantiated*: await `initialize()`
81
+ * (or a `prove()`) once beforehand, or instantiate the pkg yourself before
82
+ * injecting it. When `policy` is omitted the wasm side applies
83
+ * `client_core::HttpRevealPolicy::default` — it redacts the
84
+ * `authorization` / `cookie` / `user-agent` header values but **reveals the
85
+ * request target (path+query)**; supply an explicit policy to withhold it.
86
+ */
87
+ present(attestationBytes: Uint8Array, secretsBytes: Uint8Array, policy?: RevealPolicy | null): Uint8Array;
88
+ }
89
+ /**
90
+ * Wraps an injected `client-wasm` pkg module in the pass-through `Prover`
91
+ * façade. The caller keeps ownership of the import — typically
92
+ * `import * as wasm from "./pkg/client_wasm.js"` kept `--external` in the
93
+ * bundle — and hands it in:
94
+ *
95
+ * ```ts
96
+ * import * as wasm from "./pkg/client_wasm.js"; // loose, external
97
+ * import { createProver } from "client-wasm-transport";
98
+ *
99
+ * const prover = createProver(wasm);
100
+ * ```
101
+ */
102
+ export declare function createProver(wasm: ClientWasmModule): Prover;
103
+ //# sourceMappingURL=prover.d.ts.map
@@ -0,0 +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,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;;;;;GAOG;AACH,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// `createProver(wasm)` mirrors the wasm API surface — `initialize` / `prove` /
4
+ // `present`, same call shapes — while owning the setup the raw pkg leaves to
5
+ // the caller (module instantiation via the default-export `init()`, then the
6
+ // rayon-pool `initialize()`) and absorbing the wire conversions (tsify
7
+ // `number[]` bodies ↔ `Uint8Array`, the `crate_filters` snake_case wart, the
8
+ // disposable `ProveOutput` class → a plain object).
9
+ //
10
+ // **Why injection instead of `import ... from "client-wasm"`:** this package
11
+ // is inlined by the extension bundle while the wasm-pack `pkg/` must stay
12
+ // loose (its rayon spawner does `new Worker(new URL("./spawn.js",
13
+ // import.meta.url))` and fetches the `.wasm` via `import.meta.url` — inlining
14
+ // 404s both, and `--external:./pkg/*` cannot catch a bare specifier). A value
15
+ // re-export here would therefore either tree-shake away the instantiation
16
+ // chain (green build, dead API) or double-instantiate the module. Measured in
17
+ // branch journal entries 20/21; the caller passing in its own pkg import is
18
+ // the only shape that keeps `sideEffects: false` honest, the transport
19
+ // inlinable, and the wasm module single-instance.
20
+ //
21
+ // Because the *module namespace itself* is injected, its `import.meta.url`
22
+ // semantics are untouched: calling `wasm.default()` from here still resolves
23
+ // `client_wasm_bg.wasm` (and the worker `spawn.js`) relative to the loose
24
+ // `pkg/`, so the façade can safely own the init lifecycle.
25
+ /**
26
+ * Wraps an injected `client-wasm` pkg module in the pass-through `Prover`
27
+ * façade. The caller keeps ownership of the import — typically
28
+ * `import * as wasm from "./pkg/client_wasm.js"` kept `--external` in the
29
+ * bundle — and hands it in:
30
+ *
31
+ * ```ts
32
+ * import * as wasm from "./pkg/client_wasm.js"; // loose, external
33
+ * import { createProver } from "client-wasm-transport";
34
+ *
35
+ * const prover = createProver(wasm);
36
+ * ```
37
+ */
38
+ export function createProver(wasm) {
39
+ return new WasmProver(wasm);
40
+ }
41
+ class WasmProver {
42
+ #wasm;
43
+ /** Memoized `wasm.default()` (module instantiation); cleared on failure. */
44
+ #instantiation = null;
45
+ /** True once instantiation has resolved — used only to enrich `present` errors. */
46
+ #instantiated = false;
47
+ /** Memoized full `initialize()` run; cleared on failure so a retry re-runs. */
48
+ #initialized = null;
49
+ constructor(wasm) {
50
+ this.#wasm = wasm;
51
+ }
52
+ initialize(loggingConfig, threadCount) {
53
+ this.#initialized ??= this.#runInitialize(loggingConfig, threadCount);
54
+ return this.#initialized;
55
+ }
56
+ async prove(notaryIo, serverIo, config, request, progressCb) {
57
+ await this.initialize();
58
+ const out = await this.#wasm.prove(notaryIo, serverIo, config, toWireRequest(request), progressCb ?? null);
59
+ try {
60
+ return {
61
+ attestation: out.attestation,
62
+ secrets: out.secrets,
63
+ response: fromWireResponse(out.response),
64
+ };
65
+ }
66
+ finally {
67
+ out.free();
68
+ }
69
+ }
70
+ present(attestationBytes, secretsBytes, policy) {
71
+ try {
72
+ return this.#wasm.present(attestationBytes, secretsBytes, policy ?? null);
73
+ }
74
+ catch (cause) {
75
+ // An un-instantiated module fails with a TypeError on the pkg's
76
+ // module-level `wasm` binding — turn that into an actionable message.
77
+ // (If the caller instantiated the pkg itself, #instantiated is false
78
+ // but present() simply succeeds, so this never misfires on real
79
+ // presentation errors — those are not TypeErrors.)
80
+ if (!this.#instantiated && cause instanceof TypeError) {
81
+ throw new Error("present() called before the wasm module was instantiated — " +
82
+ "await prover.initialize() (or a prove()) once first", { cause });
83
+ }
84
+ throw cause;
85
+ }
86
+ }
87
+ async #runInitialize(loggingConfig, threadCount) {
88
+ try {
89
+ await this.#ensureInstantiated();
90
+ await this.#wasm.initialize(toWireLogging(loggingConfig), threadCount ?? defaultThreadCount());
91
+ }
92
+ catch (err) {
93
+ // Release the memo: wasm-side initialize releases its one-time claim on
94
+ // failure precisely so a retry can proceed — mirror that here.
95
+ this.#initialized = null;
96
+ throw err;
97
+ }
98
+ }
99
+ async #ensureInstantiated() {
100
+ // `init()` is idempotent in the generated glue, but memoize anyway so an
101
+ // injected module without the guard (or a hand-built one) is safe too.
102
+ this.#instantiation ??= this.#wasm.default?.() ?? Promise.resolve();
103
+ try {
104
+ await this.#instantiation;
105
+ }
106
+ catch (err) {
107
+ this.#instantiation = null; // e.g. the .wasm fetch failed — allow retry
108
+ throw err;
109
+ }
110
+ this.#instantiated = true;
111
+ }
112
+ }
113
+ // --- Conversions ----------------------------------------------------------------
114
+ function toWireLogging(config) {
115
+ if (config == null)
116
+ return null;
117
+ return { level: config.level, crate_filters: config.crateFilters };
118
+ }
119
+ function toWireRequest(request) {
120
+ const wire = { method: request.method, uri: request.uri };
121
+ if (request.headers !== undefined)
122
+ wire.headers = request.headers;
123
+ // Always hand serde a plain number[] — tsify renders `Vec<u8>` as number[],
124
+ // and a Uint8Array is not guaranteed to deserialize as one.
125
+ if (request.body !== undefined)
126
+ wire.body = Array.from(request.body);
127
+ return wire;
128
+ }
129
+ function fromWireResponse(wire) {
130
+ return { status: wire.status, headers: wire.headers, body: Uint8Array.from(wire.body) };
131
+ }
132
+ function defaultThreadCount() {
133
+ const n = globalThis.navigator
134
+ ?.hardwareConcurrency;
135
+ // Cap at 8 — the extension harness default (prover-worker.js): each rayon
136
+ // thread is a real web worker, and past ~8 the MPC gains nothing.
137
+ return typeof n === "number" && n >= 1 ? Math.min(Math.floor(n), 8) : 8;
138
+ }
139
+ //# sourceMappingURL=prover.js.map
@@ -0,0 +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;AA6I3D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,Y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AO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,aAAa,CAAC,OAAoB;IACzC,MAAM,IAAI,GAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAC3E,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAClE,4EAA4E;IAC5E,4DAA4D;IAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAsB;IAC9C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1F,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,CAAC,GAAI,UAA+D,CAAC,SAAS;QAClF,EAAE,mBAAmB,CAAC;IACxB,0EAA0E;IAC1E,kEAAkE;IAClE,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { WsIoChannel, type WebSocketCtor } from "./channel.js";
2
+ /**
3
+ * WebSocket subprotocol marker for the notary channel. **Must** match the
4
+ * notary's `transport::SUBPROTOCOL` and the native `ws.rs` `SUBPROTOCOL`
5
+ * (`tlsn.notary.v2`) — bump all three together on a contract change.
6
+ */
7
+ export declare const NOTARY_SUBPROTOCOL = "tlsn.notary.v2";
8
+ /** Shared options for the `connect*` helpers. */
9
+ export interface ConnectOptions {
10
+ /**
11
+ * `WebSocket` implementation to use. Defaults to the global browser
12
+ * `WebSocket`. Inject a polyfill (e.g. Node's `ws`) to run outside a browser.
13
+ */
14
+ WebSocketImpl?: WebSocketCtor;
15
+ }
16
+ /**
17
+ * Connect the notary channel, offering `tlsn.notary.v2, bearer.<token>` in
18
+ * `Sec-WebSocket-Protocol`, and resolve once the socket is open with the
19
+ * negotiated subprotocol confirmed to be `tlsn.notary.v2` (the notary echoes
20
+ * back only the marker, never the token).
21
+ */
22
+ export declare function connectNotary(url: string, token: string, opts?: ConnectOptions): Promise<WsIoChannel>;
23
+ /**
24
+ * Connect the target byte pipe through the `p2p-wss-proxy` worker: opens
25
+ * `ws://<proxyBase>/?host=<host>&port=<port>` (no subprotocol / auth — the proxy
26
+ * reads its target from the query string), and resolves once open. The worker
27
+ * opens a raw TCP socket to `host:port` and relays bytes; MPC-TLS then runs over
28
+ * this pipe inside `prove()`.
29
+ */
30
+ export declare function connectProxy(proxyBase: string, host: string, port: number, opts?: ConnectOptions): Promise<WsIoChannel>;
31
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAEnD,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAaD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,WAAW,CAAC,CAgBtB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,WAAW,CAAC,CAWtB"}
@@ -0,0 +1,75 @@
1
+ // WebSocket transport for the `client-wasm` browser-extension prover.
2
+ //
3
+ // Provides the two `IoChannel`s that `prove()` (see `client_wasm.d.ts`) needs,
4
+ // mirroring the native `connect_notary` / `connect_proxy` in
5
+ // `test-full-e2e/src/ws.rs`:
6
+ //
7
+ // - `connectNotary(url, token)` — the notary socket, authenticated via the
8
+ // `Sec-WebSocket-Protocol` bearer subprotocol (browsers can't set an
9
+ // `Authorization` header on a WS handshake — only subprotocols — so the
10
+ // contract carries the token this way; CLIENT_CONTRACT §2).
11
+ // - `connectProxy(proxyBase, host, port)` — the target byte pipe, tunnelled
12
+ // through the `p2p-wss-proxy` worker (a browser extension can't open raw
13
+ // TCP, so `serverIo` is WS → proxy → TCP; JOURNAL toplevel/06).
14
+ //
15
+ // Both return a `WsIoChannel` (see `./channel`) already open, so a bad handshake
16
+ // (auth failure, unreachable proxy) rejects here rather than surfacing later as
17
+ // a mid-MPC read error.
18
+ import { WsIoChannel } from "./channel.js";
19
+ /**
20
+ * WebSocket subprotocol marker for the notary channel. **Must** match the
21
+ * notary's `transport::SUBPROTOCOL` and the native `ws.rs` `SUBPROTOCOL`
22
+ * (`tlsn.notary.v2`) — bump all three together on a contract change.
23
+ */
24
+ export const NOTARY_SUBPROTOCOL = "tlsn.notary.v2";
25
+ function resolveWebSocket(opts) {
26
+ const impl = opts?.WebSocketImpl ?? globalThis.WebSocket;
27
+ if (!impl) {
28
+ throw new Error("no WebSocket implementation: not in a browser and none injected — " +
29
+ "pass { WebSocketImpl } (e.g. Node's `ws` package)");
30
+ }
31
+ return impl;
32
+ }
33
+ /**
34
+ * Connect the notary channel, offering `tlsn.notary.v2, bearer.<token>` in
35
+ * `Sec-WebSocket-Protocol`, and resolve once the socket is open with the
36
+ * negotiated subprotocol confirmed to be `tlsn.notary.v2` (the notary echoes
37
+ * back only the marker, never the token).
38
+ */
39
+ export async function connectNotary(url, token, opts) {
40
+ const WS = resolveWebSocket(opts);
41
+ const ws = new WS(url, [NOTARY_SUBPROTOCOL, `bearer.${token}`]);
42
+ const channel = new WsIoChannel(ws);
43
+ try {
44
+ await channel.whenReady();
45
+ }
46
+ catch (cause) {
47
+ throw new Error(`notary websocket handshake failed (auth?): ${url}`, { cause });
48
+ }
49
+ if (channel.protocol !== NOTARY_SUBPROTOCOL) {
50
+ await channel.close();
51
+ throw new Error(`notary negotiated an unexpected subprotocol: ${JSON.stringify(channel.protocol)}`);
52
+ }
53
+ return channel;
54
+ }
55
+ /**
56
+ * Connect the target byte pipe through the `p2p-wss-proxy` worker: opens
57
+ * `ws://<proxyBase>/?host=<host>&port=<port>` (no subprotocol / auth — the proxy
58
+ * reads its target from the query string), and resolves once open. The worker
59
+ * opens a raw TCP socket to `host:port` and relays bytes; MPC-TLS then runs over
60
+ * this pipe inside `prove()`.
61
+ */
62
+ export async function connectProxy(proxyBase, host, port, opts) {
63
+ const WS = resolveWebSocket(opts);
64
+ const url = `${proxyBase.replace(/\/+$/, "")}/?host=${encodeURIComponent(host)}&port=${port}`;
65
+ const ws = new WS(url);
66
+ const channel = new WsIoChannel(ws);
67
+ try {
68
+ await channel.whenReady();
69
+ }
70
+ catch (cause) {
71
+ throw new Error(`proxy websocket handshake failed: ${url}`, { cause });
72
+ }
73
+ return channel;
74
+ }
75
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,+EAA+E;AAC/E,6DAA6D;AAC7D,6BAA6B;AAC7B,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AA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CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,SAAiB,EACjB,IAAY,EACZ,IAAY,EACZ,IAAqB;IAErB,MAAM,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,kBAAkB,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IAC9F,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * The duplex byte channel `prove()` drives. Mirrors the `IoChannel`
3
+ * `typescript_custom_section` in `client-wasm/src/io.rs` (asserted identical
4
+ * in `wasm-compat.ts`); implemented by `WsIoChannel`.
5
+ */
6
+ export interface IoChannel {
7
+ /** Next inbound chunk, or `null` on EOF (Rust maps it to `Ok(0)`). */
8
+ read(): Promise<Uint8Array | null>;
9
+ write(data: Uint8Array): Promise<void>;
10
+ close(): Promise<void>;
11
+ }
12
+ /** Verbosity level for a subscriber or a per-crate filter. */
13
+ export type LoggingLevel = "Off" | "Trace" | "Debug" | "Info" | "Warn" | "Error";
14
+ /** A per-crate (per-`target`) level override. */
15
+ export interface CrateLogFilter {
16
+ level: LoggingLevel;
17
+ name: string;
18
+ }
19
+ /**
20
+ * Logging options for `Prover.initialize`. Façade shape: both fields are
21
+ * truly optional (the generated `LoggingConfig` marks them required-but-
22
+ * nullable), and `crateFilters` is camelCase — the wasm wire field is
23
+ * `crate_filters`, the one snake_case field in the whole generated surface
24
+ * (`client-wasm/src/log.rs` lacks `rename_all = "camelCase"`; journal 21).
25
+ * `createProver` converts.
26
+ */
27
+ export interface LoggingConfig {
28
+ /** Default level applied to all targets. Defaults to `Info`. */
29
+ level?: LoggingLevel;
30
+ /** Optional per-crate (target-prefix) overrides. */
31
+ crateFilters?: CrateLogFilter[];
32
+ }
33
+ /**
34
+ * One-variant helper so the untagged `RootStore` union renders the bare
35
+ * string `"mozilla"` (see `client-wasm/src/types.rs`).
36
+ */
37
+ export type RootStorePreset = "mozilla";
38
+ /**
39
+ * Where to anchor the target server's certificate chain. `"mozilla"` (and an
40
+ * absent `rootStore`) keeps the `client_core` default (the Mozilla public-
41
+ * web-PKI set); `{ pem }` supplies a custom CA bundle for test fixtures or
42
+ * private endpoints.
43
+ */
44
+ export type RootStore = RootStorePreset | {
45
+ pem: string;
46
+ };
47
+ /**
48
+ * The issuance configuration (the locked OQ-D surface). Omitted caps keep the
49
+ * `client_core` contract defaults; omitted `rootStore` keeps the Mozilla
50
+ * roots. Identical to the generated `IssuanceConfig` — passed through as-is.
51
+ */
52
+ export interface IssuanceConfig {
53
+ serverName: string;
54
+ maxSentData?: number;
55
+ /** Optional sent application-data record budget. */
56
+ maxSentRecords?: number;
57
+ /** Response bytes preprocessed for online decryption (default: 2 KiB). */
58
+ maxRecvDataOnline?: number;
59
+ /** Optional received application-data record budget for online decryption. */
60
+ maxRecvRecordsOnline?: number;
61
+ maxRecvData?: number;
62
+ rootStore?: RootStore;
63
+ }
64
+ /**
65
+ * The HTTP request to prove. Protocol-load-bearing headers (`Host`,
66
+ * `Accept-Encoding: identity`, `Connection: close`) are injected by
67
+ * `client_core::issue`; caller `headers` merge on top.
68
+ *
69
+ * Façade shape: `body` also accepts a `Uint8Array` — the wasm wire type is
70
+ * `number[]` (tsify's `Vec<u8>` rendering); `createProver` converts.
71
+ */
72
+ export interface HttpRequest {
73
+ method: string;
74
+ uri: string;
75
+ headers?: [string, string][];
76
+ body?: Uint8Array | number[];
77
+ }
78
+ /**
79
+ * The target's HTTP response, captured during issuance and returned for
80
+ * convenience (the cryptographic material is the attestation/secrets blobs,
81
+ * not this).
82
+ *
83
+ * Façade shape: `body` is a `Uint8Array` — the wasm wire type is `number[]`
84
+ * (tsify's `Vec<u8>` rendering); `createProver` converts.
85
+ */
86
+ export interface HttpResponse {
87
+ status: number;
88
+ headers: [string, string][];
89
+ body: Uint8Array;
90
+ }
91
+ /**
92
+ * How much of the response body to reveal in a presentation.
93
+ * `"all" | "none" | { jsonPaths: [...] }`. Identical to the generated type.
94
+ *
95
+ * `jsonPaths` reveals each selected field **with the key path that names it**
96
+ * (plus the enclosing braces and commas), not just the value — a value on its
97
+ * own proves those bytes were in the authenticated response, but nothing ties
98
+ * them to the field they came from. Two things to plan for: the revealed body
99
+ * is **not** directly `JSON.parse`-able, because hidden siblings come back as
100
+ * `'#'` sentinel runs (the structure is recoverable — commas and braces are
101
+ * revealed — but the bytes are not JSON); and a path that indexes into an
102
+ * array, e.g. `"favoriteColors.0"`, reveals the **whole array**, because the
103
+ * notary never commits array elements individually so an element cannot be
104
+ * proven on its own.
105
+ */
106
+ export type BodyReveal = "all" | "none" | {
107
+ jsonPaths: string[];
108
+ };
109
+ /**
110
+ * The selective-disclosure policy for `present`. Identical to the generated
111
+ * type, **all fields required** by design: a silently-empty
112
+ * `redactRequestHeaderValues` would leak `authorization` / `cookie` /
113
+ * `user-agent`, so a caller who supplies a policy supplies it fully. Omitting
114
+ * the whole policy falls back to `client_core::HttpRevealPolicy::default`,
115
+ * which redacts those three header values — but note it also keeps
116
+ * `revealRequestTarget: true`, i.e. **the default reveals the request
117
+ * path+query**; pass an explicit policy with `revealRequestTarget: false` to
118
+ * withhold a credential-bearing query string.
119
+ */
120
+ export interface RevealPolicy {
121
+ redactRequestHeaderValues: string[];
122
+ revealRequestTarget: boolean;
123
+ revealResponseHeaders: boolean;
124
+ revealResponseBody: BodyReveal;
125
+ }
126
+ /**
127
+ * The successful result of `Prover.prove`: the two opaque `postcard` blobs to
128
+ * persist **together** — later handed to `present` — plus the target's HTTP
129
+ * response.
130
+ *
131
+ * Façade shape: a plain object, not the wasm `ProveOutput` class. The façade
132
+ * copies the fields out and `free()`s the wasm-side handle, so callers get no
133
+ * `free()` / `[Symbol.dispose]()` obligation (and no `ESNext.Disposable` lib
134
+ * requirement — journal 21).
135
+ */
136
+ export interface ProveOutput {
137
+ /** The notary-signed attestation, `postcard`-encoded. */
138
+ attestation: Uint8Array;
139
+ /** The connection secrets, `postcard`-encoded. Persist alongside `attestation`. */
140
+ secrets: Uint8Array;
141
+ /** The target's HTTP response observed during issuance (convenience only). */
142
+ response: HttpResponse;
143
+ }
144
+ /**
145
+ * The progress event delivered to `prove`'s progress callback. Shape mirrors
146
+ * the Rust `emit_progress` in `client-wasm/src/lib.rs` — `step` / `progress`
147
+ * come from `client_core::ProgressStage` (stable across bindings); `message`
148
+ * is wasm-side UI copy; `source` is always `"wasm"`.
149
+ */
150
+ export interface ProveProgress {
151
+ /** Stable stage id, e.g. `"mpc_setup"`, `"reveal"`, `"finalized"`. */
152
+ step: string;
153
+ /** Nominal completion in `[0, 1]`. */
154
+ progress: number;
155
+ /** Human-readable status line for the current stage. */
156
+ message: string;
157
+ /** Always `"wasm"` (distinguishes wasm-emitted events from host-side ones). */
158
+ source: "wasm";
159
+ }
160
+ /** A `prove()` progress callback (the generated signature types it `Function`). */
161
+ export type ProgressCallback = (event: ProveProgress) => void;
162
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,sEAAsE;IACtE,IAAI,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,O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IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAElE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,yBAAyB,EAAE,MAAM,EAAE,CAAC;IACpC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kBAAkB,EAAE,UAAU,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,WAAW,EAAE,UAAU,CAAC;IACxB,mFAAmF;IACnF,OAAO,EAAE,UAAU,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mFAAmF;AACnF,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC"}
@@ -0,0 +1,21 @@
1
+ // Public DTO types for the `client-wasm` prover façade.
2
+ //
3
+ // These are declared *locally* (not re-exported from the generated
4
+ // `pkg/client_wasm.d.ts`) so the emitted `dist/*.d.ts` is self-contained: a
5
+ // value or type re-export `from "client-wasm"` would ship a dangling module
6
+ // reference no consumer can resolve (the pkg is unpublished — branch journal
7
+ // entry 21 measured exactly that defect in the previous revision's dist).
8
+ //
9
+ // The single source of truth is still the Rust side (`client-wasm/src/io.rs`
10
+ // `typescript_custom_section` and `client-wasm/src/types.rs`): `wasm-compat.ts`
11
+ // asserts, at compile time, that every type here stays mutually assignable
12
+ // with its generated counterpart, so drift fails `npm run typecheck` instead
13
+ // of surfacing at runtime.
14
+ //
15
+ // Where a type here deliberately *differs* from the generated one, it is a
16
+ // façade conversion `createProver` performs (bytes as `Uint8Array` instead of
17
+ // tsify's `number[]` rendering of `Vec<u8>`; camelCase instead of the one
18
+ // snake_case wart; truly-optional instead of required-but-nullable). Those
19
+ // types are checked one-directionally or not at all — see `wasm-compat.ts`.
20
+ export {};
21
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,mEAAmE;AACnE,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,2EAA2E;AAC3E,6EAA6E;AAC7E,2BAA2B;AAC3B,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=wasm-compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm-compat.d.ts","sourceRoot":"","sources":["../src/wasm-compat.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ // Compile-time drift alarm: asserts the locally-declared types in this
2
+ // package against the generated `pkg/client_wasm.d.ts` (resolved through the
3
+ // tsconfig `paths` alias — build `../pkg` first, see README).
4
+ //
5
+ // The package declares its DTOs locally so the emitted `dist/*.d.ts` is
6
+ // self-contained (a `from "client-wasm"` re-export would dangle for every
7
+ // consumer — journal 21). The single source of truth stays the Rust side;
8
+ // this file is what enforces it: if `client-wasm/src/{io,types,log}.rs`
9
+ // changes shape, `npm run typecheck` fails here instead of a caller failing
10
+ // at runtime.
11
+ //
12
+ // Everything below is type-level only — nothing survives into dist (the
13
+ // emitted .js is empty and the .d.ts is `export {};`).
14
+ export {};
15
+ //# sourceMappingURL=wasm-compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm-compat.js","sourceRoot":"","sources":["../src/wasm-compat.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,6EAA6E;AAC7E,8DAA8D;AAC9D,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,0EAA0E;AAC1E,wEAAwE;AACxE,4EAA4E;AAC5E,cAAc;AACd,EAAE;AACF,wEAAwE;AACxE,uDAAuD"}
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "client-wasm-transport",
3
+ "version": "0.2.0",
4
+ "description": "WebSocket IoChannel transport + injection-based pass-through prover façade for the client-wasm browser-extension prover.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "typecheck": "tsc -p tsconfig.json --noEmit",
22
+ "clean": "rm -rf dist"
23
+ },
24
+ "sideEffects": false,
25
+ "devDependencies": {
26
+ "typescript": ">=5.6.0"
27
+ }
28
+ }