@dmarket/steam-provenance
v1.2.0
Published
TLSNotary prover for Node, browser extensions, Android and iOS: threaded WASM and native C libraries with caller-owned transports.
Maintainers
Readme
client-wasm — browser-extension prover artifact
This tarball is built and published by the steam-provenance CI pipeline (job
build_wasm_client). It is the TLSNotary prover for the browser extension:
a multi-threaded wasm module plus a TypeScript WebSocket transport, built against
a specific dep/tlsn pin and a specific notary contract.
It replaces hand-vendoring a locally built pkg/. If you are reading this inside
a repo that also has a checked-in pkg/ built on somebody's laptop, that copy is
what this artifact exists to retire.
This file ships inside the tarball, so it always describes the bytes next to it. In the source repo it lives at
client-wasm/ARTIFACT_README.md.The same tarball is also published to npm as
@dmarket/steam-provenance, and there this file is the package's README. Everything below holds for both channels; what differs for npm is under npm channel below.
Contents
client-wasm-<DOCKER_VERSION>/
├── pkg/ wasm-pack output — STAYS LOOSE at runtime, do NOT inline
│ ├── client_wasm.js JS glue (the module you import)
│ ├── client_wasm_bg.wasm ~10 MB, multi-threaded
│ ├── client_wasm.d.ts TypeScript surface: initialize/prove/present + IoChannel
│ ├── client_wasm_bg.wasm.d.ts
│ ├── spawn.js rayon worker entry (import-patched copy)
│ ├── snippets/ web-spawn glue, also patched
│ ├── package.json
│ └── README.md the crate's own README
├── transport/ WebSocket transport + prover façade — MEANT to be inlined
│ ├── dist/ *.js, *.d.ts and source maps
│ ├── package.json client-wasm-transport
│ └── README.md
├── VERSION provenance manifest, shell-sourceable
├── SHA256SUMS over every file above
└── README.md this filepkg/ deliberately carries no .gitignore. wasm-pack writes one containing
a single *; it is stripped at packaging time because this directory is meant to
be vendored into a git repo, and a * ignore file inside a vendored directory
makes git silently ignore every file in it — the blob looks committed and isn't.
Download
Published as three separate artifacts, so integrity and provenance are readable without pulling ~2.6 MB:
| Artifact | Purpose |
| --- | --- |
| client-wasm-<DOCKER_VERSION>.tgz | the payload |
| client-wasm-<DOCKER_VERSION>.tgz.sha256 | transfer integrity |
| VERSION | provenance, byte-identical to the copy inside |
Prerequisite: a CircleCI API token with read access to
dmarket/steam-provenance, available in your CI as $CIRCLE_TOKEN.
Latest successful build on a branch
There is no mutable "latest" path in CircleCI artifact storage — nothing to
overwrite, so latest is not a stored alias. It is a resolution step you perform
at download time:
BASE=https://circleci.com/api/v1.1/project/github/dmarket/steam-provenance
# Resolve, then download preserving the published filename (see the note below).
URL=$(curl -sS -H "Circle-Token: $CIRCLE_TOKEN" \
"$BASE/latest/artifacts?branch=main&filter=successful" \
| jq -r '.[] | select(.path | endswith(".tgz")) | .url')
curl -sSL -H "Circle-Token: $CIRCLE_TOKEN" -O "$URL"
curl -sSL -H "Circle-Token: $CIRCLE_TOKEN" -O "$URL.sha256"filter=successful filters on job status. Because build_wasm_client gates
build_images, the latest successful one is the build the deployed notary was cut
alongside.
Keep the published filename.
-O, not-o client-wasm.tgz. The.sha256file names the tarball as published, sosha256sum -cfails on a renamed file with a confusing "No such file or directory".
API v1.1 is long-deprecated but has no v2 equivalent for "latest". If your org has it disabled, walk v2 in three calls instead:
# 1. newest pipeline on the branch -> its workflow -> the job's number
GET /api/v2/project/gh/dmarket/steam-provenance/pipeline?branch=main
GET /api/v2/workflow/{workflow_id}/job # find name == build_wasm_client
GET /api/v2/project/gh/dmarket/steam-provenance/{job_number}/artifactsTo pin an exact commit rather than tracking a branch, start the same walk from the pipeline for that SHA.
Retention is finite (org-configurable; CircleCI's default is 30 days). You can pin reproducibly only for as long as retention lasts. Long-term pinning needs a durable store — raise it with the steam-provenance maintainers rather than working around it.
Verify, then unpack
sha256sum -c client-wasm-*.tgz.sha256
tar -xzf client-wasm-*.tgz
( cd client-wasm-*/ && sha256sum -c SHA256SUMS )npm channel
The second way to get the same bytes: @dmarket/steam-provenance on npm. It is
not a second build. On every push CI restages the tarball above, as verified by
G1–G7, into an npm package and guards that package too: G8 checks the packed file
list against an allowlist, the checksums, the wasm hash, G3 again on the packed
wasm, and the package.json shape; G9 does an offline install plus an import
smoke under Node. Only an approved release branch publishes it. The CircleCI
artifact above stays available for every push, and nothing in its contract
changes. Use whichever channel suits your build, but take pkg/ and transport/
from the same one: G5 typechecks transport/ against that run's pkg/, so
the two are only known to agree as a pair from one CI run.
The package root is this tarball's root (pkg/, transport/, VERSION,
SHA256SUMS, this README) plus four npm-only files that SHA256SUMS does not
cover: package.json, CHANGELOG.md, LICENSE (MIT) and
THIRD_PARTY_NOTICES.md (third-party licence notices). Release process and
runbook: release/README.md in the source repo.
Install with an exact pin
npm install --save-exact @dmarket/steam-provenance@<version>"dependencies": { "@dmarket/steam-provenance": "0.1.0-SNAPSHOT.123" }No ^, no ~, no dist-tag as the spec. A range lets a routine npm install move
you to a prover built against a different dep/tlsn pin, and that fails at
runtime as opaque MPC/deserialization errors against the deployed notary, never
as a version error (see TLSN_SUBMODULE_SHA below). A caret does not even keep
you on one line here: ^0.1.0-SNAPSHOT.22 also matches every later
0.1.0-SNAPSHOT.<n>.
| dist-tag | Points at |
| --- | --- |
| snapshot | the newest x.y.z-SNAPSHOT.<n>: a build of one commit, with an explicit number or its commit count. No git tag, no Release |
| latest | the newest stable x.y.z[-pre], with git tag web-v<x.y.z> and a GitHub Release carrying its CHANGELOG.md section. Until the first stable release it may point at a snapshot |
Use the dist-tags to find a version (npm view @dmarket/steam-provenance
dist-tags), then pin what they resolve to. The npm version is the package's own
release line and does not identify a commit; see Correlation below.
pkg/: copy it out of node_modules, never import it by specifier
PKG_ROOT="$(node -p 'require("path").dirname(require.resolve("@dmarket/steam-provenance/package.json"))')"
rm -rf vendor/pkg && cp -R "$PKG_ROOT/pkg" vendor/pkgResolve the package root this way rather than hard-coding
node_modules/@dmarket/steam-provenance: hoisting, workspaces and pnpm all move
it. ./package.json is an explicit exports subpath, so the resolve works under
any Node resolver. From there pkg/ follows the pkg/ rules under Bundling
exactly: loose next to your bundle, --external:./pkg/*, and the single
import * as wasm from "./pkg/client_wasm.js" in your own code.
Do not import "@dmarket/steam-provenance/pkg/client_wasm.js", nor reach
pkg/ through any other bare specifier. exports deliberately has no ./pkg/*
subpath, so Node refuses that import with ERR_PACKAGE_PATH_NOT_EXPORTED. Any
workaround that does make a bare specifier reach pkg/ hands it to your bundler,
and the bundler inlines it: --external:./pkg/* does not match a bare specifier,
the import.meta.url-relative worker and .wasm URLs are rewritten, and the
result is the green build and dead prover described under Bundling.
transport/: import it from the package root
import { createProver, connectNotary, connectProxy } from "@dmarket/steam-provenance";
import * as wasm from "./pkg/client_wasm.js"; // the pkg/ you copied out
const prover = createProver(wasm);The root export (".", with its types) is transport/dist/index.js, the same
transport/dist/ the bundling section says to inline. It has no runtime edge to
pkg/, so inlining it from node_modules is safe.
Correlation and integrity
The commit is
gitHead. The installedpackage.json'sgitHeadequalsGIT_SHAin the package'sVERSION.npm view @dmarket/steam-provenance@<version> gitHeadanswers it without installing. Correlate to a notary image by that value, exactly as for the artifact. Never by the npm version, never byDOCKER_VERSION.The bytes are the artifact's. Every file the CI tarball carried is byte-identical in the package, so this passes on an installed copy:
( cd "$PKG_ROOT" && sha256sum -c SHA256SUMS )The npm
.tgzitself is a different container from the CI.tgzand does not match its.tgz.sha256; your lockfile'sintegritycovers the npm one.VERSIONis exported too:require.resolve("@dmarket/steam-provenance/VERSION")gives its path.
Bundling — the part that is easy to get silently wrong
The two directories have opposite roles. Getting this backwards produces a green build and a dead prover, with no error at either end.
pkg/ — copy out loose, mark external
esbuild … --external:./pkg/*It must not be inlined. Its rayon spawner does
new Worker(new URL("./spawn.js", import.meta.url)) and fetches the .wasm via
import.meta.url, and its worker threads load the JS glue by relative path.
Inlining rewrites exactly those paths. Copy pkg/ next to the bundle (the
extension vendors it at vendor/pkg/) and keep the single
import * as wasm from "./pkg/client_wasm.js" in your own code.
transport/dist/ — inline it
Safe to inline because it holds no runtime edge to pkg/: the façade is
injection-based — createProver(wasm) takes the wasm module namespace as an
argument. Every module specifier in dist/ is relative; the build asserts that
on every push (guard G4), so it cannot silently regress.
You do not need --alias:client-wasm=./pkg/client_wasm.js
That flag was the mitigation for a rejected literal-pass-through façade, which
emitted a bare client-wasm specifier that --external:./pkg/* cannot match.
The shipped façade emits no such specifier. Adding the alias back is cargo-cult;
if you find yourself reaching for it, something else is wrong.
The embedding page must be cross-origin isolated
The module is multi-threaded and uses SharedArrayBuffer, so the page needs:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corpWithout both, initialize() fails to bring up its thread pool.
VERSION
source VERSION && echo "$GIT_SHA / $TLSN_SUBMODULE_SHA"| Field | Notes |
| --- | --- |
| DOCKER_VERSION | the artifact's tag |
| GIT_SHA, GIT_BRANCH | the correlation key — see below |
| BUILD_NUM, BUILD_URL | the CircleCI job that produced it |
| CLIENT_WASM_VERSION, TRANSPORT_VERSION | crate / npm package versions |
| TLSN_SUBMODULE_SHA | the dep/tlsn pin the prover was built against |
| RUSTC_VERSION, WASM_PACK_VERSION | the pinned nightly and packager |
| WASM_SHA256 | identity of the .wasm itself |
Correlate an artifact to a notary image by GIT_SHA, never by
DOCKER_VERSION. Both strings end in a CircleCI build number, and they are
different build numbers for the same commit: build_wasm_client runs before
build_images (it gates it), so it cannot know the image's number.
TLSN_SUBMODULE_SHA is the field to check first when debugging an MPC failure
that looks like corruption. TLSNotary is pre-1.0 and ships regular breaking
changes; a prover built against one pin talking to a notary built against another
fails with opaque MPC/deserialization errors, not a clean version mismatch. If
that sum doesn't match the notary's, stop debugging and re-sync the pin.
Proxy issuance
The raw package adds proveProxy(notaryIo, proxyConfig, request, progressCb?).
The root transport exports createProxyProver(wasm) and the Node entry exports
createNodeProxyProver(options?); both retain their existing MPC and presentation
methods. Proxy uses only the authenticated notary channel. The enabled notary
authorizes the DNS identity and owns the target connection.
The config is { serverName, rootStore?, limits? }. Finite default limits cover
16/128 KiB sent/received plaintext, 64/256/320 KiB TLS wire bytes, 512 records in
each direction, 18 KiB record payload and 64 KiB handshake/certificate budgets.
The notary independently applies its own caps. Results, persisted envelopes and
reveal-policy behavior are shared with MPC; no proof migration is required.
Old factories and injected modules keep working for MPC. Proxy factories check
the new export before initialization; they return an unsupported-module error
for old WASM. Proxy failures never trigger automatic replay in MPC. The existing
connectProxy helper is still MPC's target transport relay. Both issuance modes
need the threaded build and all worker assets. Browser callers own channel and
worker cleanup; Node's proveProxy accepts and closes one notary channel under
the same cancellation/ownership rules as prove below.
Plain Node prover
The Node worker prover requires Node 24.18.0 or later; Node 26.7.0 is also tested on macOS arm64. Its factories reject older runtimes before starting workers or accepting channels. Package installation and browser-entry imports retain the published Node >=18 requirement. CI uses Node 24.18.0 for worker tests.
Import @dmarket/steam-provenance/node from the installed npm package. The
transport package also exposes these APIs at client-wasm-transport/node when
staged alongside pkg/. Keep the Node entry and its worker files on disk;
do not inline them into an application bundle. The browser entry stays separate.
import { createConnection } from "node:net";
import { once } from "node:events";
import { createNodeProver, wrapTcpSocket, connectNotary }
from "@dmarket/steam-provenance/node";
const prover = createNodeProver({ threadCount: 2, operationTimeoutMs: 120_000 });
let socket, serverIo, notaryIo;
try {
await prover.initialize();
notaryIo = await connectNotary(notaryUrl, accessToken);
socket = createConnection({ host: endpointAddress, port: 443 });
socket.on("error", error => console.error("endpoint socket error", error.code));
const connectionTimer = setTimeout(() => socket.destroy(new Error("connect timeout")), 10_000);
try { await once(socket, "connect"); }
finally { clearTimeout(connectionTimer); }
serverIo = wrapTcpSocket(socket);
const out = await prover.prove(notaryIo, serverIo,
{ serverName: "api.example.com" },
{ method: "GET", uri: "/v1/resource" },
{ signal: AbortSignal.timeout(120_000), onProgress: event => console.log(event.step) });
const presentation = await prover.present(out.attestation, out.secrets, {
redactRequestHeaderValues: ["authorization", "cookie", "user-agent"],
revealRequestTarget: false,
revealResponseHeaders: true,
revealResponseBody: "all",
});
// Send presentation to your validator; persist attestation + secrets together.
} finally {
await prover.dispose();
await serverIo?.abort();
socket?.destroy();
await notaryIo?.close();
}The application opens the endpoint connection once and hands over that same
raw net.Socket. It must already be connected, readable/writable, binary, and
exclusively available: no setEncoding, competing data/readable listeners,
in-flight application writes, or consumed protocol bytes. TLS sockets, connecting
sockets, and closed sockets are rejected without taking ownership. On successful
handoff, the adapter owns IO and may close/destroy the socket. Unread buffered
bytes are retained. It enables TCP_NODELAY and allowHalfOpen: peer EOF ends
reads while accepted writes can still drain. Normal close is idempotent and
drains writes; after five seconds it destroys a blocked connection. abort()
destroys it immediately. Reusing this connection after a proof is not supported.
MPC-TLS runs inside the prover, so do not call tls.connect() or perform a TLS
handshake before handoff. serverName controls certificate identity and SNI and
can differ from the routing address. The notary uses its existing authenticated
WebSocket handshake; connectNotary also accepts an injected WebSocketImpl.
Application connection deadlines are separate from prover initialization and
issuance deadlines.
createNodeProver runs the existing threaded WASM inside dedicated
worker_threads, with no compatibility globals added to the application.
initialize() coalesces repeated/concurrent calls. prove() and present() are
asynchronous and allow one active operation per instance. A rejected concurrent
call, invalid options, or an already-aborted signal leaves ownership of the
channels with the caller. An accepted proof closes
both IO channels on success or failure. Custom channels must make close()
unblock IO; they can expose abort() for immediate cleanup. The bridge allows
one outstanding read, acknowledges write completion, splits messages at 64 KiB,
and limits queued writes to 8 MiB / 128 calls. Await writes for backpressure.
Initialization defaults to 30 seconds; proof/presentation calls default to
120 seconds including initialization, configurable per instance or call. An
AbortSignal, timeout, worker failure, or failed proof discards the entire worker
module; a later call initializes a fresh one. dispose() is terminal and
idempotent, settles outstanding calls, terminates the complete worker tree, and
bounds custom-channel cleanup to five seconds. Progress callback errors cannot
strand a proof. Logging defaults to Off; progress contains stages, not proof data.
Separate instances can run independently. Each uses a prover worker, a spawner,
a Rayon pool, and additional MPC workers; budget CPU and shared memory per
instance. threadCount defaults to available CPUs capped at 8 (range 1–32) and
also controls the parallelism reported to the MPC executor. A one-thread pool
still requires workers. No serial WASM rebuild or browser is involved.
