Files
Shade/packages/shade-transport-webrtc
Sterister 2c400d7094
Some checks failed
Test / test (push) Has been cancelled
Cross-platform vectors / TypeScript vectors (bun) (push) Has been cancelled
Cross-platform vectors / Kotlin vectors (gradle) (push) Has been cancelled
Docker build and publish / docker (push) Has been cancelled
Publish / publish (push) Has been cancelled
release(v4.6.0): broadcast channels — Signal sender-keys for one-to-many fan-out
Lands the broadcast-channel primitive Prism asked for in
Docs/shade-feature-request-sender-keys.md. The crypto in
@shade/core/sender-keys.ts was already in place; this release wires
it up as a first-class app-facing API, adds the persistence schema
across all six storage backends (memory, sqlite, indexeddb +
encrypted variants), introduces wire type 0x21 in @shade/proto,
and ships Prism's three acceptance tests verbatim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 15:55:34 +02:00
..

@shade/transport-webrtc

V3.11 — direct peer-to-peer chunk transport for Shade transfers via RTCDataChannel. Plugs into @shade/transfer's ITransferTransport contract and wires automatically into @shade/sdk via shade.configureWebRTC().

import { createShade } from '@shade/sdk';
import { nativeRtcFactory } from '@shade/transport-webrtc';

const shade = await createShade({ prekeyServer });
shade.configureWebRTC({ factory: nativeRtcFactory() });
shade.configureTransfers({ resolveBaseUrl });

await shade.upload({ to: 'bob', input: file });    // → P2P when NAT allows,
                                                    //   HTTP otherwise.

See docs/webrtc.md for the full guide: NAT-traversal realities, TURN config, glare resolution, wire format, diagnostics, and end-to-end test recipes.

What's inside

  • WebRtcConnection — one peer connection between two Shade endpoints, driving offer/answer/ICE through Shade's own ratchet.
  • WebRtcConnectionManager — per-peer pool with deterministic glare resolution.
  • WebRtcSignalingChannel — JSON signaling messages multiplexed over Shade.send / Shade.onMessage.
  • WebRtcTransferTransport — implements ITransferTransport over the managed DataChannel; ack-correlated by 16-byte requestId tokens.
  • MemoryRtcFactory — in-process WebRTC simulator for tests.
  • nativeRtcFactory() — adapter over globalThis.RTCPeerConnection (browsers / Deno / Cloudflare Workers).

Adapters

@shade/transport-webrtc ships only the standard-API adapter (nativeRtcFactory). For Bun / Node, wrap your library of choice behind the IRtcFactory interface — only createPeerConnection, createDataChannel, and standard addEventListener are required.

Recommended adapters: