v158 · webtransport · keying material

The exporter surface, probed exactly

The feature is one method: exportKeyingMaterial(label, context, outputLength) on WebTransport.prototype, returning a fresh Promise<Uint8Array>. This page checks that exact member — not "does WebTransport exist" — and then calls it for real on a session that never establishes, because the spec says precisely what must happen then: the pending promise rejects with InvalidStateError the moment the session fails.

Chrome targets exportKeyingMaterial() for Chrome 158 behind the WebTransportExportKeyingMaterial runtime flag. On an earlier or unflagged build, launch with --enable-blink-features=WebTransportExportKeyingMaterial, or flip chrome://flags/#enable-experimental-web-platform-features and relaunch. The live call below targets https://127.0.0.1:44443/never (nothing listens there) — that failing establishment is what makes the rejection path observable without a server.

The exact member

typeof WebTransport
…
'exportKeyingMaterial' in WebTransport.prototype
…
typeof WebTransport.prototype.exportKeyingMaterial
…
.length (declared arity)
…
property descriptor
…

Reading…

A real call on a real (failing) session

Construct a session to a dead endpoint, call exportKeyingMaterial(label, context, 32) with valid arguments while it is still connecting, and report what the returned promise really does. On a supporting build the spec's in-parallel steps abort when the state becomes "failed" and the promise rejects with InvalidStateError.

    code path

    const t = new WebTransport("https://127.0.0.1:44443/never");
    const enc = new TextEncoder();
    
    // Valid args, called while [[State]] is "connecting":
    const p = t.exportKeyingMaterial(enc.encode("EXPORTER-probe"), enc.encode("ctx"), 32);
    // p is a pending Promise — the export waits for establishment…
    
    try { await p; } catch (e) {
      e.name; // "InvalidStateError" — the session failed instead of establishing
    }

    see also