diff --git a/.oss-scanner/Dockerfile b/.oss-scanner/Dockerfile index b18cb606fe2..5ce473cb5c6 100644 --- a/.oss-scanner/Dockerfile +++ b/.oss-scanner/Dockerfile @@ -22,7 +22,7 @@ RUN rustup show active-toolchain || rustup toolchain install \ && curl -LsSf "https://get.nexte.st/$NEXTEST_VERSION/$nextest" | tar zxf - -C "$CARGO_HOME/bin" \ && cargo nextest --version -ARG CRATES="kio hang moq-auth moq-crypto moq-hls moq-json moq-loc moq-msf moq-mux moq-net moq-pattern moq-quic moq-relay moq-rtmp moq-rtsp moq-sock moq-srt moq-stats moq-tokio moq-uring moq-webrtc moq-cli" +ARG CRATES="kio hang moq-auth moq-crypto moq-e2ee moq-hls moq-json moq-loc moq-msf moq-mux moq-net moq-pattern moq-quic moq-relay moq-rtmp moq-rtsp moq-sock moq-srt moq-stats moq-tokio moq-uring moq-webrtc moq-cli" # Path specs, because the lockfile also has published copies of some workspace crates. RUN cargo fetch --locked \ diff --git a/.oss-scanner/threat_model.md b/.oss-scanner/threat_model.md index 01f5b394931..839bad7e395 100644 --- a/.oss-scanner/threat_model.md +++ b/.oss-scanner/threat_model.md @@ -25,7 +25,7 @@ The relay is deployed on the public internet as shared infrastructure: one proce - **Cache integrity.** The relay caches and forwards groups by broadcast, track, and group. A publisher must not be able to overwrite or inject into a broadcast it was not granted, and a subscriber must never receive one tenant's data under another tenant's name. - **Cluster trust.** Peer relays authenticate with tokens or mTLS and get broader rights than clients. A relay dials only configured or discovered peers, never a URL learned from an announcement. LAN discovery over mDNS (`[cluster.lan]`) is open to anyone on the network unless `secret` is set, which is documented; with `secret` set, an unkeyed host must not be able to join. - **Amplification and reflection.** QUIC's anti-amplification limit and address validation, and ICE in the WebRTC gateway, answer unauthenticated UDP. A response larger than the request toward a spoofed source is a finding. -- **End-to-end encryption.** `moq-crypto` encrypts groups, datagrams, and track names so a relay cannot read them. A flaw in the construction (nonce reuse, a key or name leaking to the relay, a forgeable group) is in scope. +- **End-to-end encryption.** `moq-e2ee`, unpublished and experimental, encrypts groups, datagrams, and track names so a relay cannot read them. A flaw in the construction (nonce reuse, a key or name leaking to the relay, a forgeable group) is in scope. ## Components that matter most / least @@ -35,7 +35,7 @@ Most important, in this order: 2. Authorization: a session publishing, subscribing, or seeing announcements outside its grant, or reaching another root (tenant) through path tricks, revalidation, mounts, or cluster links. 3. `rs/moq-mux` and `rs/hang`: container, codec, and catalog parsing of publisher-controlled bytes. 4. The ingest gateways: `rs/moq-rtmp`, `rs/moq-rtsp`, `rs/moq-srt`, `rs/moq-webrtc`, `rs/moq-hls`. -5. `rs/moq-crypto`, `rs/moq-cli`, `rs/moq-json`, `rs/moq-stats`, `rs/kio`. +5. `rs/moq-crypto`, `rs/moq-e2ee`, `rs/moq-cli`, `rs/moq-json`, `rs/moq-stats`, `rs/kio`. `unsafe` is rare and worth reading closely where it appears: `rs/moq-quic`, `rs/moq-net/src/model`, `rs/moq-net/src/util/cell.rs`, `rs/moq-net/src/transport.rs`, and `rs/moq-relay/src/uring.rs`. diff --git a/Cargo.lock b/Cargo.lock index 96db2f02f4a..a6aa6c54b4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4429,13 +4429,8 @@ dependencies = [ name = "moq-crypto" version = "0.0.11" dependencies = [ - "base64 0.23.1", - "bench-harness", - "bytes", "data-encoding", "hex", - "kio", - "moq-crypto", "moq-net", "rind", "rind-rustls", @@ -4444,6 +4439,25 @@ dependencies = [ "serde_json", "tempfile", "thiserror 2.0.21", + "workspace-hack", + "zeroize", +] + +[[package]] +name = "moq-e2ee" +version = "0.0.26" +dependencies = [ + "base64 0.23.1", + "bench-harness", + "bytes", + "hex", + "kio", + "moq-crypto", + "moq-e2ee", + "moq-net", + "rind", + "serde_json", + "thiserror 2.0.21", "tokio", "uuid", "workspace-hack", diff --git a/Cargo.toml b/Cargo.toml index 6594c345a93..f845e934194 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ default-members = [ "rs/moq-bench", "rs/moq-cli", "rs/moq-crypto", + "rs/moq-e2ee", # "rs/moq-ffi", # requires Python/maturin # "rs/moq-gst", # requires GStreamer "rs/moq-hls", diff --git a/bun.lock b/bun.lock index 1b820a0d602..030758bc21c 100644 --- a/bun.lock +++ b/bun.lock @@ -178,8 +178,8 @@ "typescript": "7.0.2", }, }, - "js/crypto": { - "name": "@moq/crypto", + "js/e2ee": { + "name": "@moq/e2ee", "version": "0.0.0", "dependencies": { "@moq/net": "workspace:^", @@ -853,8 +853,6 @@ "@moq/clock": ["@moq/clock@workspace:js/clock"], - "@moq/crypto": ["@moq/crypto@workspace:js/crypto"], - "@moq/demo": ["@moq/demo@workspace:demo/web"], "@moq/demo-boy": ["@moq/demo-boy@workspace:demo/boy"], @@ -865,6 +863,8 @@ "@moq/drain-test": ["@moq/drain-test@workspace:test/drain"], + "@moq/e2ee": ["@moq/e2ee@workspace:js/e2ee"], + "@moq/hang": ["@moq/hang@workspace:js/hang"], "@moq/interop-browser": ["@moq/interop-browser@workspace:test/interop/clients/js"], diff --git a/doc/concept/hang.md b/doc/concept/hang.md index 3b1e01dc974..ecfb5abadd3 100644 --- a/doc/concept/hang.md +++ b/doc/concept/hang.md @@ -9,12 +9,8 @@ hang is the media format on top of [moq-lite](/concept/moq-lite): a catalog track that describes the media tracks, and a container that gives each frame a timestamp. It is modeled on [WebCodecs](https://www.w3.org/TR/webcodecs/) so a browser can decode it directly. The spec is -[draft-lcurley-moq-hang](/draft/moq-hang). Plaintext broadcast names end in -`.hang` so a player knows which catalog to expect. End-to-end encrypted -broadcasts live at ``, derived from the credential and a semantic name -such as `foo.hang`, and the [instance](/concept/moq-lite#publisher-instances) -on their route, the run's moq-e2ee epoch, identifies each publisher run. The path exposes no format or protection marker; the -payloads follow [moq-e2ee](/draft/moq-e2ee). See [Encryption](#encryption). +[draft-lcurley-moq-hang](/draft/moq-hang). Broadcast names end in +`.hang` so a player knows which catalog to expect. ## Catalog @@ -224,22 +220,6 @@ exception: its samples are always length-prefixed, so an `avc3`/`hev1` CMAF track keeps the configuration record as its `description` for the NAL length size, even when the parameter sets ride in the samples. -## Encryption - -[moq-e2ee](/draft/moq-e2ee) encrypts groups, datagrams, and track names so a -relay forwards ciphertext and never sees a content key. The application -distributes the credential on its own channel. Each publisher run binds that -credential to a fresh moq-e2ee epoch, announced as its route's -[instance](/concept/moq-lite#publisher-instances), which derives the track names -and keys for that run alone. A restart under a fresh epoch -shares no names or keys with the previous run. Never share or reuse an epoch -under one credential, whether for a replica or a later run: two instances on -one epoch derive the same keys from the same group sequences and repeat -AES-GCM nonces. The broadcast path is an opaque name -derived from the credential and a semantic name such as `foo.hang`; it carries -no format marker. `moq-crypto` is the Rust implementation. Relays need no -configuration to carry it. - ## Your own format hang is a convention, not a requirement. If you control both ends, publish diff --git a/doc/concept/index.md b/doc/concept/index.md index 05edb3ac896..9276eafd744 100644 --- a/doc/concept/index.md +++ b/doc/concept/index.md @@ -39,7 +39,7 @@ watched at 100 ms by one viewer and 10 s by another. - [moq-lite](/concept/moq-lite): the pub/sub protocol, discovery, path patterns, subscriptions, and congestion behavior. - [Identity and recovery](/concept/identity): choosing stream instances, following restarts, and answering work on demand without mixing streams. - [Sockets](/concept/socket): dial and accept point-to-point sessions through relays, each a track of messages each way. -- [hang](/concept/hang): the media catalog, containers, encryption, and how to extend both. +- [hang](/concept/hang): the media catalog, containers, and how to extend both. - [Archives](/concept/archives): record listed tracks into object storage and serve them back from a host. - [Audio jitter](/concept/audio-jitter): how a receiver sizes its audio playout target from arrival timing. - [Compressed tracks](/concept/compression): when to compress a track, what each protocol version receives, and the relay's cost. @@ -53,7 +53,6 @@ watched at 100 ms by one viewer and 10 s by another. | --- | --- | | Who may publish or subscribe? | [Relay authentication](/bin/relay/auth) | | How do I add chat, state, or custom tracks? | [JSON tracks](/lib/js/json), [rooms](/lib/js/room), or [raw pub/sub](/lib/rs/moq-net) | -| How does media encryption fit in? | [hang](/concept/hang) and the [E2EE draft](/draft/moq-e2ee) | | How do multiple relays or redundant sources fit together? | [Clustering](/bin/relay/cluster) and [redundant ingest](/setup/redundancy) | | How do restarts and failover keep content apart? | [Identity and recovery](/concept/identity) | | Which package implements this layer? | [Libraries](/lib/) to integrate it, [repository map](/setup/repository) to change it | diff --git a/doc/concept/standard.md b/doc/concept/standard.md index aa0fafaf532..dda3509b480 100644 --- a/doc/concept/standard.md +++ b/doc/concept/standard.md @@ -75,8 +75,8 @@ always, on moq-lite-07. It costs a moq-lite track nothing: only a track a moq-tr publisher made carries the state, so the groups of any other cross the hop byte for byte as they would without the extension. [moq-e2ee](/draft/moq-e2ee), published and experimental, is not a transport extension. It encrypts -application payloads, so relays still forward named tracks they cannot read. -See [Encryption](/concept/hang#encryption). +application payloads, so relays still forward named tracks they cannot read. Its +implementation is unpublished while the format changes. ### Deliberate deviations diff --git a/doc/index.md b/doc/index.md index ee245ac5b2f..f46874440ab 100644 --- a/doc/index.md +++ b/doc/index.md @@ -53,7 +53,7 @@ features: - icon: src: /emoji/lock.svg title: Secure - details: Encrypted via TLS and authenticated via JWT. You can optionally self-host a private CDN or end-to-end encrypt your content. + details: Encrypted via TLS and authenticated via JWT. You can optionally self-host a private CDN. - icon: src: /emoji/back.svg diff --git a/doc/lib/js/index.md b/doc/lib/js/index.md index 848210a5b83..5809b8c4e72 100644 --- a/doc/lib/js/index.md +++ b/doc/lib/js/index.md @@ -32,7 +32,6 @@ small examples. The [API reference](/lib/js/api/) covers every package; source l | [@moq/json](/lib/js/json) | JSON over tracks: snapshots with merge-patch deltas, or append logs. | | [@moq/stats](/lib/js/api/stats) | Read a relay's published traffic stats: discover nodes and yield typed frames. | | [@moq/obs](/lib/js/api/obs) | Set up the OBS on the user's machine from a web page: a MoQ or RTMP(S) destination, live stats, and MoQ Sources. | -| [@moq/crypto](https://github.com/moq-dev/moq/tree/main/js/crypto) | Experimental end-to-end encryption of groups, datagrams, and track names, scoped to a publisher run's epoch, so relays forward content they cannot read. Workspace-only until the browser components use it. | | [@moq/loc](/lib/js/api/loc), [@moq/msf](/lib/js/api/msf) | The IETF LOC container and MSF catalog. | ## Web components diff --git a/doc/lib/rs/index.md b/doc/lib/rs/index.md index fb5b5d4bdd8..d2688128e14 100644 --- a/doc/lib/rs/index.md +++ b/doc/lib/rs/index.md @@ -39,7 +39,6 @@ missing required CPU feature before starting transport cryptography. | [moq-transcode](https://docs.rs/moq-transcode) | Just-in-time rendition ladders, GPU-resident on NVIDIA. | | [moq-auth](/lib/rs/moq-auth) | Relay authorization: JWT signing and verification, and the auth server contract. | | [moq-json](/lib/rs/moq-json) | JSON over tracks: snapshots with merge-patch deltas, or append logs. | -| [moq-crypto](https://github.com/moq-dev/moq/tree/main/rs/moq-crypto) | Experimental end-to-end encryption of groups, datagrams, and track names, scoped to a publisher run's epoch, so relays forward content they cannot read; the [e2ee draft](/draft/moq-e2ee) it implements is published. | | [moq-loc](https://docs.rs/moq-loc), [moq-msf](https://docs.rs/moq-msf) | The IETF LOC container and MSF catalog. | | [moq-stats](https://docs.rs/moq-stats) | Publish and consume relay traffic counters as tracks. | | [kio](/lib/rs/kio) | The async primitives everything polls through, and one clock for time and timers on tokio and a deterministic test simulator. | diff --git a/doc/setup/repository.md b/doc/setup/repository.md index 6d2bc2d6a5f..e05a5f1400a 100644 --- a/doc/setup/repository.md +++ b/doc/setup/repository.md @@ -31,7 +31,7 @@ wrap the Rust core. [Layers](/lib/layers) maps the binding namespaces. | CLI commands and protocol gateways | [`rs/moq-cli`](https://github.com/moq-dev/moq/tree/main/rs/moq-cli), then the corresponding `rs/moq-{rtmp,srt,webrtc,rtsp,hls}` crate | [Applications](/bin/) | | Language bindings | [`rs/moq-ffi`](https://github.com/moq-dev/moq/tree/main/rs/moq-ffi), [`rs/moq-c`](https://github.com/moq-dev/moq/tree/main/rs/moq-c), then `py/`, `swift/`, `kt/`, `go/`, `dart/`, or `cpp/moq/` | [Binding layers](/lib/layers) | | Rooms, chat, and application data | [`js/room`](https://github.com/moq-dev/moq/tree/main/js/room), `rs/moq-json`, `js/json` | [Rooms](/lib/js/room), [JSON tracks](/lib/js/json) | -| End-to-end encryption | [`rs/moq-crypto`](https://github.com/moq-dev/moq/tree/main/rs/moq-crypto), [`js/crypto`](https://github.com/moq-dev/moq/tree/main/js/crypto) | [Media encryption](/concept/hang), [E2EE draft](/draft/moq-e2ee) | +| End-to-end encryption (unpublished, experimental) | [`rs/moq-e2ee`](https://github.com/moq-dev/moq/tree/main/rs/moq-e2ee), [`js/e2ee`](https://github.com/moq-dev/moq/tree/main/js/e2ee) | [E2EE draft](/draft/moq-e2ee) | | Async primitives and deterministic time | [`rs/kio`](https://github.com/moq-dev/moq/tree/main/rs/kio), [`js/clock`](https://github.com/moq-dev/moq/tree/main/js/clock) | [Rust conventions](/lib/rs/#conventions), [clock](/lib/js/clock) | ## Find the surrounding work diff --git a/doc/setup/upgrade.md b/doc/setup/upgrade.md index fb936876e9b..04c3feec678 100644 --- a/doc/setup/upgrade.md +++ b/doc/setup/upgrade.md @@ -27,7 +27,7 @@ replaces it. - **Binaries:** [moq-relay](https://github.com/moq-dev/moq/blob/main/rs/moq-relay/MIGRATE.md), [moq-cli (`moq`)](https://github.com/moq-dev/moq/blob/main/rs/moq-cli/MIGRATE.md), [moq-gst](https://github.com/moq-dev/moq/blob/main/rs/moq-gst/MIGRATE.md), [obs-moq](https://github.com/moq-dev/moq/blob/main/cpp/obs/MIGRATE.md) - **Bindings:** [moq-ffi (UniFFI)](https://github.com/moq-dev/moq/blob/main/rs/moq-ffi/MIGRATE.md), [moq-c (C)](https://github.com/moq-dev/moq/blob/main/rs/moq-c/MIGRATE.md), [Python](https://github.com/moq-dev/moq/blob/main/py/moq-rs/MIGRATE.md), [Go](https://github.com/moq-dev/moq/blob/main/go/wrapper/MIGRATE.md), [Swift](https://github.com/moq-dev/moq/blob/main/swift/MIGRATE.md), [Kotlin](https://github.com/moq-dev/moq/blob/main/kt/moq/MIGRATE.md), [Dart](https://github.com/moq-dev/moq/blob/main/dart/moq/MIGRATE.md), [C++](https://github.com/moq-dev/moq/blob/main/cpp/moq/MIGRATE.md) -- **Rust:** [hang](https://github.com/moq-dev/moq/blob/main/rs/hang/MIGRATE.md), [kio](https://github.com/moq-dev/moq/blob/main/rs/kio/MIGRATE.md), [kio-macros](https://github.com/moq-dev/moq/blob/main/rs/kio/macros/MIGRATE.md), [moq-archive](https://github.com/moq-dev/moq/blob/main/rs/moq-archive/MIGRATE.md), [moq-audio](https://github.com/moq-dev/moq/blob/main/rs/moq-audio/MIGRATE.md), [moq-auth](https://github.com/moq-dev/moq/blob/main/rs/moq-auth/MIGRATE.md), [moq-crypto](https://github.com/moq-dev/moq/blob/main/rs/moq-crypto/MIGRATE.md), [moq-hls](https://github.com/moq-dev/moq/blob/main/rs/moq-hls/MIGRATE.md), [moq-json](https://github.com/moq-dev/moq/blob/main/rs/moq-json/MIGRATE.md), [moq-loc](https://github.com/moq-dev/moq/blob/main/rs/moq-loc/MIGRATE.md), [moq-msf](https://github.com/moq-dev/moq/blob/main/rs/moq-msf/MIGRATE.md), [moq-mux](https://github.com/moq-dev/moq/blob/main/rs/moq-mux/MIGRATE.md), [moq-net](https://github.com/moq-dev/moq/blob/main/rs/moq-net/MIGRATE.md), [moq-nvenc](https://github.com/moq-dev/moq/blob/main/rs/moq-nvenc/MIGRATE.md), [moq-pattern](https://github.com/moq-dev/moq/blob/main/rs/moq-pattern/MIGRATE.md), [moq-rtmp](https://github.com/moq-dev/moq/blob/main/rs/moq-rtmp/MIGRATE.md), [moq-sock](https://github.com/moq-dev/moq/blob/main/rs/moq-sock/MIGRATE.md), [moq-srt](https://github.com/moq-dev/moq/blob/main/rs/moq-srt/MIGRATE.md), [moq-stats](https://github.com/moq-dev/moq/blob/main/rs/moq-stats/MIGRATE.md), [moq-tokio](https://github.com/moq-dev/moq/blob/main/rs/moq-tokio/MIGRATE.md), [moq-transcode](https://github.com/moq-dev/moq/blob/main/rs/moq-transcode/MIGRATE.md), [moq-uring](https://github.com/moq-dev/moq/blob/main/rs/moq-uring/MIGRATE.md), [moq-v4l](https://github.com/moq-dev/moq/blob/main/rs/moq-v4l/MIGRATE.md), [moq-video](https://github.com/moq-dev/moq/blob/main/rs/moq-video/MIGRATE.md), [moq-webrtc (was moq-rtc)](https://github.com/moq-dev/moq/blob/main/rs/moq-webrtc/MIGRATE.md), [qmux](https://github.com/moq-dev/moq/blob/main/rs/qmux/MIGRATE.md) +- **Rust:** [hang](https://github.com/moq-dev/moq/blob/main/rs/hang/MIGRATE.md), [kio](https://github.com/moq-dev/moq/blob/main/rs/kio/MIGRATE.md), [kio-macros](https://github.com/moq-dev/moq/blob/main/rs/kio/macros/MIGRATE.md), [moq-archive](https://github.com/moq-dev/moq/blob/main/rs/moq-archive/MIGRATE.md), [moq-audio](https://github.com/moq-dev/moq/blob/main/rs/moq-audio/MIGRATE.md), [moq-auth](https://github.com/moq-dev/moq/blob/main/rs/moq-auth/MIGRATE.md), [moq-hls](https://github.com/moq-dev/moq/blob/main/rs/moq-hls/MIGRATE.md), [moq-json](https://github.com/moq-dev/moq/blob/main/rs/moq-json/MIGRATE.md), [moq-loc](https://github.com/moq-dev/moq/blob/main/rs/moq-loc/MIGRATE.md), [moq-msf](https://github.com/moq-dev/moq/blob/main/rs/moq-msf/MIGRATE.md), [moq-mux](https://github.com/moq-dev/moq/blob/main/rs/moq-mux/MIGRATE.md), [moq-net](https://github.com/moq-dev/moq/blob/main/rs/moq-net/MIGRATE.md), [moq-nvenc](https://github.com/moq-dev/moq/blob/main/rs/moq-nvenc/MIGRATE.md), [moq-pattern](https://github.com/moq-dev/moq/blob/main/rs/moq-pattern/MIGRATE.md), [moq-rtmp](https://github.com/moq-dev/moq/blob/main/rs/moq-rtmp/MIGRATE.md), [moq-sock](https://github.com/moq-dev/moq/blob/main/rs/moq-sock/MIGRATE.md), [moq-srt](https://github.com/moq-dev/moq/blob/main/rs/moq-srt/MIGRATE.md), [moq-stats](https://github.com/moq-dev/moq/blob/main/rs/moq-stats/MIGRATE.md), [moq-tokio](https://github.com/moq-dev/moq/blob/main/rs/moq-tokio/MIGRATE.md), [moq-transcode](https://github.com/moq-dev/moq/blob/main/rs/moq-transcode/MIGRATE.md), [moq-uring](https://github.com/moq-dev/moq/blob/main/rs/moq-uring/MIGRATE.md), [moq-v4l](https://github.com/moq-dev/moq/blob/main/rs/moq-v4l/MIGRATE.md), [moq-video](https://github.com/moq-dev/moq/blob/main/rs/moq-video/MIGRATE.md), [moq-webrtc (was moq-rtc)](https://github.com/moq-dev/moq/blob/main/rs/moq-webrtc/MIGRATE.md), [qmux](https://github.com/moq-dev/moq/blob/main/rs/qmux/MIGRATE.md) - **JavaScript:** [`@moq/auth`](https://github.com/moq-dev/moq/blob/main/js/auth/MIGRATE.md), [`@moq/clock`](https://github.com/moq-dev/moq/blob/main/js/clock/MIGRATE.md), [`@moq/hang`](https://github.com/moq-dev/moq/blob/main/js/hang/MIGRATE.md), [`@moq/json`](https://github.com/moq-dev/moq/blob/main/js/json/MIGRATE.md), [`@moq/loc`](https://github.com/moq-dev/moq/blob/main/js/loc/MIGRATE.md), [`@moq/msf`](https://github.com/moq-dev/moq/blob/main/js/msf/MIGRATE.md), [`@moq/net`](https://github.com/moq-dev/moq/blob/main/js/net/MIGRATE.md), [`@moq/pattern`](https://github.com/moq-dev/moq/blob/main/js/pattern/MIGRATE.md), [`@moq/publish`](https://github.com/moq-dev/moq/blob/main/js/publish/MIGRATE.md), [`@moq/qmux`](https://github.com/moq-dev/moq/blob/main/js/qmux/MIGRATE.md), [`@moq/room`](https://github.com/moq-dev/moq/blob/main/js/room/MIGRATE.md), [`@moq/signals`](https://github.com/moq-dev/moq/blob/main/js/signals/MIGRATE.md), [`@moq/video`](https://github.com/moq-dev/moq/blob/main/js/video/MIGRATE.md), [`@moq/watch`](https://github.com/moq-dev/moq/blob/main/js/watch/MIGRATE.md) ## Unreleased diff --git a/drafts/draft-lcurley-moq-e2ee.md b/drafts/draft-lcurley-moq-e2ee.md index c0f52878e23..33a52162045 100644 --- a/drafts/draft-lcurley-moq-e2ee.md +++ b/drafts/draft-lcurley-moq-e2ee.md @@ -32,7 +32,7 @@ informative: --- abstract -This document specifies moq-e2ee-00, a versioned profile for end-to-end encryption of MoQ application payloads. +This document specifies moq-e2ee-01-wip, a versioned profile for end-to-end encryption of MoQ application payloads. Authorized publishers and subscribers share a 32-byte broadcast secret out of band. Each publisher instance mints an epoch and announces it on the route for an opaque broadcast path. HKDF-SHA-256 derives per-track AES-128-GCM keys from the secret and the epoch; grouped frames and datagrams use separate key domains. @@ -84,7 +84,7 @@ Its independent counter, 17-byte per-frame header, ChaCha20-Poly1305 suite, sign # Profile Version -This document defines profile `moq-e2ee-00`. +This document defines profile `moq-e2ee-01-wip` while it is a work in progress, which becomes `moq-e2ee-01` once finalized. The profile is named out of band alongside the credential; an application MUST refuse a credential that names any other profile. A new profile is a new document; implementations MUST NOT fall back to plaintext or to an older profile because a catalog, announcement, or peer suggested one. @@ -167,7 +167,7 @@ Integers used as group, frame, or kid identities are refused before encoding if # Key Derivation {#derive} Keys and physical names are derived with HKDF-SHA-256 {{RFC5869}}. -Let `salt` be the ASCII bytes of `"moq-e2ee-00"`. +Let `salt` be the ASCII bytes of `"moq-e2ee-01-wip"`. ~~~ prk = HKDF-Extract(salt, secret) @@ -176,7 +176,7 @@ prk = HKDF-Extract(salt, secret) Opaque broadcast path material is 16 bytes: ~~~ -path_info = "moq-e2ee-00 path" +path_info = "moq-e2ee-01-wip path" || bytes(context) || u64(kid) || bytes(semantic_broadcast) @@ -191,8 +191,8 @@ Physical track names encrypt the semantic name deterministically, using only HMA ~~~ scope = bytes(context) || bytes(epoch) || u64(kid) -name_mac = HKDF-Expand(prk, "moq-e2ee-00 name-mac" || scope, 32) -name_key = HKDF-Expand(prk, "moq-e2ee-00 name-key" || scope, 16) +name_mac = HKDF-Expand(prk, "moq-e2ee-01-wip name-mac" || scope, 32) +name_key = HKDF-Expand(prk, "moq-e2ee-01-wip name-key" || scope, 16) padded = semantic_name || 0x80 || 0x00 ... 0x00 nonce = HMAC-SHA-256(name_mac, padded)[0..12] physical = nonce || AES-128-GCM(name_key, nonce, padded) @@ -214,7 +214,7 @@ The nonce check keeps one physical name per semantic name, so two tracks never s AEAD keys are 16 bytes, one per semantic name and domain: ~~~ -key_info = "moq-e2ee-00 key" +key_info = "moq-e2ee-01-wip key" || bytes(context) || bytes(epoch) || u64(kid) @@ -334,7 +334,7 @@ A receiver MUST NOT require group 0 or any prior identity before opening a later # Test Vectors {#vectors} -Known-answer and negative vectors live in `moq-e2ee-00.json` beside this draft. +Known-answer and negative vectors live in `moq-e2ee-01-wip.json` beside this draft. Hex strings are octet sequences. The JSON is authoritative for primitive interop; an implementation of this profile MUST pass every vector. Each negative row specifies an `operation`, its inputs, and its expected typed error. @@ -352,7 +352,7 @@ Passing the primitive vectors alone is not profile conformance. # Security Considerations Relays, caches, recorders, and control planes are untrusted for content. Authorized endpoints that hold the broadcast secret are trusted. -Sender authenticity against another endpoint that also holds the secret is not a goal of `moq-e2ee-00`. +Sender authenticity against another endpoint that also holds the secret is not a goal of this profile. A relay can still observe the opaque broadcast path, route epoch, opaque physical names and the length of each semantic track name rounded up to 16 bytes, group and frame structure, timestamps, sizes, and traffic patterns. A subscription for a physical name the publisher does not serve fails as for any missing track, which tells a relay only that the name is not served. @@ -388,6 +388,7 @@ This document requests no registrations. ## draft-lcurley-moq-e2ee-01 {:numbered="false"} +- Assigned `moq-e2ee-01-wip` as this draft's profile until it is finalized as `moq-e2ee-01`; every label and the salt follow it. - Require internally minted producing epochs and consume-only bindings for discovered epochs. - Require canonical UUIDv7 epochs, carried as the route's Instance rather than in the path, leaving HKDF UUID inputs unchanged. Relays no longer rank the newest epoch first. - Keep semantic track names in the decrypted catalog; subscribers derive physical names from them. diff --git a/drafts/moq-e2ee-00.json b/drafts/moq-e2ee-01-wip.json similarity index 57% rename from drafts/moq-e2ee-00.json rename to drafts/moq-e2ee-01-wip.json index 0e0994bddef..207918520b8 100644 --- a/drafts/moq-e2ee-00.json +++ b/drafts/moq-e2ee-01-wip.json @@ -1,11 +1,11 @@ { - "profile": "moq-e2ee-00", + "profile": "moq-e2ee-01-wip", "constants": { - "salt": "6d6f712d653265652d3030", - "path_label": "6d6f712d653265652d30302070617468", - "name_mac_label": "6d6f712d653265652d3030206e616d652d6d6163", - "name_key_label": "6d6f712d653265652d3030206e616d652d6b6579", - "key_label": "6d6f712d653265652d3030206b6579", + "salt": "6d6f712d653265652d30312d776970", + "path_label": "6d6f712d653265652d30312d7769702070617468", + "name_mac_label": "6d6f712d653265652d30312d776970206e616d652d6d6163", + "name_key_label": "6d6f712d653265652d30312d776970206e616d652d6b6579", + "key_label": "6d6f712d653265652d30312d776970206b6579", "domain_group": 0, "domain_datagram": 1, "tag_len": 16, @@ -29,20 +29,20 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "paths": [ { "id": "broadcast-meeting-hang", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "meeting.hang", "semantic_name_bytes": "6d656574696e672e68616e67", - "prk": "a8230410bf77bc88af14260a5ed0ec320e3b174d5a8f4f76780b27df2230f080", - "path_info": "6d6f712d653265652d3030207061746800176578616d706c652e636f6d2f6d656574696e672d3132330000000000000007000c6d656574696e672e68616e67", - "path_material": "a8d326b2e0bd8f7813a35028fb448421", - "opaque": "qNMmsuC9j3gTo1Ao-0SEIQ" + "prk": "df7821ec365eabb048a374f91920ad30f33b67a3fd495714543275ee2af0c530", + "path_info": "6d6f712d653265652d30312d776970207061746800176578616d706c652e636f6d2f6d656574696e672d3132330000000000000007000c6d656574696e672e68616e67", + "path_material": "ae128a7653dcc65efd4ce2c15cd30fd0", + "opaque": "rhKKdlPcxl79TOLBXNMP0A" } ], "derivation": [ @@ -51,80 +51,80 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "video", "semantic_name_bytes": "766964656f", "domain": 0, - "prk": "a8230410bf77bc88af14260a5ed0ec320e3b174d5a8f4f76780b27df2230f080", - "name_mac_info": "6d6f712d653265652d3030206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", - "name_mac": "1e3c908543a6a9e1a2fe0145346276fb54e2c0cd2161d54a6e52cba872e598ff", - "name_key_info": "6d6f712d653265652d3030206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", - "name_key": "8e68f2ac0acf65a8d44049840cb81270", + "prk": "df7821ec365eabb048a374f91920ad30f33b67a3fd495714543275ee2af0c530", + "name_mac_info": "6d6f712d653265652d30312d776970206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", + "name_mac": "b6fda60973c359aebbd6b20b924466246a04d0826d847c3b2f9c19d4aabd08e4", + "name_key_info": "6d6f712d653265652d30312d776970206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", + "name_key": "30b8502ba3c45894e6187edabe7e9a00", "padded": "766964656f8000000000000000000000", - "name_nonce": "8364a633b84ae3758702719b", - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk", - "key_info": "6d6f712d653265652d3030206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d32623663316139643865376600000000000000070005766964656f00", - "key": "21f9d72d77e7a0a733ef0ca64c4e1010" + "name_nonce": "3e392e3497aa6863d20845d0", + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ", + "key_info": "6d6f712d653265652d30312d776970206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d32623663316139643865376600000000000000070005766964656f00", + "key": "bb722ee6d056e83d373805fa97f9d8ac" }, { "id": "datagram-audio", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "audio", "semantic_name_bytes": "617564696f", "domain": 1, - "prk": "a8230410bf77bc88af14260a5ed0ec320e3b174d5a8f4f76780b27df2230f080", - "name_mac_info": "6d6f712d653265652d3030206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", - "name_mac": "1e3c908543a6a9e1a2fe0145346276fb54e2c0cd2161d54a6e52cba872e598ff", - "name_key_info": "6d6f712d653265652d3030206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", - "name_key": "8e68f2ac0acf65a8d44049840cb81270", + "prk": "df7821ec365eabb048a374f91920ad30f33b67a3fd495714543275ee2af0c530", + "name_mac_info": "6d6f712d653265652d30312d776970206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", + "name_mac": "b6fda60973c359aebbd6b20b924466246a04d0826d847c3b2f9c19d4aabd08e4", + "name_key_info": "6d6f712d653265652d30312d776970206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", + "name_key": "30b8502ba3c45894e6187edabe7e9a00", "padded": "617564696f8000000000000000000000", - "name_nonce": "c551cd1a1ce8806a407920c4", - "physical_name": "xVHNGhzogGpAeSDEjy2_Sc6-ixrLb6U3JNdNLvXEA2QIhNHu5UZwhV218w0", - "key_info": "6d6f712d653265652d3030206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d32623663316139643865376600000000000000070005617564696f01", - "key": "c9695fc6ede7da6db6fde74c7a4645b4" + "name_nonce": "82739c2a988469640982e0ed", + "physical_name": "gnOcKpiEaWQJguDtvwBnXoAu116zURiFBlhIbli13DgUzF0eTn4EBpuG7sA", + "key_info": "6d6f712d653265652d30312d776970206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d32623663316139643865376600000000000000070005617564696f01", + "key": "accd970b70111786833eec2576c8e228" }, { "id": "catalog-json", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "catalog.json", "semantic_name_bytes": "636174616c6f672e6a736f6e", "domain": 0, - "prk": "a8230410bf77bc88af14260a5ed0ec320e3b174d5a8f4f76780b27df2230f080", - "name_mac_info": "6d6f712d653265652d3030206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", - "name_mac": "1e3c908543a6a9e1a2fe0145346276fb54e2c0cd2161d54a6e52cba872e598ff", - "name_key_info": "6d6f712d653265652d3030206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", - "name_key": "8e68f2ac0acf65a8d44049840cb81270", + "prk": "df7821ec365eabb048a374f91920ad30f33b67a3fd495714543275ee2af0c530", + "name_mac_info": "6d6f712d653265652d30312d776970206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", + "name_mac": "b6fda60973c359aebbd6b20b924466246a04d0826d847c3b2f9c19d4aabd08e4", + "name_key_info": "6d6f712d653265652d30312d776970206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007", + "name_key": "30b8502ba3c45894e6187edabe7e9a00", "padded": "636174616c6f672e6a736f6e80000000", - "name_nonce": "b3508b58a0d340f9c8effa7c", - "physical_name": "s1CLWKDTQPnI7_p8NJkBo-IVyJ8KI4S5a11t1f8ZaPxZeq-yFiTMjDGiAGw", - "key_info": "6d6f712d653265652d3030206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007000c636174616c6f672e6a736f6e00", - "key": "6cc09aa5c8eb08dcf46111f460a5a035" + "name_nonce": "17220f719a0b5150b358ad0a", + "physical_name": "FyIPcZoLUVCzWK0Kvyb26gm3fU-cNMMyJKKhP5Qhmm1qsNPAtRpkrpfKEOE", + "key_info": "6d6f712d653265652d30312d776970206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d336332612d376431652d396630622d3262366331613964386537660000000000000007000c636174616c6f672e6a736f6e00", + "key": "2621f6769f495858236dcabec577a44e" }, { "id": "other-epoch", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-9e10-7f42-8a3c-5d7e2b1c0f9a", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "video", "semantic_name_bytes": "766964656f", "domain": 0, - "prk": "a8230410bf77bc88af14260a5ed0ec320e3b174d5a8f4f76780b27df2230f080", - "name_mac_info": "6d6f712d653265652d3030206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d396531302d376634322d386133632d3564376532623163306639610000000000000007", - "name_mac": "e4905659848d0769bd8aa8c03aa76611e792e61e79029b6963041b58d7d6a320", - "name_key_info": "6d6f712d653265652d3030206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d396531302d376634322d386133632d3564376532623163306639610000000000000007", - "name_key": "af047a90ee325c4b9dbe6895d73c9c25", + "prk": "df7821ec365eabb048a374f91920ad30f33b67a3fd495714543275ee2af0c530", + "name_mac_info": "6d6f712d653265652d30312d776970206e616d652d6d616300176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d396531302d376634322d386133632d3564376532623163306639610000000000000007", + "name_mac": "49cfb258072854828c3e12e68e892f64c8b74dde187cb80c8bc01168cb113e42", + "name_key_info": "6d6f712d653265652d30312d776970206e616d652d6b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d396531302d376634322d386133632d3564376532623163306639610000000000000007", + "name_key": "d4fe814d0847dc06daf117bcec480dd8", "padded": "766964656f8000000000000000000000", - "name_nonce": "a6655d0a525c9070c6516178", - "physical_name": "pmVdClJckHDGUWF4ggfWbpBhuj909KNESw8qCBxOXmClyxyAUvY4a8jBVU4", - "key_info": "6d6f712d653265652d3030206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d396531302d376634322d386133632d35643765326231633066396100000000000000070005766964656f00", - "key": "5c87079e55b0b1e453f7667abf293682" + "name_nonce": "3f4fb476de76ef77e15fc745", + "physical_name": "P0-0dt5273fhX8dFDiwrtj5zlxqFKvSibd2Uc27hRTbCYDIbDt2lsxmq2Us", + "key_info": "6d6f712d653265652d30312d776970206b657900176578616d706c652e636f6d2f6d656574696e672d313233002430313939623766342d396531302d376634322d386133632d35643765326231633066396100000000000000070005766964656f00", + "key": "5c03948018f911a538b075bf6633e37a" } ], "naming": [ @@ -134,7 +134,7 @@ "semantic_name": "video", "semantic_name_bytes": "766964656f", "padded": "766964656f8000000000000000000000", - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk" + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ" }, { "id": "datagram-audio", @@ -142,7 +142,7 @@ "semantic_name": "audio", "semantic_name_bytes": "617564696f", "padded": "617564696f8000000000000000000000", - "physical_name": "xVHNGhzogGpAeSDEjy2_Sc6-ixrLb6U3JNdNLvXEA2QIhNHu5UZwhV218w0" + "physical_name": "gnOcKpiEaWQJguDtvwBnXoAu116zURiFBlhIbli13DgUzF0eTn4EBpuG7sA" }, { "id": "catalog-json", @@ -150,7 +150,7 @@ "semantic_name": "catalog.json", "semantic_name_bytes": "636174616c6f672e6a736f6e", "padded": "636174616c6f672e6a736f6e80000000", - "physical_name": "s1CLWKDTQPnI7_p8NJkBo-IVyJ8KI4S5a11t1f8ZaPxZeq-yFiTMjDGiAGw" + "physical_name": "FyIPcZoLUVCzWK0Kvyb26gm3fU-cNMMyJKKhP5Qhmm1qsNPAtRpkrpfKEOE" }, { "id": "other-epoch", @@ -158,7 +158,7 @@ "semantic_name": "video", "semantic_name_bytes": "766964656f", "padded": "766964656f8000000000000000000000", - "physical_name": "pmVdClJckHDGUWF4ggfWbpBhuj909KNESw8qCBxOXmClyxyAUvY4a8jBVU4" + "physical_name": "P0-0dt5273fhX8dFDiwrtj5zlxqFKvSibd2Uc27hRTbCYDIbDt2lsxmq2Us" }, { "id": "length-0", @@ -166,7 +166,7 @@ "semantic_name": "", "semantic_name_bytes": "", "padded": "80000000000000000000000000000000", - "physical_name": "fjxOPU-GXW8BqUnov3GFcVirn0bmyvifzfvet_VxAVLImts5Xa_MgVnLe1g" + "physical_name": "mVTYrVti2mRSdJmTZmMzLuOcz2eDyvnTsOm3p77IG0vDicr178hPm9zR_UE" }, { "id": "length-15", @@ -174,7 +174,7 @@ "semantic_name": "0123456789abcde", "semantic_name_bytes": "303132333435363738396162636465", "padded": "30313233343536373839616263646580", - "physical_name": "9Cm5wwN-VtnYN_iZAdevLFoeW202w20a9L9U6_xh9ApoRcjS_YFaKzPYdso" + "physical_name": "sR1wdUeLeeDXVW-zwZkoyB2YYyiCU7A_hj4Cb7WXX2xUvfZ1tAH-5cqRhO8" }, { "id": "length-16", @@ -182,7 +182,7 @@ "semantic_name": "0123456789abcdef", "semantic_name_bytes": "30313233343536373839616263646566", "padded": "3031323334353637383961626364656680000000000000000000000000000000", - "physical_name": "fjRIIBWV6EferOKawMbXaCRQy9emXMYaK_Vn_qInyyJarpiClvuJ3wQ_eOLPjHIdlKLKQMpM3J7jNhhL" + "physical_name": "rgqaJLTKeQ7x9L1HSU957R9D45kvWHIxLyh6fcDU0oLpNctM2zcNGuxKUYVjS8Ojr1ismn3Luykdinzu" }, { "id": "length-31", @@ -190,7 +190,7 @@ "semantic_name": "0123456789abcdef0123456789abcde", "semantic_name_bytes": "30313233343536373839616263646566303132333435363738396162636465", "padded": "3031323334353637383961626364656630313233343536373839616263646580", - "physical_name": "lK7GToyQ2wldNqvL-uzwsyhDMCXUq2iWap6FTRCpY-8-O6jQgcqR_z_ay9EYJ920MeOsOIzZDvd2xQuW" + "physical_name": "3U0NftNkvNfsF-rYNP6ptbjFXjnZdHRTpKLUKnKrecFFo7bNdhzwbW0M9lgBED3d60OKlM7gAQ5NvFVe" }, { "id": "length-32", @@ -198,7 +198,7 @@ "semantic_name": "0123456789abcdef0123456789abcdef", "semantic_name_bytes": "3031323334353637383961626364656630313233343536373839616263646566", "padded": "303132333435363738396162636465663031323334353637383961626364656680000000000000000000000000000000", - "physical_name": "DjgxwJwxTeQ8gcB1aXQrIi5MsTrjF2mFM5K-rs26DHGU41HPSSILJVV1QjIzXEzMmJ-vMCHH1VY7WGxuMzHDcWwz_SJSuUrKBZadkA" + "physical_name": "xzk_wwalDyfTkRDUl7_92d23k4Up1t39Sv7YLQK1qMEc2CArAT4MQ0dk7ADuVaeGM8recoGtxfILWsDRSP-9glORuBcyPOgarjoJFw" } ], "groups": [ @@ -207,85 +207,85 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "video", - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk", + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ", "domain": 0, "group": 42, "frame": 0, "nonce": "000000000000002a00000000", "plaintext": "6672616d652d7a65726f", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010" + "key": "bb722ee6d056e83d373805fa97f9d8ac" }, { "id": "group-1", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "video", - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk", + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ", "domain": 0, "group": 42, "frame": 1, "nonce": "000000000000002a00000001", "plaintext": "6672616d652d6f6e65", - "payload": "535e8554c166a9a7920f64090d48d00b5cc8c70935858ae451", + "payload": "df75941fc2e3244a9f1499c42dfe518c3f575c5fa8f28baf33", "payload_limit": 33554432, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010" + "key": "bb722ee6d056e83d373805fa97f9d8ac" }, { "id": "group-next", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "video", - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk", + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ", "domain": 0, "group": 43, "frame": 0, "nonce": "000000000000002b00000000", "plaintext": "6e6578742d67726f7570", - "payload": "c9f34f670d3e70066a60a2c8c585735f87237554d85193623054", + "payload": "d243e970e3ca1baa7e6525edad23318da472edb8efc1e99b8aeb", "payload_limit": 33554432, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010" + "key": "bb722ee6d056e83d373805fa97f9d8ac" }, { "id": "empty", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "video", - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk", + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ", "domain": 0, "group": 1, "frame": 0, "nonce": "000000000000000100000000", "plaintext": "", - "payload": "8ed863e607f52545ca2e3b8fada026c1", + "payload": "9591f8536d7d1b9f0801df801ce52e1a", "payload_limit": 33554432, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010" + "key": "bb722ee6d056e83d373805fa97f9d8ac" }, { "id": "restart-new-epoch", "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-9e10-7f42-8a3c-5d7e2b1c0f9a", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "video", - "physical_name": "pmVdClJckHDGUWF4ggfWbpBhuj909KNESw8qCBxOXmClyxyAUvY4a8jBVU4", + "physical_name": "P0-0dt5273fhX8dFDiwrtj5zlxqFKvSibd2Uc27hRTbCYDIbDt2lsxmq2Us", "domain": 0, "group": 42, "frame": 0, "nonce": "000000000000002a00000000", "plaintext": "726573746172746564", - "payload": "b53c9748bd208d47c3951c5e4caf9b00ee90a73df3fa31482a", + "payload": "dd1c8c1d023266a834e1bd372459dafda035300bb7c24af533", "payload_limit": 33554432, - "key": "5c87079e55b0b1e453f7667abf293682" + "key": "5c03948018f911a538b075bf6633e37a" } ], "datagrams": [ @@ -294,17 +294,17 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121", + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121", "semantic_name": "audio", - "physical_name": "xVHNGhzogGpAeSDEjy2_Sc6-ixrLb6U3JNdNLvXEA2QIhNHu5UZwhV218w0", + "physical_name": "gnOcKpiEaWQJguDtvwBnXoAu116zURiFBlhIbli13DgUzF0eTn4EBpuG7sA", "domain": 1, "group": 99, "frame": 0, "nonce": "000000000000006300000000", "plaintext": "6f707573", - "payload": "db04d9e65485aa79895ee39b7bc159165fec8db3", + "payload": "f20c317f44a6013540e3f2321f4a39401247b6e8", "payload_limit": 1172, - "key": "c9695fc6ede7da6db6fde74c7a4645b4" + "key": "accd970b70111786833eec2576c8e228" } ], "negative": [ @@ -316,14 +316,14 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 0, "group": 42, "frame": 0, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010", - "payload": "2f0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "bb722ee6d056e83d373805fa97f9d8ac", + "payload": "a41471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -334,14 +334,14 @@ "context": "6f746865722d62726f616463617374", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 0, "group": 42, "frame": 0, - "key": "bddc87cb9e579c45a745afb4da96ba8d", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "e582424b831e2447b7ca8308ebb3cab4", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -352,14 +352,14 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-9e10-7f42-8a3c-5d7e2b1c0f9a", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 0, "group": 42, "frame": 0, - "key": "5c87079e55b0b1e453f7667abf293682", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "5c03948018f911a538b075bf6633e37a", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -370,14 +370,14 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 8, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 0, "group": 42, "frame": 0, - "key": "725aebb38b310c332bdf9f9d697f290b", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "bc1d2ffb9e5981686130551dace70db3", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -388,14 +388,14 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "audio", "domain": 0, "group": 42, "frame": 0, - "key": "86684201e208365b44487c17e440365b", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "9fd0547121084700df97d4f28a941836", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -406,14 +406,14 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 1, "group": 42, "frame": 0, - "key": "33a6316413d2aec4a97b3c41773765b0", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "4f596f74be492dcae377a4afe630edc1", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -424,14 +424,14 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 0, "group": 43, "frame": 0, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "bb722ee6d056e83d373805fa97f9d8ac", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -442,14 +442,14 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 0, "group": 42, "frame": 1, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010", - "payload": "2e0c066233eb7441b0700a4a92d82facf4e45d54439f549e0e80", + "key": "bb722ee6d056e83d373805fa97f9d8ac", + "payload": "a51471997efc3d8d09c869ce0cf977ad12deb8017c3c72217cbd", "payload_limit": 33554432 }, { @@ -527,7 +527,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 9007199254740992, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" } }, { @@ -538,7 +538,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" } }, { @@ -549,7 +549,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "2026/09", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" } }, { @@ -560,7 +560,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "\ufeff0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" } }, { @@ -571,7 +571,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "physical_name": "abc" }, @@ -583,7 +583,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "physical_name": "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" }, @@ -595,9 +595,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk=" + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ=" }, { "id": "physical-name-trailing-bits", @@ -607,9 +607,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "g2SmM7hK43WHAnGbk6fgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFl" + "physical_name": "PjkuNJeqaGPSCEXQ-eSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUR" }, { "id": "physical-name-no-block", @@ -619,7 +619,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "physical_name": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, @@ -631,7 +631,7 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "physical_name": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }, @@ -643,9 +643,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "g2SmM7hK43WHAnGbkqfgf6seNwpWpk0jhOIsVvLrMneRK_-DQOih0Bc3oFk" + "physical_name": "PjkuNJeqaGPSCEXQ-OSGaAc0UeW3hq9BAcU52tTvz9b8497O547VKSzDvUQ" }, { "id": "name-other-epoch", @@ -655,9 +655,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "pmVdClJckHDGUWF4ggfWbpBhuj909KNESw8qCBxOXmClyxyAUvY4a8jBVU4" + "physical_name": "P0-0dt5273fhX8dFDiwrtj5zlxqFKvSibd2Uc27hRTbCYDIbDt2lsxmq2Us" }, { "id": "name-nonce-mismatch", @@ -667,9 +667,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "gmSmM7hK43WHAnGbpdECQ0U8dXBmjeopS4VWy5HOcF2Pj94S9_MGuyMIil0" + "physical_name": "PzkuNJeqaGPSCEXQuwM1yeOiG_lViKNDkEDoKqNnTFF2lrD4Wj8Fkiu3h3Y" }, { "id": "name-padding-overlong", @@ -679,9 +679,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "LBJsAqLKDfnK10kTKvRpoQwrPIpnGfskzrTJwwSd8ke0-DZ7fUdDO7hdGKo29npqdyoXF89KZlxQO1qf" + "physical_name": "jrsCoaz8kFykUzUE0bMRl6ofpn49oZXcvOl1VY3BmxwsLOmr_cAHxE0dxtGqq0RDC1UeIIBLjcxIVYJ_" }, { "id": "name-padding-unmarked", @@ -691,9 +691,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "WN7Q9JprYt9_GVVTzZOH4Uptu71rkFULqD3AENheDnEa_ydKxaUTaqxAlG8" + "physical_name": "jEhVqJQ6GnS0g9cfb342EQR7nKcOJbHuH8aIUbEVYNnX324RZusroNBnhTc" }, { "id": "name-not-utf8", @@ -703,9 +703,9 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, - "physical_name": "xdDKCWvvsepgx6mEJcYYs5fWzUbczBBGba1qTqut8wnwsEiWstNUWlzEsfU" + "physical_name": "fzj7pFqiRybZGWL9xLGqlefroBIg_Ev7LJ3dIo5KN0rIE2co74tOMjY7Xaw" }, { "id": "context-too-long", @@ -732,7 +732,7 @@ "id": "grouped-oversize", "operation": "protect", "error": "oversize", - "key": "21f9d72d77e7a0a733ef0ca64c4e1010", + "key": "bb722ee6d056e83d373805fa97f9d8ac", "group": 0, "frame": 0, "plaintext_len": 33554417, @@ -742,7 +742,7 @@ "id": "datagram-oversize", "operation": "protect", "error": "oversize", - "key": "c9695fc6ede7da6db6fde74c7a4645b4", + "key": "accd970b70111786833eec2576c8e228", "group": 99, "frame": 0, "plaintext_len": 1157, @@ -756,13 +756,13 @@ "context": "6578616d706c652e636f6d2f6d656574696e672d313233", "epoch": "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f", "kid": 7, - "secret": "6d6f712d653265652d3030207465737420736563726574212121212121212121" + "secret": "6d6f712d653265652d30312d7769702074657374207365637265742121212121" }, "semantic_name": "video", "domain": 0, "group": 0, "frame": 0, - "key": "21f9d72d77e7a0a733ef0ca64c4e1010", + "key": "bb722ee6d056e83d373805fa97f9d8ac", "payload": "00", "payload_limit": 33554432 } diff --git a/drafts/moq-e2ee-00.ts b/drafts/moq-e2ee-01-wip.ts similarity index 97% rename from drafts/moq-e2ee-00.ts rename to drafts/moq-e2ee-01-wip.ts index 18b894d25f7..e0999ab62e4 100644 --- a/drafts/moq-e2ee-00.ts +++ b/drafts/moq-e2ee-01-wip.ts @@ -1,9 +1,9 @@ #!/usr/bin/env bun /** - * moq-e2ee-00 primitives and known-answer vectors. + * moq-e2ee-01-wip primitives and known-answer vectors. * - * `bun drafts/moq-e2ee-00.ts` verifies drafts/moq-e2ee-00.json against this - * file. `bun drafts/moq-e2ee-00.ts --write` regenerates the JSON. + * `bun drafts/moq-e2ee-01-wip.ts` verifies drafts/moq-e2ee-01-wip.json against this + * file. `bun drafts/moq-e2ee-01-wip.ts --write` regenerates the JSON. * * This is the language-neutral contract, not the TypeScript E2EE core: it does * not wrap tracks, groups, or datagrams. @@ -13,12 +13,12 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; -export const PROFILE = "moq-e2ee-00"; -export const SALT = utf8("moq-e2ee-00"); -export const PATH_LABEL = utf8("moq-e2ee-00 path"); -export const NAME_MAC_LABEL = utf8("moq-e2ee-00 name-mac"); -export const NAME_KEY_LABEL = utf8("moq-e2ee-00 name-key"); -export const KEY_LABEL = utf8("moq-e2ee-00 key"); +export const PROFILE = "moq-e2ee-01-wip"; +export const SALT = utf8("moq-e2ee-01-wip"); +export const PATH_LABEL = utf8("moq-e2ee-01-wip path"); +export const NAME_MAC_LABEL = utf8("moq-e2ee-01-wip name-mac"); +export const NAME_KEY_LABEL = utf8("moq-e2ee-01-wip name-key"); +export const KEY_LABEL = utf8("moq-e2ee-01-wip key"); export const DOMAIN_GROUP = 0x00; export const DOMAIN_DATAGRAM = 0x01; export const TAG_LEN = 16; @@ -418,7 +418,7 @@ export async function unprotect( const EPOCH = "0199b7f4-3c2a-7d1e-9f0b-2b6c1a9d8e7f"; const OTHER_EPOCH = "0199b7f4-9e10-7f42-8a3c-5d7e2b1c0f9a"; -function gen(epoch = EPOCH, secret = utf8("moq-e2ee-00 test secret!!!!!!!!!")): Generation { +function gen(epoch = EPOCH, secret = utf8("moq-e2ee-01-wip test secret!!!!!")): Generation { return { context: utf8("example.com/meeting-123"), epoch: utf8(epoch), @@ -918,7 +918,7 @@ async function expectError(code: string, fn: () => unknown | Promise): async function main(): Promise { const write = process.argv.includes("--write"); const generated = await generate(); - const jsonPath = pathFor("moq-e2ee-00.json"); + const jsonPath = pathFor("moq-e2ee-01-wip.json"); if (write) { mkdirSync(dirname(jsonPath), { recursive: true }); // Escape the BOM vector so it stays visible in the file. @@ -928,10 +928,10 @@ async function main(): Promise { const onDisk = JSON.parse(readFileSync(jsonPath, "utf8")) as Awaited>; await verify(onDisk); if (JSON.stringify(onDisk) !== JSON.stringify(generated)) { - throw new Error("drafts/moq-e2ee-00.json is stale; run bun drafts/moq-e2ee-00.ts --write"); + throw new Error("drafts/moq-e2ee-01-wip.json is stale; run bun drafts/moq-e2ee-01-wip.ts --write"); } console.log( - `moq-e2ee-00: ${onDisk.paths.length} path, ${onDisk.derivation.length} derivation, ${onDisk.groups.length} group, ${onDisk.datagrams.length} datagram, ${onDisk.negative.length} negative vectors`, + `moq-e2ee-01-wip: ${onDisk.paths.length} path, ${onDisk.derivation.length} derivation, ${onDisk.groups.length} group, ${onDisk.datagrams.length} datagram, ${onDisk.negative.length} negative vectors`, ); } diff --git a/js/crypto/src/index.ts b/js/crypto/src/index.ts deleted file mode 100644 index 82598e5acf7..00000000000 --- a/js/crypto/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * End-to-end encryption for MoQ. - * - * {@link E2ee} encrypts groups, datagrams, and track names so a relay forwards ciphertext it - * cannot read. Mirrors the Rust `moq-crypto` crate's `e2ee` module. - * - * @module - */ - -/** End-to-end encryption of groups, datagrams, and track names. */ -export * as E2ee from "./e2ee/index.ts"; diff --git a/js/crypto/README.md b/js/e2ee/README.md similarity index 87% rename from js/crypto/README.md rename to js/e2ee/README.md index 577df972d7d..74e6367519e 100644 --- a/js/crypto/README.md +++ b/js/e2ee/README.md @@ -2,24 +2,20 @@ Media over QUIC

-# @moq/crypto - -End-to-end encryption for [Media over QUIC](https://moq.dev), mirroring the Rust `moq-crypto` -crate's `e2ee` module. `E2ee` encrypts groups, datagrams, and track names so relays cannot read -them. It wraps `@moq/net` and checks each timestamp with `@moq/net`'s -`Track.rescale(info, timestamp)` before encrypting, so a frame it accepts is one `@moq/net` -accepts. - -## Encryption +# @moq/e2ee End-to-end encryption for [Media over QUIC](https://moq.dev) groups, datagrams, -and track names. Profile `moq-e2ee-00` from +and track names, mirroring the Rust `moq-e2ee` crate. Profile `moq-e2ee-01-wip` from [draft-lcurley-moq-e2ee](https://datatracker.ietf.org/doc/draft-lcurley-moq-e2ee/), -interoperable with Rust's `moq_crypto::e2ee`. +interoperable with Rust's `moq_e2ee`. It wraps `@moq/net` and checks each timestamp with +`@moq/net`'s `Track.rescale(info, timestamp)` before encrypting, so a frame it accepts is one +`@moq/net` accepts. Relays forward ciphertext. Content keys never enter `@moq/net`. -### Shape +Unpublished and experimental: the format is changing, and the package publishes once it is finished. + +## Shape The application distributes a `Credential { context, kid, secret }` over its own authenticated channel. `credential.produce()` mints a fresh epoch and returns a @@ -35,11 +31,9 @@ learns only its length rounded up to 16 bytes. `createTrack` resolves once the n every write is checked against it. `close()` ends the wrapped broadcast. ```ts -import { E2ee } from "@moq/crypto"; +import { Broadcast, Credential, Epoch } from "@moq/e2ee"; import { Time } from "@moq/net"; -const { Broadcast, Credential, Epoch } = E2ee; - const credential = new Credential({ context, kid, secret }); const generation = credential.produce(); // The route's instance names the generation's epoch, so subscribers find the key. @@ -71,7 +65,7 @@ A cloned process image (a `fork` without `exec`, a restored VM snapshot or check producing generation copied to another process) is a new instance too: each copy must call `produce()` itself, since copies of one generation reuse its nonces. -### Processing +## Processing WebCrypto AES-GCM is asynchronous, so writes return promises. Each track producer and consumer runs one serial pump: one AEAD call in flight. Producer net writes land in call diff --git a/js/crypto/bench/pump.ts b/js/e2ee/bench/pump.ts similarity index 98% rename from js/crypto/bench/pump.ts rename to js/e2ee/bench/pump.ts index abf3c792b59..925565383f7 100644 --- a/js/crypto/bench/pump.ts +++ b/js/e2ee/bench/pump.ts @@ -2,7 +2,7 @@ // Bun's WebCrypto stands in for the browser's, so compare runs on the same runtime. import { Duration } from "@moq/clock"; import { Broadcast, Time } from "@moq/net"; -import { Credential } from "../src/e2ee/index.ts"; +import { Credential } from "../src/index.ts"; const GROUP_FRAMES = 64; const BUDGET = 32 * 1024 * 1024; diff --git a/js/crypto/bench/tsconfig.json b/js/e2ee/bench/tsconfig.json similarity index 100% rename from js/crypto/bench/tsconfig.json rename to js/e2ee/bench/tsconfig.json diff --git a/js/crypto/bunfig.toml b/js/e2ee/bunfig.toml similarity index 100% rename from js/crypto/bunfig.toml rename to js/e2ee/bunfig.toml diff --git a/js/crypto/package.json b/js/e2ee/package.json similarity index 83% rename from js/crypto/package.json rename to js/e2ee/package.json index 350696ab35b..e01a4ca6f46 100644 --- a/js/crypto/package.json +++ b/js/e2ee/package.json @@ -1,13 +1,13 @@ { - "name": "@moq/crypto", + "name": "@moq/e2ee", "type": "module", "version": "0.0.0", - "description": "End-to-end encryption for MoQ broadcasts.", + "description": "End-to-end encryption for MoQ groups, datagrams, and track names.", "license": "(MIT OR Apache-2.0)", "repository": { "type": "git", "url": "git+https://github.com/moq-dev/moq.git", - "directory": "js/crypto" + "directory": "js/e2ee" }, "private": true, "sideEffects": false, diff --git a/js/crypto/src/e2ee/broadcast.ts b/js/e2ee/src/broadcast.ts similarity index 100% rename from js/crypto/src/e2ee/broadcast.ts rename to js/e2ee/src/broadcast.ts diff --git a/js/crypto/src/e2ee/credential.ts b/js/e2ee/src/credential.ts similarity index 100% rename from js/crypto/src/e2ee/credential.ts rename to js/e2ee/src/credential.ts diff --git a/js/crypto/src/e2ee/datagram.ts b/js/e2ee/src/datagram.ts similarity index 99% rename from js/crypto/src/e2ee/datagram.ts rename to js/e2ee/src/datagram.ts index fe8feca9f13..04abe0803a7 100644 --- a/js/crypto/src/e2ee/datagram.ts +++ b/js/e2ee/src/datagram.ts @@ -4,11 +4,11 @@ * @module */ import { type Datagram as NetDatagram, Track as NetTrack, type Time } from "@moq/net"; -import { Pump } from "../pump.ts"; import { checkGroup } from "./derive.ts"; import { Failure } from "./failure.ts"; import type { TrackKey } from "./key.ts"; import { MAX_DATAGRAM_PAYLOAD } from "./limits.ts"; +import { Pump } from "./pump.ts"; import { DatagramWindow } from "./window.ts"; /** A decrypted datagram. */ diff --git a/js/crypto/src/e2ee/derive.ts b/js/e2ee/src/derive.ts similarity index 94% rename from js/crypto/src/e2ee/derive.ts rename to js/e2ee/src/derive.ts index 4c1304d272e..f862aa38dd9 100644 --- a/js/crypto/src/e2ee/derive.ts +++ b/js/e2ee/src/derive.ts @@ -110,22 +110,22 @@ class Info { } } -/** `"moq-e2ee-00 path" || bytes(context) || u64(kid) || bytes(semantic)`. */ +/** `"moq-e2ee-01-wip path" || bytes(context) || u64(kid) || bytes(semantic)`. */ export function pathInfo(context: Uint8Array, kid: number, semantic: string): Uint8Array { return new Info().label(PATH_LABEL).bytes(context).u64(kid).text(semantic).finish(); } -/** `"moq-e2ee-00 name-mac" || bytes(context) || bytes(epoch) || u64(kid)`. */ +/** `"moq-e2ee-01-wip name-mac" || bytes(context) || bytes(epoch) || u64(kid)`. */ export function nameMacInfo(context: Uint8Array, epoch: string, kid: number): Uint8Array { return new Info().label(NAME_MAC_LABEL).bytes(context).text(epoch).u64(kid).finish(); } -/** `"moq-e2ee-00 name-key" || bytes(context) || bytes(epoch) || u64(kid)`. */ +/** `"moq-e2ee-01-wip name-key" || bytes(context) || bytes(epoch) || u64(kid)`. */ export function nameKeyInfo(context: Uint8Array, epoch: string, kid: number): Uint8Array { return new Info().label(NAME_KEY_LABEL).bytes(context).text(epoch).u64(kid).finish(); } -/** `"moq-e2ee-00 key" || bytes(context) || bytes(epoch) || u64(kid) || bytes(semantic) || domain`. */ +/** `"moq-e2ee-01-wip key" || bytes(context) || bytes(epoch) || u64(kid) || bytes(semantic) || domain`. */ export function keyInfo( context: Uint8Array, epoch: string, diff --git a/js/crypto/src/e2ee/e2ee.test.ts b/js/e2ee/src/e2ee.test.ts similarity index 99% rename from js/crypto/src/e2ee/e2ee.test.ts rename to js/e2ee/src/e2ee.test.ts index ef143c62f15..e399216765b 100644 --- a/js/crypto/src/e2ee/e2ee.test.ts +++ b/js/e2ee/src/e2ee.test.ts @@ -9,7 +9,6 @@ import { StreamCode, Time, } from "@moq/net"; -import { Pump } from "../pump.ts"; import * as Protected from "./broadcast.ts"; import { Credential } from "./credential.ts"; import type * as Datagram from "./datagram.ts"; @@ -29,12 +28,13 @@ import { MAX_PLAINTEXT_BYTES, MAX_U53, } from "./limits.ts"; +import { Pump } from "./pump.ts"; import { Terminal } from "./terminal.ts"; import type * as Track from "./track.ts"; const encoder = new TextEncoder(); const decoder = new TextDecoder(); -const SECRET = encoder.encode("moq-e2ee-00 test secret!!!!!!!!!"); +const SECRET = encoder.encode("moq-e2ee-01-wip test secret!!!!!"); function credential(): Credential { return new Credential({ context: encoder.encode("example.com/meeting-123"), kid: 7, secret: SECRET }); @@ -1004,7 +1004,7 @@ test("secrets stay out of serialization", async () => { const generation = cred.produce(); const net = netTrack(await generation.name("video")); const producer = await generation.produce(net, "video"); - const marker = "moq-e2ee-00 test secret"; + const marker = "moq-e2ee-01-wip test secret"; for (const value of [cred, generation, producer]) { expect(JSON.stringify(value) ?? "").not.toContain(marker); expect(Bun.inspect(value)).not.toContain(marker); diff --git a/js/crypto/src/e2ee/epoch.test.ts b/js/e2ee/src/epoch.test.ts similarity index 78% rename from js/crypto/src/e2ee/epoch.test.ts rename to js/e2ee/src/epoch.test.ts index f70c75df017..afe9e439cff 100644 --- a/js/crypto/src/e2ee/epoch.test.ts +++ b/js/e2ee/src/epoch.test.ts @@ -7,8 +7,8 @@ test("mint parses as canonical and orders successive epochs", () => { expect(Epoch.mint() > epoch).toBe(true); }); -// Shared with moq-crypto's `epoch_vectors`, so both parse and order alike. -const vectors = (await Bun.file(new URL("../../../../rs/moq-crypto/src/e2ee/epoch.json", import.meta.url)).json()) as { +// Shared with moq-e2ee's `epoch_vectors`, so both parse and order alike. +const vectors = (await Bun.file(new URL("../../../rs/moq-e2ee/src/epoch.json", import.meta.url)).json()) as { valid: string[]; invalid: string[]; ordered: string[]; diff --git a/js/crypto/src/e2ee/epoch.ts b/js/e2ee/src/epoch.ts similarity index 96% rename from js/crypto/src/e2ee/epoch.ts rename to js/e2ee/src/epoch.ts index 5d54fca16b0..1a606cea19c 100644 --- a/js/crypto/src/e2ee/epoch.ts +++ b/js/e2ee/src/epoch.ts @@ -3,7 +3,7 @@ * instance announces it as its route's instance, so a subscriber reads it back from the * broadcast it resolved ({@link of}). A wire that carries no instance hands the subscriber one * its session minted, which is no epoch: the application supplies the epoch over its own - * authenticated channel then. Mirrors `moq_crypto::e2ee::Epoch`. + * authenticated channel then. Mirrors `moq_e2ee::Epoch`. * * @module */ diff --git a/js/crypto/src/e2ee/failure.ts b/js/e2ee/src/failure.ts similarity index 100% rename from js/crypto/src/e2ee/failure.ts rename to js/e2ee/src/failure.ts diff --git a/js/crypto/src/e2ee/generation-internal.ts b/js/e2ee/src/generation-internal.ts similarity index 100% rename from js/crypto/src/e2ee/generation-internal.ts rename to js/e2ee/src/generation-internal.ts diff --git a/js/crypto/src/e2ee/generation.ts b/js/e2ee/src/generation.ts similarity index 100% rename from js/crypto/src/e2ee/generation.ts rename to js/e2ee/src/generation.ts diff --git a/js/crypto/src/e2ee/group.ts b/js/e2ee/src/group.ts similarity index 100% rename from js/crypto/src/e2ee/group.ts rename to js/e2ee/src/group.ts diff --git a/js/crypto/src/e2ee/index.ts b/js/e2ee/src/index.ts similarity index 97% rename from js/crypto/src/e2ee/index.ts rename to js/e2ee/src/index.ts index e043464e5ba..37abd25f8b9 100644 --- a/js/crypto/src/e2ee/index.ts +++ b/js/e2ee/src/index.ts @@ -1,9 +1,9 @@ /** * End-to-end encryption for MoQ groups, datagrams, and track names. * - * Implements profile `moq-e2ee-00` from + * Implements profile `moq-e2ee-01-wip` from * [draft-lcurley-moq-e2ee](https://datatracker.ietf.org/doc/draft-lcurley-moq-e2ee/). Relays - * forward ciphertext; content keys never enter `@moq/net`. Mirrors `moq_crypto::e2ee` in Rust. + * forward ciphertext; content keys never enter `@moq/net`. Mirrors the Rust `moq-e2ee` crate. * * A {@link Credential} is what the application distributes out of band. Each publisher instance * calls {@link Credential.produce} to mint a {@link Generation.Producer} and wraps its `@moq/net` diff --git a/js/crypto/src/e2ee/internal.ts b/js/e2ee/src/internal.ts similarity index 95% rename from js/crypto/src/e2ee/internal.ts rename to js/e2ee/src/internal.ts index 5375dbfa9ed..1a54abf1748 100644 --- a/js/crypto/src/e2ee/internal.ts +++ b/js/e2ee/src/internal.ts @@ -1,7 +1,7 @@ // Package-private state the public modules share without exporting it. import type { Track as NetTrack } from "@moq/net"; -import type { Pump } from "../pump.ts"; import type { TrackKey } from "./key.ts"; +import type { Pump } from "./pump.ts"; import type { Terminal } from "./terminal.ts"; /** A track's grouped-frame and datagram keys. */ diff --git a/js/crypto/src/e2ee/key.ts b/js/e2ee/src/key.ts similarity index 100% rename from js/crypto/src/e2ee/key.ts rename to js/e2ee/src/key.ts diff --git a/js/crypto/src/e2ee/limits.ts b/js/e2ee/src/limits.ts similarity index 90% rename from js/crypto/src/e2ee/limits.ts rename to js/e2ee/src/limits.ts index ebfcce003fc..abe81cf2bee 100644 --- a/js/crypto/src/e2ee/limits.ts +++ b/js/e2ee/src/limits.ts @@ -1,17 +1,17 @@ /** Profile string, also the HKDF salt. */ -export const PROFILE = "moq-e2ee-00"; +export const PROFILE = "moq-e2ee-01-wip"; /** HKDF info prefix for opaque broadcast paths. */ -export const PATH_LABEL = "moq-e2ee-00 path"; +export const PATH_LABEL = "moq-e2ee-01-wip path"; /** HKDF info prefix for the HMAC-SHA-256 key that derives physical name nonces. */ -export const NAME_MAC_LABEL = "moq-e2ee-00 name-mac"; +export const NAME_MAC_LABEL = "moq-e2ee-01-wip name-mac"; /** HKDF info prefix for the AES-128-GCM key that seals physical names. */ -export const NAME_KEY_LABEL = "moq-e2ee-00 name-key"; +export const NAME_KEY_LABEL = "moq-e2ee-01-wip name-key"; /** HKDF info prefix for AEAD keys. */ -export const KEY_LABEL = "moq-e2ee-00 key"; +export const KEY_LABEL = "moq-e2ee-01-wip key"; /** AES-GCM tag length in bytes. */ export const TAG_LEN = 16; diff --git a/js/crypto/src/e2ee/name.ts b/js/e2ee/src/name.ts similarity index 100% rename from js/crypto/src/e2ee/name.ts rename to js/e2ee/src/name.ts diff --git a/js/crypto/src/pump.ts b/js/e2ee/src/pump.ts similarity index 100% rename from js/crypto/src/pump.ts rename to js/e2ee/src/pump.ts diff --git a/js/crypto/src/e2ee/secret.ts b/js/e2ee/src/secret.ts similarity index 100% rename from js/crypto/src/e2ee/secret.ts rename to js/e2ee/src/secret.ts diff --git a/js/crypto/src/e2ee/terminal.ts b/js/e2ee/src/terminal.ts similarity index 100% rename from js/crypto/src/e2ee/terminal.ts rename to js/e2ee/src/terminal.ts diff --git a/js/crypto/src/e2ee/track.ts b/js/e2ee/src/track.ts similarity index 99% rename from js/crypto/src/e2ee/track.ts rename to js/e2ee/src/track.ts index 961952ad9ea..005693e5870 100644 --- a/js/crypto/src/e2ee/track.ts +++ b/js/e2ee/src/track.ts @@ -4,12 +4,12 @@ * @module */ import type { Group as NetGroup, Track as NetTrack } from "@moq/net"; -import { Pump } from "../pump.ts"; import { checkGroup } from "./derive.ts"; import { Failure } from "./failure.ts"; import * as Group from "./group.ts"; import type { Reader, Writer } from "./internal.ts"; import type { TrackKey } from "./key.ts"; +import { Pump } from "./pump.ts"; import { Terminal } from "./terminal.ts"; /** diff --git a/js/crypto/src/e2ee/transport.test.ts b/js/e2ee/src/transport.test.ts similarity index 97% rename from js/crypto/src/e2ee/transport.test.ts rename to js/e2ee/src/transport.test.ts index c67b742d915..29be85eb621 100644 --- a/js/crypto/src/e2ee/transport.test.ts +++ b/js/e2ee/src/transport.test.ts @@ -3,7 +3,7 @@ import { expect, test } from "bun:test"; import { Duration } from "@moq/clock"; import { type Broadcast, Connection, Origin, type Path, Time } from "@moq/net"; // The in-memory WebTransport pair @moq/net tests with; not part of its published surface. -import { createMockTransportPair } from "../../../net/src/mock.ts"; +import { createMockTransportPair } from "../../net/src/mock.ts"; import * as Protected from "./broadcast.ts"; import { Credential } from "./credential.ts"; import * as Epoch from "./epoch.ts"; @@ -17,7 +17,7 @@ function credential(): Credential { return new Credential({ context: encoder.encode("example.com/meeting-123"), kid: 7, - secret: encoder.encode("moq-e2ee-00 test secret!!!!!!!!!"), + secret: encoder.encode("moq-e2ee-01-wip test secret!!!!!"), }); } diff --git a/js/crypto/src/e2ee/vectors.test.ts b/js/e2ee/src/vectors.test.ts similarity index 98% rename from js/crypto/src/e2ee/vectors.test.ts rename to js/e2ee/src/vectors.test.ts index fdbb4412c28..bf2596b9e8e 100644 --- a/js/crypto/src/e2ee/vectors.test.ts +++ b/js/e2ee/src/vectors.test.ts @@ -1,4 +1,4 @@ -// Every vector in drafts/moq-e2ee-00.json, run against the internal primitives. +// Every vector in drafts/moq-e2ee-01-wip.json, run against the internal primitives. import { expect, test } from "bun:test"; import { Credential } from "./credential.ts"; import { type Domain, decode, encode, nameKeyInfo, nameMacInfo, nonce, pad, pathInfo } from "./derive.ts"; @@ -11,7 +11,7 @@ import { expand } from "./secret.ts"; type Row = Record; -const vectors = (await Bun.file(new URL("../../../../drafts/moq-e2ee-00.json", import.meta.url)).json()) as { +const vectors = (await Bun.file(new URL("../../../drafts/moq-e2ee-01-wip.json", import.meta.url)).json()) as { profile: string; constants: Row; generation: Row; diff --git a/js/crypto/src/e2ee/window.ts b/js/e2ee/src/window.ts similarity index 100% rename from js/crypto/src/e2ee/window.ts rename to js/e2ee/src/window.ts diff --git a/js/crypto/test-dts/constructors.ts b/js/e2ee/test-dts/constructors.ts similarity index 55% rename from js/crypto/test-dts/constructors.ts rename to js/e2ee/test-dts/constructors.ts index ce6d3acc119..6e3d0f5952c 100644 --- a/js/crypto/test-dts/constructors.ts +++ b/js/e2ee/test-dts/constructors.ts @@ -1,16 +1,16 @@ -import { Consumer, Producer } from "../dist/e2ee/generation-internal.js"; -import { E2ee } from "../dist/index.js"; +import { Consumer, Producer } from "../dist/generation-internal.js"; +import { Credential, type Generation } from "../dist/index.js"; // @ts-expect-error A credential binds a consuming generation to an epoch. new Consumer(); // @ts-expect-error A credential mints a producing generation and its epoch. new Producer(); // @ts-expect-error The internal factory is not a package export, including type-only namespaces. -export type Factory = typeof E2ee.Generation.makeProducer; +export type Factory = typeof Generation.makeProducer; -const credential = new E2ee.Credential({ context: new Uint8Array(), kid: 1, secret: new Uint8Array(32) }); -const producer: E2ee.Generation.Producer = credential.produce(); -const consumer: E2ee.Generation.Consumer = credential.consume(producer.epoch); +const credential = new Credential({ context: new Uint8Array(), kid: 1, secret: new Uint8Array(32) }); +const producer: Generation.Producer = credential.produce(); +const consumer: Generation.Consumer = credential.consume(producer.epoch); void consumer.name("test"); // @ts-expect-error Construction stays private even with valid arguments. new Consumer(credential, producer.epoch); diff --git a/js/crypto/test-dts/tsconfig.json b/js/e2ee/test-dts/tsconfig.json similarity index 100% rename from js/crypto/test-dts/tsconfig.json rename to js/e2ee/test-dts/tsconfig.json diff --git a/js/crypto/tsconfig.build.json b/js/e2ee/tsconfig.build.json similarity index 100% rename from js/crypto/tsconfig.build.json rename to js/e2ee/tsconfig.build.json diff --git a/js/crypto/tsconfig.json b/js/e2ee/tsconfig.json similarity index 100% rename from js/crypto/tsconfig.json rename to js/e2ee/tsconfig.json diff --git a/js/justfile b/js/justfile index 90d77b770c7..0a71366eb6a 100644 --- a/js/justfile +++ b/js/justfile @@ -191,7 +191,7 @@ audio-warmup-bench: # Sweep E2EE frame size against writes in flight through the WebCrypto pump. e2ee-bench: uv run --no-project python ../sh/js/install.py frozen - bun crypto/bench/pump.ts + bun e2ee/bench/pump.ts # Sweep audio renditions x raw retention through native WebCodecs in Chromium. raw-audio-bench: diff --git a/nix/Cargo.nix b/nix/Cargo.nix index 09b8c4eff9a..5e6a170d2f1 100644 --- a/nix/Cargo.nix +++ b/nix/Cargo.nix @@ -190,6 +190,16 @@ rec { # File a bug if you depend on any for non-debug work! debug = internal.debugCrate { inherit packageId; }; }; + "moq-e2ee" = rec { + packageId = "moq-e2ee"; + build = internal.buildRustCrateWithFeatures { + packageId = "moq-e2ee"; + }; + + # Debug support which might change between releases. + # File a bug if you depend on any for non-debug work! + debug = internal.debugCrate { inherit packageId; }; + }; "moq-ffi" = rec { packageId = "moq-ffi"; build = internal.buildRustCrateWithFeatures { @@ -19015,25 +19025,10 @@ rec { "Luke Curley " ]; dependencies = [ - { - name = "base64"; - packageId = "base64 0.23.1"; - optional = true; - } - { - name = "bytes"; - packageId = "bytes"; - optional = true; - } { name = "data-encoding"; packageId = "data-encoding"; } - { - name = "kio"; - packageId = "kio"; - optional = true; - } { name = "moq-net"; packageId = "moq-net"; @@ -19067,16 +19062,106 @@ rec { name = "thiserror"; packageId = "thiserror 2.0.21"; } + { + name = "zeroize"; + packageId = "zeroize"; + optional = true; + features = [ "derive" ]; + } + ]; + devDependencies = [ + { + name = "hex"; + packageId = "hex"; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "tempfile"; + packageId = "tempfile"; + } + { + name = "workspace-hack"; + packageId = "workspace-hack"; + } + ]; + features = { + "cpu" = [ "dep:rind" ]; + "default" = [ "endpoint" ]; + "endpoint" = [ + "dep:moq-net" + "dep:rind" + "dep:zeroize" + ]; + "provider" = [ + "cpu" + "dep:rind-rustls" + "dep:rustls" + ]; + "serde" = [ "dep:serde" ]; + }; + resolvedDefaultFeatures = [ + "cpu" + "default" + "endpoint" + "provider" + "serde" + ]; + }; + "moq-e2ee" = rec { + crateName = "moq-e2ee"; + version = "0.0.26"; + edition = "2024"; + src = lib.cleanSourceWith { + filter = sourceFilter; + src = ../rs/moq-e2ee; + }; + libName = "moq_e2ee"; + authors = [ + "Luke Curley " + ]; + dependencies = [ + { + name = "base64"; + packageId = "base64 0.23.1"; + } + { + name = "bytes"; + packageId = "bytes"; + } + { + name = "kio"; + packageId = "kio"; + } + { + name = "moq-crypto"; + packageId = "moq-crypto"; + usesDefaultFeatures = false; + features = [ "cpu" ]; + } + { + name = "moq-net"; + packageId = "moq-net"; + } + { + name = "rind"; + packageId = "rind"; + features = [ "wipe" ]; + } + { + name = "thiserror"; + packageId = "thiserror 2.0.21"; + } { name = "uuid"; packageId = "uuid"; - optional = true; features = [ "v7" ]; } { name = "zeroize"; packageId = "zeroize"; - optional = true; features = [ "derive" ]; } ]; @@ -19096,9 +19181,8 @@ rec { features = [ "runtime" ]; } { - name = "moq-crypto"; - packageId = "moq-crypto"; - usesDefaultFeatures = false; + name = "moq-e2ee"; + packageId = "moq-e2ee"; features = [ "async" ]; } { @@ -19110,10 +19194,6 @@ rec { name = "serde_json"; packageId = "serde_json"; } - { - name = "tempfile"; - packageId = "tempfile"; - } { name = "tokio"; packageId = "tokio"; @@ -19131,43 +19211,9 @@ rec { } ]; features = { - "async" = [ "kio?/async" ]; - "cpu" = [ "dep:rind" ]; - "default" = [ - "endpoint" - "e2ee" - ]; - "e2ee" = [ - "cpu" - "dep:base64" - "dep:bytes" - "dep:kio" - "dep:moq-net" - "dep:rind" - "dep:uuid" - "dep:zeroize" - ]; - "endpoint" = [ - "dep:moq-net" - "dep:rind" - "dep:zeroize" - ]; - "provider" = [ - "cpu" - "dep:rind-rustls" - "dep:rustls" - ]; - "serde" = [ "dep:serde" ]; + "async" = [ "kio/async" ]; }; - resolvedDefaultFeatures = [ - "async" - "cpu" - "default" - "e2ee" - "endpoint" - "provider" - "serde" - ]; + resolvedDefaultFeatures = [ "async" ]; }; "moq-ffi" = rec { crateName = "moq-ffi"; diff --git a/package.json b/package.json index 2198a43c361..575644b9259 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "js/clock", "js/pattern", "js/auth", - "js/crypto", + "js/e2ee", "js/json", "js/stats", "js/obs", diff --git a/quest/m0/rind-adapters.md b/quest/m0/rind-adapters.md index 48df8a20dbb..5c5e6077478 100644 --- a/quest/m0/rind-adapters.md +++ b/quest/m0/rind-adapters.md @@ -111,7 +111,7 @@ rind 0.4 itself changes three things, of which MoQ uses two: `rg 'cpu::check|MissingFeature|UnsupportedCpu' rs` finds every site; at `985e8897` they are: - `moq_crypto::cpu::check()` callers: `rs/moq-crypto/src/provider.rs:22` - and `:48`, `rs/moq-crypto/src/e2ee/credential.rs:60`, + and `:48`, `rs/moq-e2ee/src/credential.rs:60`, `rs/moq-auth/src/crypto.rs:6`, `rs/moq-hls/src/server/mod.rs:188`, `rs/moq-hls/src/export/mod.rs:147`, `rs/moq-quic/src/config/endpoint.rs:122`, `rs/moq-rtmp/src/dial.rs:84` @@ -119,7 +119,7 @@ rind 0.4 itself changes three things, of which MoQ uses two: `rs/moq-uring/src/quic/driver/mod.rs:126`, `rs/moq-webrtc/src/session.rs:674`, and `rs/qmux/src/tls.rs:76`. - The `UnsupportedCpu` error variants and re-export that wrap it, in - moq-auth, moq-crypto's e2ee, moq-hls, moq-quic, moq-rtmp, moq-tokio + moq-auth, moq-e2ee, moq-hls, moq-quic, moq-rtmp, moq-tokio (`rs/moq-tokio/src/crypto.rs:7`), moq-uring, moq-webrtc, and qmux, with the doc comments that name it. - Agreement keys keep their public key diff --git a/quest/m2/README.md b/quest/m2/README.md index f53f25a4133..250bbe659ab 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -42,8 +42,8 @@ removal, a rename, or a wire, catalog, or format change that is free until - **Unused API.** [One sweep per area](/quest/m2/unused-api/README.md), each item re-checked for a downstream caller first. - **Relay and transports.** [Congestion names](/quest/m2/congestion-names.md). -- **Auth and crypto.** End-to-end encryption - [is its own unpublished crate again](/quest/m2/e2ee-crate.md); its +- **Auth and crypto.** End-to-end encryption is its own unpublished crate again + ([moq-dev/moq#8947](https://github.com/moq-dev/moq/pull/8947)); its [finished format](/quest/m3/e2ee-format.md) follows in m3. - **Catalog, drafts, and formats.** [hang-04](/quest/m2/hang04/README.md) (the `sync` section, a version per entry, no video `warmup`, `m2ts` under diff --git a/quest/m2/e2ee-crate.md b/quest/m2/e2ee-crate.md deleted file mode 100644 index 0f089f89d1c..00000000000 --- a/quest/m2/e2ee-crate.md +++ /dev/null @@ -1,110 +0,0 @@ -# [M] End-to-end encryption is its own unpublished crate again - -## Goal - -The end-to-end encryption code lives in `rs/moq-e2ee` (crate `moq-e2ee`, -`publish = false`), not in `moq-crypto`, and the 0.22 cut publishes none of -it. `moq-crypto` is the crypto the transports share: the rind provider and -the CPU check, with no `e2ee` feature, and it no longer pulls `moq-net`, -`uuid`, or `base64` into any build for encryption. The docs stop saying a -hang broadcast can be encrypted, since no publisher, player, CLI, or binding -can make or play one. Nothing left in the tree mentions the deleted signing -module. - -## Plan - -Decided 2026-11-16 (maintainer, /quest-plan of the pre-cut audit): - -- ✅ E2EE moves back to its own `moq-e2ee` crate, because it is "not ready - yet" (rejected: shipping it in moq-crypto 0.22 as a default feature under - a new profile string, the pick made earlier the same day; leaving it and - marking the module outside semver). This reverses the E2EE half of the - 2026-11-02 merge - ([moq-dev/moq#7702](https://github.com/moq-dev/moq/pull/7702)), which - joined two wrappers that shared a timestamp check: signing left in - [moq-dev/moq#8855](https://github.com/moq-dev/moq/pull/8855), so the - reason is gone. -- ✅ `moq-e2ee` is unpublished at the cut and until - [the finished format](/quest/m3/e2ee-format.md) lands (rejected: - publishing it as it stands, which would put an interim format out under - `moq-e2ee-01` and force a third label on the finished one). -- ✅ The docs stop advertising encrypted hang. -- The format and API changes the audit decided are not lost: they are - [the finished format](/quest/m3/e2ee-format.md)'s, after the cut. - -Facts found by the audit: - -- Nothing uses it: `grep -rl 'moq_crypto::e2ee' rs --include=*.rs` finds no - file outside `rs/moq-crypto`, and no JS package imports `@moq/crypto`, - which is `private` at 0.0.0 (`js/crypto/package.json:4,12`). No catalog - field, CLI flag, or binding names it. -- It is a default feature (`rs/moq-crypto/Cargo.toml:21`) of the crate all - ten transport and gateway crates depend on for `cpu` or `provider`, so - each planned break to the wrappers - ([moq-e2ee implements the moq-net traits](/quest/m5/net-wrap/e2ee.md)) - would be a breaking release of that crate. -- crates.io has `moq-e2ee` 0.0.25 (2026-11-11, from `release`), profile - `moq-e2ee-00` with the old derivation: one-way physical names from - `HKDF-Expand(prk, "moq-e2ee-00 name", 16)`. `main` uses the same label - (`rs/moq-crypto/src/e2ee/limits.rs:2`) for AES-GCM reversible names and - keys bound to the semantic name, so the two agree on a profile and a path - and then find no track. `moq-crypto` has never been published (checked - 2026-11-12). -- The docs promise it: `doc/index.md:56` ("end-to-end encrypt your - content"), `doc/concept/hang.md:13-17` and its Encryption section - (`:227-241`), `doc/lib/rs/index.md:42`, and `doc/setup/repository.md:34`. -- Signing residue: the `signature` keyword (`rs/moq-crypto/Cargo.toml:12`), - `rs/moq-crypto/MIGRATE.md:23-38` on `moq_crypto::sign` and `moq-sign`, - which never shipped, and - [the feature list](/quest/m3/release/feature-flags.md)'s `sign` feature. - -For the PR: - -- Move `rs/moq-crypto/src/e2ee`, its tests, `benches/protect.rs`, and the - E2EE half of the README to `rs/moq-e2ee`, at a version above crates.io's - 0.0.25 so the later publish needs no jump. It depends on `moq-crypto` for - `cpu` only, until - [moq-dev/moq#8432](https://github.com/moq-dev/moq/pull/8432) removes that - check. Update `rs/justfile` (`crypto-key` and the coroutine and doc - lines that name `e2ee`), `.github/workflows/release-gate.yml`, the - Nightly bench, `nix/Cargo.nix`, and `sh/api-diff` if it lists the crate. -- `moq-crypto` keeps `cpu`, `provider`, and `endpoint`; its description and - keywords say so. `endpoint` and the mandatory `data-encoding` dependency - are [the route switch](/quest/m2/multicast/switch.md)'s to delete with the - Route Key, not this quest's. -- Recommended, not decided: `js/crypto` becomes `js/e2ee` (`@moq/e2ee`, - still `private`), so the two halves share a name as AGENTS.md asks. It is - free while the package is unpublished. -- Recommended, not decided: rename the profile on `main` to - `moq-e2ee-01-wip` here (constant, salt, labels, `drafts/moq-e2ee-00.json` - and `.ts`, the draft's Profile Version section), so nothing on `main` - calls two derivations `moq-e2ee-00`, and an unpublished `-wip` label may - keep changing. [The finished format](/quest/m3/e2ee-format.md) drops the - suffix. The draft's changelog already heads the new derivation - `draft-lcurley-moq-e2ee-01`. -- Docs: `doc/index.md` and `doc/concept/hang.md` describe only what ships, - so the Encryption section and the opening paragraph's sentence go, and - `doc/lib/rs/index.md` and `doc/setup/repository.md` list `moq-e2ee` as - unpublished and experimental or drop the row. The draft's own page stays: a - draft is not a shipped feature. -- Residue: drop the `signature` keyword, and delete the `MIGRATE.md` - entries for names that never shipped (`moq_crypto::sign`, `moq-sign`, the - `sign` and `e2ee` features); - [the migrate audit](/quest/m3/release/migrate-audit.md) owns the rest of - that file. `rs/moq-crypto/MIGRATE.md` then has nothing to - say about `moq-e2ee` users, who have nowhere to move yet. -- `release` still holds `rs/moq-e2ee` at 0.0.25 and publishes it. After the - cut it holds this crate with `publish = false`; check release-plz proposes - nothing for it. -- `just check` and `just test interop --all` do not change behavior; the - proof is that the workspace builds with every feature set `rs/justfile` - checks and that `cargo tree -p moq-quic` shows no `uuid`. - -Public API: `moq-crypto` loses its `e2ee` module and feature before its -first publish; `moq-e2ee` is unpublished, so nothing published breaks. -Wire: none (the profile label, if renamed, is unpublished). - -## Related - -- [The finished E2EE format](/quest/m3/e2ee-format.md) - the format and API changes, and the publish, that this defers -- [Retired package names](/quest/m3/release/retired-names.md) - `moq-e2ee` is no longer a retired name diff --git a/quest/m2/time-addressing/js.md b/quest/m2/time-addressing/js.md index 9cd6d816e39..70d4144e071 100644 --- a/quest/m2/time-addressing/js.md +++ b/quest/m2/time-addressing/js.md @@ -46,7 +46,7 @@ a later rename; keeping `sequence`). Once groups are keyed by `start`, `Frame.Consumer.sequence` (`js/net/src/frame.ts:251`), and `Group.Consumer.readFrameSequence` and `tryReadFrameSequence` (`js/net/src/group.ts:1406`, `:1363`), whose result field is `sequence`. -Callers outside `js/net/src`: `js/crypto/src/e2ee/group.ts` (2) and two +Callers outside `js/net/src`: `js/e2ee/src/group.ts` (2) and two benches. ✅ In the same PR, `Time.keyOf` becomes a getter on `Timestamp` (rejected: keeping the free function). It is an `export let` assigned from inside the class (`js/net/src/time.ts:53`, `:128`) with one caller, diff --git a/quest/m3/crates-trusted-publisher.md b/quest/m3/crates-trusted-publisher.md index 038a85a67f7..fad19aae074 100644 --- a/quest/m3/crates-trusted-publisher.md +++ b/quest/m3/crates-trusted-publisher.md @@ -64,7 +64,7 @@ retired in favor of moq-crypto, gets no trusted publisher; a later change took it out of the workspace instead. Reversed 2026-11-16 (maintainer, /quest-plan of the pre-cut audit): moq-e2ee is a crate again, unpublished at the cut -([the crate move](/quest/m2/e2ee-crate.md)), and gets its trusted publisher +([the crate move](https://github.com/moq-dev/moq/pull/8947)), and gets its trusted publisher when [the finished format](/quest/m3/e2ee-format.md) publishes it, which that quest's `Waiting` item tracks. diff --git a/quest/m3/e2ee-format.md b/quest/m3/e2ee-format.md index 13f4c8e9542..890d2eca215 100644 --- a/quest/m3/e2ee-format.md +++ b/quest/m3/e2ee-format.md @@ -46,10 +46,10 @@ Decided 2026-11-16 (maintainer, /quest-plan of the pre-cut audit): the scheme and dropped it: a relay that strips the tag to transcode has defeated the purpose. - ✅ The finished format is `moq-e2ee-01`, and the crate stays unpublished - until it is (see [the crate move](/quest/m2/e2ee-crate.md)). + until it is (see [the crate move](https://github.com/moq-dev/moq/pull/8947)). -Facts found by the audit (paths as of 2026-11-16, before the crate move, so -under `rs/moq-crypto/src/e2ee`): +Facts found by the audit (paths as of 2026-11-16, under `rs/moq-e2ee/src` +since the crate move): - Broadcast swap. `scope` is `context || epoch || kid` (`generation.rs:171-176`), and the semantic broadcast name enters only the @@ -142,13 +142,18 @@ types, and the vectors regenerate once): and a credential naming another profile is refused. Delete the draft's compression rule and the Catalogs section's `.z` sibling rule; an application compresses its own plaintext. -- Label: rename to `moq-e2ee-01` everywhere (constant, salt, labels, the - vector file and its `profile` field, `drafts/moq-e2ee-00.ts`, both +- Label: drop the `-wip` suffix from `moq-e2ee-01-wip` everywhere + (constant, salt, labels, the vector file's name and its `profile` field, + `drafts/moq-e2ee-01-wip.ts`, the draft's Profile Version section, both READMEs, [the epic](/quest/m5/e2ee/README.md)). While in the draft: it still says "the group's sequence" for the nonce, `invalid_secret` has no Rust form, and the datagram allowance is 28 bytes, not the epic's 24. -- Publish: remove `publish = false`, and restore the doc rows - [the crate move](/quest/m2/e2ee-crate.md) dropped, still marked +- Publish: remove `publish = false` and the READMEs' unpublished notes, + give `rs/moq-e2ee` a `MIGRATE.md` for users of crates.io's 0.0.25 (the + entries `rs/moq-crypto/MIGRATE.md` held before the crate move, in + `git show 6488ce6b87:rs/moq-crypto/MIGRATE.md`, with their paths back to + `moq_e2ee::`, plus this format's breaks), and restore the doc rows + [the crate move](https://github.com/moq-dev/moq/pull/8947) dropped, still marked experimental. Submitting the draft's -01 revision to the datatracker is the maintainer's, below. @@ -161,10 +166,6 @@ and moq-lite: none. - Maintainer: submit `draft-lcurley-moq-e2ee-01` to the datatracker once the PR merges, and add a crates.io trusted publisher for `moq-e2ee` (repository `moq-dev/moq`, workflow `release-rs.yml`, environment `publish`); both need a login an agent does not hold. Done when the datatracker shows -01 and a `release-rs.yml` run publishes `moq-e2ee` through OIDC. -## Required - -- [End-to-end encryption is its own unpublished crate again](/quest/m2/e2ee-crate.md) - the `moq-e2ee` crate this changes and publishes - ## Related - [End-to-end encrypted MoQ](/quest/m5/e2ee/README.md) - the questline that builds publishers and players on this format diff --git a/quest/m3/release/cut.md b/quest/m3/release/cut.md index 9c8268a70b1..e0a64c0df03 100644 --- a/quest/m3/release/cut.md +++ b/quest/m3/release/cut.md @@ -219,10 +219,13 @@ Decided 2026-11-16 (maintainer, /quest-plan of the pre-cut audit): method to an existing binding object, which the API diff counts as a break once 0.22 is published. - ✅ End-to-end encryption does not publish at this cut - ([its own unpublished crate](/quest/m2/e2ee-crate.md)), so `moq-e2ee` is - no longer a retired name, and the paragraph above about publishing a - pointer above 0.0.25 no longer applies: the name is held for - [the finished format](/quest/m3/e2ee-format.md). + ([its own unpublished crate](https://github.com/moq-dev/moq/pull/8947)), + so `moq-e2ee` is no longer a retired name, and the paragraph above about + publishing a pointer above 0.0.25 no longer applies: the name is held for + [the finished format](/quest/m3/e2ee-format.md). `release` still holds + `rs/moq-e2ee` at 0.0.25 and publishes it; once the cut merges `main` into + `release`, its copy is `publish = false` at 0.0.26. Check that + release-plz proposes nothing for `moq-e2ee`. - ✅ The hand-written C API publishes as `libmoq` 0.22 ([its final line](/quest/m2/libmoq-name.md)), reversing 2026-10-25, so the cut gate's "hand-written `moq-c`" below reads `libmoq`, and the two diff --git a/quest/m3/release/feature-flags.md b/quest/m3/release/feature-flags.md index 2975eb1e483..16811f98a6e 100644 --- a/quest/m3/release/feature-flags.md +++ b/quest/m3/release/feature-flags.md @@ -47,7 +47,7 @@ judged, so this pass reads only the difference: ([moq-dev/moq#8851](https://github.com/moq-dev/moq/pull/8851)). - Kept, with the reason a new feature has to match: - `async` in kio, moq-net, hang, moq-json, moq-mux, moq-stats, moq-hls, - moq-crypto, and moq-auth: the poll-first design (decided 2026-11-05 in + moq-e2ee, and moq-auth: the poll-first design (decided 2026-11-05 in [moq-dev/moq#7607](https://github.com/moq-dev/moq/pull/7607)), checked by `just rs coroutines`. kio's `runtime`, `macros`, `sim`, and `manual` follow it. @@ -62,7 +62,8 @@ judged, so this pass reads only the difference: of moq-quic's graph, a layering need rather than a trim. Corrected 2026-11-16: `sign` left in [moq-dev/moq#8855](https://github.com/moq-dev/moq/pull/8855), and `e2ee` - leaves with [the crate move](/quest/m2/e2ee-crate.md). + left with the crate move + ([moq-dev/moq#8947](https://github.com/moq-dev/moq/pull/8947)). - `serde` in kio, moq-pattern, and moq-crypto: an optional dependency, by ecosystem convention. - moq-video's `capture`: device I/O the bindings deliberately leave to the diff --git a/quest/m3/release/migrate-audit.md b/quest/m3/release/migrate-audit.md index e4e3662d57c..db5e59f9b9e 100644 --- a/quest/m3/release/migrate-audit.md +++ b/quest/m3/release/migrate-audit.md @@ -32,6 +32,14 @@ m1 quest on 2026-10-22. `unused()` rejecting on close is moot, and "`producer.unused()` is `producer.demand().unused()`" should point at `demand().wanted`. + And `rs/moq-auth/MIGRATE.md`'s "Mesh endpoints use the signing public + key" names `moq_crypto::sign`, which + [moq-dev/moq#8855](https://github.com/moq-dev/moq/pull/8855) deleted, for + `moq_auth::mesh`, which + [moq-dev/moq#8756](https://github.com/moq-dev/moq/pull/8756) removed: + drop it, or correct it against the published moq-auth. `sh/migrate.sh` + refuses that edit outside the cut, so + [moq-dev/moq#8947](https://github.com/moq-dev/moq/pull/8947) left it here. - Run the API-diff report on the cut PR and read the diff of the hand-written binding wrappers (`py/moq-rs`, `kt/moq`, `dart/moq`, `go/wrapper`, `swift`, `cpp/moq`, `cpp/obs`) and of each binary's flags, diff --git a/quest/m4/net-broadcast-requests.md b/quest/m4/net-broadcast-requests.md index ab166ab5aac..dec736b0e7e 100644 --- a/quest/m4/net-broadcast-requests.md +++ b/quest/m4/net-broadcast-requests.md @@ -11,7 +11,7 @@ front from one broadcast, on demand, the way Rust does. Split 2026-11-03 (maintainer) from [JS undeclared track names](/quest/m5/e2ee/js-undeclared-names.md), which -keeps the `@moq/crypto` half and now requires this. Kixel's T3 host needs +keeps the `@moq/e2ee` half and now requires this. Kixel's T3 host needs only the plaintext half: without it, one environment broadcast would need a track per thread created up front, so T3 claims a broadcast per entity instead and can collapse to one once this lands. Today the request pull diff --git a/quest/m5/e2ee/README.md b/quest/m5/e2ee/README.md index 24239b97052..dfd45e58715 100644 --- a/quest/m5/e2ee/README.md +++ b/quest/m5/e2ee/README.md @@ -8,9 +8,9 @@ Every application payload and semantic track name is confidential and authentica ## Plan -Decided 2026-11-16 (maintainer, /quest-plan of the pre-cut audit): E2EE is "not ready yet". It lives in its own unpublished `moq-e2ee` crate again ([the crate move](/quest/m2/e2ee-crate.md)), and [the finished format](/quest/m3/e2ee-format.md) ships as profile `moq-e2ee-01` before any quest in this epic builds on it. That quest changes decisions recorded below, each marked where it stands: keys bind the semantic broadcast name, each group has its own key (no per-key limits), the per-track wrap is public, `Epoch` is `moq_net::Instance`, and the profile carries no compression. Encryption stays in the payload, invisible to relays, with nothing on the moq-net layer. +Decided 2026-11-16 (maintainer, /quest-plan of the pre-cut audit): E2EE is "not ready yet". It lives in its own unpublished `moq-e2ee` crate again ([the crate move](https://github.com/moq-dev/moq/pull/8947)), and [the finished format](/quest/m3/e2ee-format.md) ships as profile `moq-e2ee-01` before any quest in this epic builds on it. That quest changes decisions recorded below, each marked where it stands: keys bind the semantic broadcast name, each group has its own key (no per-key limits), the per-track wrap is public, `Epoch` is `moq_net::Instance`, and the profile carries no compression. Encryption stays in the payload, invisible to relays, with nothing on the moq-net layer. -The contract is [draft-lcurley-moq-e2ee](/drafts/draft-lcurley-moq-e2ee.md), profile `moq-e2ee-00`, with `drafts/moq-e2ee-00.json` as the shared primitive vectors. It starts from IETF Secure Objects where the object model maps exactly, specifies the moq-lite and datagram bindings that draft does not cover, and records intentional differences from SFrame and the experimental `moq-secure` format linked from [#3023](https://github.com/moq-dev/moq/issues/3023). +The contract is [draft-lcurley-moq-e2ee](/drafts/draft-lcurley-moq-e2ee.md), profile `moq-e2ee-01-wip` (`moq-e2ee-00` is the published draft's), with `drafts/moq-e2ee-01-wip.json` as the shared primitive vectors. It starts from IETF Secure Objects where the object model maps exactly, specifies the moq-lite and datagram bindings that draft does not cover, and records intentional differences from SFrame and the experimental `moq-secure` format linked from [#3023](https://github.com/moq-dev/moq/issues/3023). ### Security boundary @@ -71,7 +71,7 @@ Noted 2026-10-31 from [moq-dev/moq#7307](https://github.com/moq-dev/moq/pull/730 neither the e2ee wrapper nor the trait mirror has them. Add them to the wrapper once moq-net does. -Before `@moq/crypto` is first published, add its entrypoints to the API +Before `@moq/e2ee` is first published, add its entrypoints to the API Extractor declaration checks, which analyze only published packages since [moq-dev/moq#6794](https://github.com/moq-dev/moq/pull/6794). diff --git a/quest/m5/e2ee/consumer.md b/quest/m5/e2ee/consumer.md index a6ddcef5a92..5168ab9fb48 100644 --- a/quest/m5/e2ee/consumer.md +++ b/quest/m5/e2ee/consumer.md @@ -32,7 +32,7 @@ What remains here: - Rust and JS only (decided 2026-10-20, maintainer): the e2ee publisher has no moq-ffi half either, so an FFI consumer waits for a quest that adds both. -Public API: an e2ee consumer entry point in `moq-e2ee` and `@moq/crypto`. +Public API: an e2ee consumer entry point in `moq-e2ee` and `@moq/e2ee`. Wire: none. ## Required diff --git a/quest/m5/e2ee/js-undeclared-names.md b/quest/m5/e2ee/js-undeclared-names.md index 7ebd8e52425..257864f8ef9 100644 --- a/quest/m5/e2ee/js-undeclared-names.md +++ b/quest/m5/e2ee/js-undeclared-names.md @@ -2,7 +2,7 @@ ## Goal -`@moq/crypto`'s broadcast producer answers requests for track names it never +`@moq/e2ee`'s broadcast producer answers requests for track names it never created, under semantic names, through `@moq/net`'s public broadcast request handler, as `moq_e2ee::broadcast::Requests` does in Rust. A JS application then serves on-demand tracks from a plaintext or encrypted @@ -15,8 +15,8 @@ Decided with the maintainer on 2026-10-24: - One quest, both halves; amended 2026-11-03 (maintainer): the `@moq/net` half moved to [its own quest](/quest/m4/net-broadcast-requests.md), which plaintext users (Kixel's T3 host) need first, and this keeps the - `@moq/crypto` half. -- `@moq/crypto` mirrors the Rust handler exactly: it opens each request's + `@moq/e2ee` half. +- `@moq/e2ee` mirrors the Rust handler exactly: it opens each request's physical name, claims it, and yields a request whose `name` is semantic. A name that does not open is answered as missing and keeps no state. A re-requested or re-created name resumes above its high-water marks, as in @@ -30,9 +30,9 @@ Decided with the maintainer on 2026-10-24: `requests_serve_a_dropped_name_above_its_marks` tests: a relay-forged name, an older epoch's name, and a burst of forged names that leaves no state behind. -Public API: a request handler on `@moq/crypto`'s broadcast producer. Wire: none. +Public API: a request handler on `@moq/e2ee`'s broadcast producer. Wire: none. ## Required - [`@moq/net` broadcasts expose their requests](/quest/m4/net-broadcast-requests.md) - the public handler this wraps; split out 2026-11-03 so plaintext users get it first -- [JS mirror](/quest/m5/net-wrap/js.md) - the `@moq/net` interfaces the `@moq/crypto` wrappers implement +- [JS mirror](/quest/m5/net-wrap/js.md) - the `@moq/net` interfaces the `@moq/e2ee` wrappers implement diff --git a/quest/m5/ffi-e2ee.md b/quest/m5/ffi-e2ee.md index ceab50a1bd9..f60590ca1ae 100644 --- a/quest/m5/ffi-e2ee.md +++ b/quest/m5/ffi-e2ee.md @@ -4,7 +4,7 @@ The Swift and Kotlin bindings publish and consume moq-e2ee protected broadcasts under an application-supplied `(context, kid, secret)` credential, -interoperating with `@moq/crypto` in both directions, with the same epoch rules +interoperating with `@moq/e2ee` in both directions, with the same epoch rules and typed authentication failures as Rust and JS. ## Plan diff --git a/quest/m5/net-wrap/e2ee.md b/quest/m5/net-wrap/e2ee.md index 655e517d92e..2dabffe8452 100644 --- a/quest/m5/net-wrap/e2ee.md +++ b/quest/m5/net-wrap/e2ee.md @@ -48,7 +48,7 @@ the reverse (decided 2026-10-20, maintainer): Subscribe ID, Sequence, and Timestamp, since datagram tracks dropped the relayed `ietf` fields and the Inflated Size from it, so `MAX_DATAGRAM_HEADER` (28, `rs/moq-e2ee/src/limits.rs` and - `js/crypto/src/e2ee/limits.ts`) covers moq-lite. [moq-dev/moq#7959](https://github.com/moq-dev/moq/pull/7959) + `js/e2ee/src/limits.ts`) covers moq-lite. [moq-dev/moq#7959](https://github.com/moq-dev/moq/pull/7959) restores moq-transport datagrams using existing OBJECT_DATAGRAM framing, without adding header fields. Re-check the allowance if that framing changes. - Ranges: every moq-net range starts at a group's first frame diff --git a/quest/m5/net-wrap/js.md b/quest/m5/net-wrap/js.md index f33ba22eac8..f3ddd26b8c5 100644 --- a/quest/m5/net-wrap/js.md +++ b/quest/m5/net-wrap/js.md @@ -4,7 +4,7 @@ `@moq/net` exports interfaces with the Rust traits' names and methods, and `@moq/hang`, `@moq/publish`, and `@moq/watch` accept them where they take a -concrete broadcast, track, or group today. `@moq/crypto`'s wrappers implement +concrete broadcast, track, or group today. `@moq/e2ee`'s wrappers implement them, so a browser publisher or player handles an encrypted broadcast without its own decryption path. @@ -16,7 +16,7 @@ its own decryption path. - Take the interfaces only where a wrapper must pass through, as needed: `@moq/hang`'s catalog and container code, `@moq/publish`'s broadcast, and `@moq/watch`'s subscriptions. -- `@moq/crypto`'s broadcast, track, and group wrappers adapt to `@moq/net`'s +- `@moq/e2ee`'s broadcast, track, and group wrappers adapt to `@moq/net`'s method shapes, as moq-e2ee does in Rust, with its errors mapped to `@moq/net`'s. Like moq-e2ee, it does not compress (decided 2026-11-16, maintainer: the profile carries no compression): it publishes the @@ -26,9 +26,9 @@ its own decryption path. - Demand and preference cross the wrapper: a publisher with no viewer through an encrypted track stays idle. - Test publish and watch round trips through a pass-through wrapper and - through `@moq/crypto`. + through `@moq/e2ee`. -Public API: new `@moq/net` interfaces; `@moq/crypto` wrapper signatures change. +Public API: new `@moq/net` interfaces; `@moq/e2ee` wrapper signatures change. Wire: none. ## Required diff --git a/rs/justfile b/rs/justfile index 29a6debb5c2..995d4749849 100644 --- a/rs/justfile +++ b/rs/justfile @@ -293,8 +293,10 @@ coroutines: run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-hls --no-deps --no-default-features run bash sh/rs/coroutines.sh moq-stats -- --no-default-features run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-stats --no-deps --no-default-features - run bash sh/rs/coroutines.sh moq-crypto -- --no-default-features --features endpoint,e2ee,provider,serde - run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-crypto --no-deps --no-default-features --features endpoint,e2ee,provider,serde + run bash sh/rs/coroutines.sh moq-crypto -- --no-default-features --features endpoint,provider,serde + run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-crypto --no-deps --no-default-features --features endpoint,provider,serde + run bash sh/rs/coroutines.sh moq-e2ee + run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-e2ee --no-deps run bash sh/rs/coroutines.sh rs/moq-auth/Cargo.toml -- --no-default-features finish @@ -306,7 +308,7 @@ crypto-key: key_only_dependencies() { graph=$(cargo tree --locked -p moq-crypto --no-default-features --features serde -e normal --prefix none) || return if grep -E '^moq-net ' <<<"$graph"; then - echo "moq-crypto without endpoint or e2ee must not depend on moq-net" >&2 + echo "moq-crypto without endpoint must not depend on moq-net" >&2 return 1 fi } @@ -579,7 +581,7 @@ codspeed shard: --bench parameter_sets --bench sync --bench ts_programs --bench ts_schedule --bench ts_video ;; rest) - build -p kio -p moq-audio -p moq-crypto -p moq-json -p moq-pattern -p moq-quic -p moq-rtmp \ + build -p kio -p moq-audio -p moq-e2ee -p moq-json -p moq-pattern -p moq-quic -p moq-rtmp \ --features moq-json/bench,moq-quic/fuzz \ --bench tasks --bench waiter --bench bus --bench protect --bench codec --bench table \ --bench matching --bench endpoint --bench receive --bench sent_packets --bench streams \ diff --git a/rs/moq-crypto/Cargo.toml b/rs/moq-crypto/Cargo.toml index fbb0180fe70..52c55469513 100644 --- a/rs/moq-crypto/Cargo.toml +++ b/rs/moq-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moq-crypto" -description = "Cryptography for MoQ: end-to-end encryption, the endpoint key, and the rind provider the transports share." +description = "Cryptography the MoQ crates share: the endpoint key, the rind provider, and the CPU check." authors = ["Luke Curley "] repository = "https://github.com/moq-dev/moq" license = "MIT OR Apache-2.0" @@ -9,63 +9,40 @@ version = "0.0.11" edition = "2024" rust-version.workspace = true -keywords = ["quic", "webtransport", "encryption", "signature", "live"] +keywords = ["quic", "webtransport", "tls", "ed25519", "live"] categories = ["cryptography", "multimedia", "network-programming"] [package.metadata.docs.rs] all-features = true [features] -# Without `endpoint` or `e2ee`, the crate holds only `endpoint::PublicKey`, the endpoint ID, and its +# Without `endpoint`, the crate holds only `endpoint::PublicKey`, the endpoint ID, and its # z-base-32 text: no `moq-net` and no rind, for crates that only name endpoints. -default = ["endpoint", "e2ee"] +default = ["endpoint"] # The persistent `endpoint::SecretKey`, which converts to `moq_net::origin::RouteKey`. endpoint = ["dep:moq-net", "dep:rind", "dep:zeroize"] -# End-to-end encryption: the `e2ee` module. -e2ee = ["cpu", "dep:base64", "dep:bytes", "dep:kio", "dep:moq-net", "dep:rind", "dep:uuid", "dep:zeroize"] # CPU support and its shared error need only rind. cpu = ["dep:rind"] # The rustls provider adds TLS without needing `moq-net`. provider = ["cpu", "dep:rind-rustls", "dep:rustls"] # `endpoint::PublicKey` serializes as its canonical z-base-32 text. serde = ["dep:serde"] -# Generated async wrappers for the `e2ee` poll methods. Enable where you `.await` them. -async = ["kio?/async"] [dependencies] -base64 = { workspace = true, optional = true } -bytes = { workspace = true, optional = true } data-encoding = { workspace = true } -kio = { workspace = true, optional = true } moq-net = { workspace = true, optional = true } rind = { workspace = true, optional = true } rind-rustls = { workspace = true, optional = true } rustls = { version = "0.23", default-features = false, features = ["std"], optional = true } serde = { workspace = true, optional = true } thiserror = { workspace = true } -uuid = { workspace = true, optional = true } zeroize = { workspace = true, optional = true } [dev-dependencies] -criterion = { package = "bench-harness", path = "../bench-harness" } hex = { workspace = true } -kio = { workspace = true, features = ["runtime"] } -# Compile the generated wrappers used by the tests and benches, keeping the features they pick. -moq-crypto = { path = ".", default-features = false, features = ["async"] } -moq-net = { path = "../moq-net", features = ["async"] } serde_json = { workspace = true } tempfile = { workspace = true } -tokio = { workspace = true, features = ["macros", "rt", "sync", "test-util", "time"] } workspace-hack = { path = "../workspace-hack" } -[[bench]] -name = "protect" -harness = false -required-features = ["e2ee"] - -[[test]] -name = "transport" -required-features = ["e2ee"] - [lints] workspace = true diff --git a/rs/moq-crypto/MIGRATE.md b/rs/moq-crypto/MIGRATE.md deleted file mode 100644 index 5acd000a297..00000000000 --- a/rs/moq-crypto/MIGRATE.md +++ /dev/null @@ -1,73 +0,0 @@ -# Migrating moq-crypto - -How to update your code for each breaking change, newest first. - -## Unreleased - -### Shared unsupported CPU error - -`e2ee::Error::Unsupported(String)` is now `UnsupportedCpu(cpu::UnsupportedCpu)`. The shared `UnsupportedCpu` type and `check()` move from `provider` to `cpu`, enabled by the new `cpu` feature and by `e2ee` and `provider`. `cpu` needs only rind; `provider` adds rustls. - -### Async wrappers are opt-in - -Enable the `async` Cargo feature to keep awaiting `read_frame`, `recv_group`, `recv`, -`requested_track`, `requested`, and `closed`: -`moq-crypto = { version = "...", features = ["async"] }`. This also applies with -`default-features = false`. The feature is off by default; the matching `poll_*` methods stay -available without it. Signatures, ciphertext, and track names are unchanged. - -### Datagrams are their own track kind ([#7752](https://github.com/moq-dev/moq/pull/7752)) - -`e2ee::track::Producer::{append_datagram, insert_datagram}` and `e2ee::track::Consumer::{poll_recv_datagram, recv_datagram}` are removed. Create a datagram track with `e2ee::broadcast::Producer::create_datagrams(name, info)` and read it with `e2ee::broadcast::Consumer::datagrams(name)`, which return `datagram::Producer` (`append`, `insert`) and `datagram::Consumer` (`recv`, yielding the same `datagram::Event`). Its sequence is its own, not the stream track's group counter, and its key domain stays separate. - -### Features gate signing and encryption - -The `sign` and `e2ee` modules sit behind default features of the same names. -A dependency with default features off keeps only `sign::PublicKey` and `sign::InvalidKey`; enable `e2ee` or `sign` for the rest. -`sign::PublicKey` gains public `from_bytes` and `as_bytes`, and the `serde` feature serializes it as its z-base-32 text. - -### moq-e2ee and moq-sign are moq-crypto (#7702) - -`moq-e2ee` and the workspace-only `moq-sign` merged into `moq-crypto`, as its `e2ee` and `sign` modules. -The profiles and wire are unchanged; each module keeps its own `Error` and `Result`. -Depend on `moq-crypto` and rename the imports: - -| Before | After | -| --- | --- | -| `moq_e2ee::…` | `moq_crypto::e2ee::…` | -| `moq_sign::…` | `moq_crypto::sign::…` | - -`moq_e2ee`'s entries below predate the merge; their `Before` code keeps the old paths, and their instructions name the `moq_crypto::e2ee` ones. - -### Tracks are named semantically through `broadcast` wrappers (#5876) - -`generation::Producer::produce` and `generation::Consumer::consume` are private. -Wrap the broadcast in a `broadcast::Producer` or `broadcast::Consumer` and name tracks by their semantic names; the wrapper derives the physical name. - -```rust -// Before -let name = generation.name("video")?; -let video = generation.produce(broadcast.create_track(name.as_str(), info)?)?; -let subscriber = remote.track(name.as_str())?.subscribe(subscription).await?; -let reader = consuming.consume(subscriber)?; - -// After -let video = moq_crypto::e2ee::broadcast::Producer::new(broadcast, generation).create_track("video", info)?; -let reader = moq_crypto::e2ee::broadcast::Consumer::new(remote, consuming) - .subscribe("video", subscription)? - .await?; -``` - -A track served on demand is reserved up front with `broadcast::Producer::reserve_track` and accepted once its `demand()` shows a subscriber. - -### The epoch comes from the route (#4942) - -The protected path is the opaque broadcast path; the publisher epoch is read from the route's instance instead of a path suffix. -On wires that do not carry an instance, the session mints one, so the application supplies the epoch. -Drop `join_epoch` and `split_epoch`: create the broadcast's route under the generation's `moq_crypto::e2ee::Epoch` as its instance, with `RouteOptions::hidden().with_instance(generation.epoch().instance(), 0)`, and read it back from the resolved broadcast with `moq_crypto::e2ee::Epoch::of(&broadcast)`. - -### Timestamps are optional - -`Frame` and `Datagram` timestamps are `Option`, and the writers take `impl Into>`, so passing a `Timestamp` still compiles. -A frame read from an untimed track has no timestamp. -Handle `None` where you read `frame.timestamp`. diff --git a/rs/moq-crypto/README.md b/rs/moq-crypto/README.md index aa1bfbda4a8..69db100c1f0 100644 --- a/rs/moq-crypto/README.md +++ b/rs/moq-crypto/README.md @@ -2,19 +2,17 @@ # moq-crypto -Cryptography for [Media over QUIC](https://moq.dev): the `e2ee` module encrypts groups, -datagrams, and track names so relays cannot read them. It wraps `moq-net` and checks timestamps -with its `track::Info::rescale`, so a frame it accepts is one `moq-net` accepts. The `endpoint` -module holds the key that names an endpoint. The `provider` module is the -[rind](https://github.com/kixel-ai/rind) rustls provider; `cpu` holds the CPU check and error -that the MoQ crates share. +Cryptography the [Media over QUIC](https://moq.dev) crates share: the `endpoint` module holds +the key that names an endpoint, the `provider` module is the +[rind](https://github.com/kixel-ai/rind) rustls provider, and `cpu` holds the CPU check and its +error. ## Features -`endpoint` and `e2ee`, both default, enable those modules. With default features off, the crate is +`endpoint`, the default, enables that module's secret key. With default features off, the crate is only `endpoint::PublicKey`, the endpoint ID, with its canonical z-base-32 text: it builds without `moq-net` or rind, for crates that only name endpoints. -`serde` adds the key's string serialization. `cpu`, enabled by `e2ee` and `provider`, adds +`serde` adds the key's string serialization. `cpu`, enabled by `provider`, adds only rind. `provider`, off by default, adds the rustls integration without `moq-net`, so transport crates can use it without a dependency cycle. @@ -31,7 +29,7 @@ runs rind's slower paths rather than being refused: - `provider::install_default()` installs rind as rustls' process default for libraries such as reqwest that read it, leaving a provider the process already installed in place. -moq-auth, moq-hls, e2ee, moq-rtmp, and the transports report the same `cpu::UnsupportedCpu`, and +moq-auth, moq-hls, moq-e2ee, moq-rtmp, and the transports report the same `cpu::UnsupportedCpu`, and `moq_tokio::crypto` re-exports this module's API. ## Endpoint key @@ -40,55 +38,3 @@ An endpoint's `endpoint::SecretKey` is an Ed25519 key that `SecretKey::load_or_g for the life of a host, as 52 z-base-32 characters in a `0600` file it never replaces implicitly. `moq-relay` loads it for `--cluster-route-key`, where it converts into `moq_net::origin::RouteKey`. Its `endpoint::PublicKey` is the endpoint ID, displayed as those 52 characters (a DNS label). - -## Encryption - -End-to-end encryption for [Media over QUIC](https://moq.dev) groups, datagrams, -and track names. Profile `moq-e2ee-00` from -[draft-lcurley-moq-e2ee](https://datatracker.ietf.org/doc/draft-lcurley-moq-e2ee/). - -Relays forward ciphertext. Content keys never enter `moq-net`. - -### Shape - -The application distributes a `Credential { context, kid, secret }` over its own -authenticated channel. `credential.produce()` mints a fresh epoch and returns a -`generation::Producer`, which derives opaque track names and keys for that instance alone. -It accepts no explicit epoch; its clones share permanent track claims. - -The application names tracks by their semantic names. `broadcast::Producer` wraps the -`moq-net` broadcast and creates each track under its physical name, so only physical names -reach the relays. A physical name is the semantic name encrypted under the generation: a relay -learns only its length rounded up to 16 bytes. A track served on demand is reserved with -`reserve_track` and accepted once its demand shows a subscriber. - -```rust -let credential = Credential::new(credential::Config { context, kid, secret })?; -let generation = credential.produce(); -// The route serves the generation's epoch as its instance, so subscribers find the key. -let options = RouteOptions::hidden().with_instance(generation.epoch().instance(), 0); -let route = origin.route(&credential.path("meeting.hang")?, options)?; -let protected = broadcast::Producer::new(route.broadcast().clone(), generation.clone()); -let video = protected.create_track("video", None)?; -route.announce()?; -``` - -A subscriber follows `credential.path(semantic)` with `origin.follow(path, None)`. It takes -each instance's epoch from the broadcast it resolved, `Epoch::of(&broadcast)` (or from the -application's channel on a wire that carries no instance, older than lite-07), so the key always matches the instance -it reads. It binds the epoch with `credential.consume(epoch)` and wraps the broadcast in a -`broadcast::Consumer`. Its `subscribe(semantic, subscription)` opens the track a decrypted -catalog names. A consuming generation cannot produce. Nothing survives a publisher instance: a restart mints a new epoch. -A cloned process image (a `fork` without `exec`, a restored VM snapshot or checkpoint, or a -producing generation copied to another process) is a new instance too: each copy must call -`produce()` itself, since copies of one generation reuse its nonces. - -### Processing - -AES-128-GCM is inline and synchronous. `cargo bench -p moq-crypto --bench protect` measures the whole -protected write path, including the `moq-net` group: a 1 KiB grouped frame and a -160-byte Opus-sized datagram each cost a few microseconds on one core, so encryption -is a tiny fraction of real time and there is no async pump. - -Memory is bounded: a producer retains no ciphertext, and a consumer keeps a 1024-bit -datagram duplicate window below the greatest sequence it opened. diff --git a/rs/moq-crypto/src/lib.rs b/rs/moq-crypto/src/lib.rs index 576ebc15da6..12a0a999f48 100644 --- a/rs/moq-crypto/src/lib.rs +++ b/rs/moq-crypto/src/lib.rs @@ -1,26 +1,19 @@ -//! Cryptography for MoQ: end-to-end encryption, endpoint keys, and the shared provider. +//! Cryptography the MoQ crates share: endpoint keys, the provider, and the CPU check. //! -//! [`e2ee`] encrypts groups, datagrams, and track names so a relay forwards ciphertext it cannot -//! read. It wraps `moq-net` and checks a frame's timestamp with `moq_net::track::Info::rescale`, -//! so it accepts no frame the net track would refuse. [`endpoint`] holds the Ed25519 key that -//! names an endpoint, which a relay proves to its peers as its cluster route key. +//! [`endpoint`] holds the Ed25519 key that names an endpoint, which a relay proves to its peers +//! as its cluster route key. //! [`provider`] is rind's rustls provider; [`cpu`] holds the CPU check and [`cpu::UnsupportedCpu`] //! error that moq-quic, moq-tokio, and the other transport crates report. //! -//! The `endpoint` and `e2ee` features, both default, gate those halves; `provider`, off by -//! default, gates the rustls provider and enables `cpu`, which needs only rind. Without any of -//! these features the crate holds only [`endpoint::PublicKey`], the endpoint ID, and its canonical -//! z-base-32 text, with no `moq-net` or crypto backend; `serde` adds its string serialization. -//! -//! The `poll_*` methods are always available. Enable the `async` feature for their generated -//! async wrappers (such as `read_frame` and `recv_group`); it is off by default. +//! The `endpoint` feature, the default, gates the secret key; `provider`, off by default, gates +//! the rustls provider and enables `cpu`, which needs only rind. Without any of these features +//! the crate holds only [`endpoint::PublicKey`], the endpoint ID, and its canonical z-base-32 +//! text, with no `moq-net` or crypto backend; `serde` adds its string serialization. #![warn(missing_docs)] #[cfg(feature = "cpu")] pub mod cpu; -#[cfg(feature = "e2ee")] -pub mod e2ee; pub mod endpoint; #[cfg(feature = "provider")] pub mod provider; diff --git a/rs/moq-crypto/CHANGELOG.md b/rs/moq-e2ee/CHANGELOG.md similarity index 100% rename from rs/moq-crypto/CHANGELOG.md rename to rs/moq-e2ee/CHANGELOG.md diff --git a/rs/moq-e2ee/Cargo.toml b/rs/moq-e2ee/Cargo.toml new file mode 100644 index 00000000000..eebd6fe1817 --- /dev/null +++ b/rs/moq-e2ee/Cargo.toml @@ -0,0 +1,50 @@ +[package] +name = "moq-e2ee" +description = "End-to-end encryption for MoQ groups, datagrams, and track names." +authors = ["Luke Curley "] +repository = "https://github.com/moq-dev/moq" +license = "MIT OR Apache-2.0" + +# Above crates.io's 0.0.25, so publishing the finished format needs no jump. +version = "0.0.26" +edition = "2024" +rust-version.workspace = true + +# Unpublished until its finished format lands: quest/m3/e2ee-format.md. +publish = false + +keywords = ["quic", "webtransport", "encryption", "live"] +categories = ["cryptography", "multimedia", "network-programming"] + +[features] +# Generated async wrappers for the poll methods. Enable where you `.await` them. +async = ["kio/async"] + +[dependencies] +base64 = { workspace = true } +bytes = { workspace = true } +kio = { workspace = true } +moq-crypto = { workspace = true, features = ["cpu"] } +moq-net = { workspace = true } +rind = { workspace = true } +thiserror = { workspace = true } +uuid = { workspace = true } +zeroize = { workspace = true } + +[dev-dependencies] +criterion = { package = "bench-harness", path = "../bench-harness" } +hex = { workspace = true } +kio = { workspace = true, features = ["runtime"] } +# Compile the generated wrappers used by the tests and benches. +moq-e2ee = { path = ".", features = ["async"] } +moq-net = { path = "../moq-net", features = ["async"] } +serde_json = { workspace = true } +tokio = { workspace = true, features = ["macros", "rt", "sync", "test-util", "time"] } +workspace-hack = { path = "../workspace-hack" } + +[[bench]] +name = "protect" +harness = false + +[lints] +workspace = true diff --git a/rs/moq-e2ee/README.md b/rs/moq-e2ee/README.md new file mode 100644 index 00000000000..21558066602 --- /dev/null +++ b/rs/moq-e2ee/README.md @@ -0,0 +1,55 @@ +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/moq-dev/moq/blob/main/LICENSE-MIT) + +# moq-e2ee + +End-to-end encryption for [Media over QUIC](https://moq.dev) groups, datagrams, +and track names. Profile `moq-e2ee-01-wip` from +[draft-lcurley-moq-e2ee](https://datatracker.ietf.org/doc/draft-lcurley-moq-e2ee/). + +Relays forward ciphertext. Content keys never enter `moq-net`. + +Unpublished and experimental: the format is changing, and the crate publishes once it is finished. + +## Shape + +The application distributes a `Credential { context, kid, secret }` over its own +authenticated channel. `credential.produce()` mints a fresh epoch and returns a +`generation::Producer`, which derives opaque track names and keys for that instance alone. +It accepts no explicit epoch; its clones share permanent track claims. + +The application names tracks by their semantic names. `broadcast::Producer` wraps the +`moq-net` broadcast and creates each track under its physical name, so only physical names +reach the relays. A physical name is the semantic name encrypted under the generation: a relay +learns only its length rounded up to 16 bytes. A track served on demand is reserved with +`reserve_track` and accepted once its demand shows a subscriber. + +```rust +let credential = Credential::new(credential::Config { context, kid, secret })?; +let generation = credential.produce(); +// The route serves the generation's epoch as its instance, so subscribers find the key. +let options = RouteOptions::hidden().with_instance(generation.epoch().instance(), 0); +let route = origin.route(&credential.path("meeting.hang")?, options)?; +let protected = broadcast::Producer::new(route.broadcast().clone(), generation.clone()); +let video = protected.create_track("video", None)?; +route.announce()?; +``` + +A subscriber follows `credential.path(semantic)` with `origin.follow(path, None)`. It takes +each instance's epoch from the broadcast it resolved, `Epoch::of(&broadcast)` (or from the +application's channel on a wire that carries no instance, older than lite-07), so the key always matches the instance +it reads. It binds the epoch with `credential.consume(epoch)` and wraps the broadcast in a +`broadcast::Consumer`. Its `subscribe(semantic, subscription)` opens the track a decrypted +catalog names. A consuming generation cannot produce. Nothing survives a publisher instance: a restart mints a new epoch. +A cloned process image (a `fork` without `exec`, a restored VM snapshot or checkpoint, or a +producing generation copied to another process) is a new instance too: each copy must call +`produce()` itself, since copies of one generation reuse its nonces. + +## Processing + +AES-128-GCM is inline and synchronous. `cargo bench -p moq-e2ee --bench protect` measures the whole +protected write path, including the `moq-net` group: a 1 KiB grouped frame and a +160-byte Opus-sized datagram each cost a few microseconds on one core, so encryption +is a tiny fraction of real time and there is no async pump. + +Memory is bounded: a producer retains no ciphertext, and a consumer keeps a 1024-bit +datagram duplicate window below the greatest sequence it opened. diff --git a/rs/moq-crypto/benches/protect.rs b/rs/moq-e2ee/benches/protect.rs similarity index 84% rename from rs/moq-crypto/benches/protect.rs rename to rs/moq-e2ee/benches/protect.rs index 3f8e9eca82f..723b8a7ff24 100644 --- a/rs/moq-crypto/benches/protect.rs +++ b/rs/moq-e2ee/benches/protect.rs @@ -1,13 +1,13 @@ //! AES-128-GCM throughput for grouped frames and datagrams through the public API. //! -//! Run with `cargo bench -p moq-crypto --bench protect`. +//! Run with `cargo bench -p moq-e2ee --bench protect`. use std::hint::black_box; use std::time::Duration; use criterion::{Criterion, Throughput, criterion_group, criterion_main}; -use moq_crypto::e2ee::Credential; -use moq_crypto::e2ee::credential::Config; +use moq_e2ee::Credential; +use moq_e2ee::credential::Config; use moq_net::Timestamp; fn credential() -> Credential { @@ -20,8 +20,8 @@ fn credential() -> Credential { } /// Each producer is its own publisher instance, so it gets its own epoch. -fn broadcast(credential: &Credential) -> moq_crypto::e2ee::broadcast::Producer { - moq_crypto::e2ee::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), credential.produce()) +fn broadcast(credential: &Credential) -> moq_e2ee::broadcast::Producer { + moq_e2ee::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), credential.produce()) } fn bench_protect(c: &mut Criterion) { diff --git a/rs/moq-crypto/src/e2ee/broadcast.rs b/rs/moq-e2ee/src/broadcast.rs similarity index 97% rename from rs/moq-crypto/src/e2ee/broadcast.rs rename to rs/moq-e2ee/src/broadcast.rs index eab76f654d9..47caf4e14e7 100644 --- a/rs/moq-crypto/src/e2ee/broadcast.rs +++ b/rs/moq-e2ee/src/broadcast.rs @@ -7,16 +7,16 @@ use std::task::{Poll, ready}; -use crate::e2ee::error::{Error, Result}; -use crate::e2ee::generation::Domain; -use crate::e2ee::key::Claim; -use crate::e2ee::{Name, datagram, generation, track}; +use crate::error::{Error, Result}; +use crate::generation::Domain; +use crate::key::Claim; +use crate::{Name, datagram, generation, track}; /// The publishing side of a protected broadcast. /// -/// Wraps the `moq-net` broadcast at [`Credential::path`](crate::e2ee::Credential::path). Announce that +/// Wraps the `moq-net` broadcast at [`Credential::path`](crate::Credential::path). Announce that /// broadcast with [`generation().epoch()`](generation::Producer::epoch)'s -/// [`instance`](crate::e2ee::Epoch::instance) on its route once the tracks a subscriber needs first +/// [`instance`](crate::Epoch::instance) on its route once the tracks a subscriber needs first /// exist. #[derive(Clone)] pub struct Producer { @@ -305,7 +305,7 @@ impl Lister { /// The subscribing side of a protected broadcast. /// -/// Wraps the `moq-net` broadcast found at [`Credential::path`](crate::e2ee::Credential::path), bound to +/// Wraps the `moq-net` broadcast found at [`Credential::path`](crate::Credential::path), bound to /// the epoch on its route. #[derive(Clone)] pub struct Consumer { diff --git a/rs/moq-crypto/src/e2ee/credential.rs b/rs/moq-e2ee/src/credential.rs similarity index 89% rename from rs/moq-crypto/src/e2ee/credential.rs rename to rs/moq-e2ee/src/credential.rs index b6bd4dc6ab1..34d31f58d20 100644 --- a/rs/moq-crypto/src/e2ee/credential.rs +++ b/rs/moq-e2ee/src/credential.rs @@ -9,10 +9,10 @@ use bytes::Bytes; use rind::hkdf; use zeroize::{Zeroize, ZeroizeOnDrop}; -use crate::e2ee::Epoch; -use crate::e2ee::error::Result; -use crate::e2ee::generation; -use crate::e2ee::limits::{PATH_LABEL, PATH_LEN, PROFILE, SECRET_LEN, check_bytes, check_u53}; +use crate::Epoch; +use crate::error::Result; +use crate::generation; +use crate::limits::{PATH_LABEL, PATH_LEN, PROFILE, SECRET_LEN, check_bytes, check_u53}; /// What the application distributes over its own authenticated channel. pub struct Config { @@ -54,10 +54,10 @@ impl Credential { /// /// # Errors /// - /// [`Error::UnsupportedCpu`](crate::e2ee::Error::UnsupportedCpu) if this CPU lacks a feature the crypto needs. - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `context` exceeds 65535 bytes or `kid` exceeds `2^53-1`. + /// [`Error::UnsupportedCpu`](crate::Error::UnsupportedCpu) if this CPU lacks a feature the crypto needs. + /// [`Error::Identity`](crate::Error::Identity) if `context` exceeds 65535 bytes or `kid` exceeds `2^53-1`. pub fn new(config: Config) -> Result { - crate::cpu::check()?; + moq_crypto::cpu::check()?; check_bytes(config.context.len())?; check_u53(config.kid)?; let secret = Secret(config.secret); @@ -84,7 +84,7 @@ impl Credential { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes. pub fn path(&self, semantic: &str) -> Result { let material: [u8; PATH_LEN] = self.expand(&self.path_info(semantic)?); // A fixed-length encoding, far under the path limit. diff --git a/rs/moq-crypto/src/e2ee/datagram.rs b/rs/moq-e2ee/src/datagram.rs similarity index 95% rename from rs/moq-crypto/src/e2ee/datagram.rs rename to rs/moq-e2ee/src/datagram.rs index 8e74516c673..71cfbdcfde5 100644 --- a/rs/moq-crypto/src/e2ee/datagram.rs +++ b/rs/moq-e2ee/src/datagram.rs @@ -10,11 +10,11 @@ use std::task::{Poll, ready}; use bytes::Bytes; -use crate::e2ee::error::{Error, Result}; -use crate::e2ee::generation::Domain; -use crate::e2ee::key::{Claim, TrackKey}; -use crate::e2ee::limits::MAX_DATAGRAM_PAYLOAD; -use crate::e2ee::window::DatagramWindow; +use crate::error::{Error, Result}; +use crate::generation::Domain; +use crate::key::{Claim, TrackKey}; +use crate::limits::MAX_DATAGRAM_PAYLOAD; +use crate::window::DatagramWindow; /// A decrypted datagram. #[derive(Clone, Debug, PartialEq, Eq)] @@ -93,7 +93,7 @@ impl Producer { /// Encrypt `plaintext` at an explicit sequence, which must be above every sequence this /// name's datagram tracks allocated under the generation, and send it. /// - /// Plaintext is capped at [`MAX_DATAGRAM_PLAINTEXT`](crate::e2ee::MAX_DATAGRAM_PLAINTEXT). + /// Plaintext is capped at [`MAX_DATAGRAM_PLAINTEXT`](crate::MAX_DATAGRAM_PLAINTEXT). /// A predictable failure is refused before the sequence is allocated; once /// encrypted, the identity is spent even if the net write fails. /// @@ -166,12 +166,12 @@ impl fmt::Debug for Producer { /// A datagram track a subscriber asked for that the handler has yet to serve. /// -/// Yielded by [`broadcast::DatagramRequests::poll_requested`](crate::e2ee::broadcast::DatagramRequests::poll_requested) +/// Yielded by [`broadcast::DatagramRequests::poll_requested`](crate::broadcast::DatagramRequests::poll_requested) /// under its semantic name. The name is claimed only once accepted. Dropping it without /// [`accept`](Self::accept) rejects the waiting subscribers. pub struct Request { inner: moq_net::datagram::Request, - generation: crate::e2ee::generation::Producer, + generation: crate::generation::Producer, // From `generation::Producer::peek`; claimed by `accept`. claim: Claim, semantic: String, @@ -180,7 +180,7 @@ pub struct Request { impl Request { pub(crate) fn new( inner: moq_net::datagram::Request, - generation: crate::e2ee::generation::Producer, + generation: crate::generation::Producer, claim: Claim, semantic: String, ) -> Self { diff --git a/rs/moq-crypto/src/e2ee/epoch.json b/rs/moq-e2ee/src/epoch.json similarity index 100% rename from rs/moq-crypto/src/e2ee/epoch.json rename to rs/moq-e2ee/src/epoch.json diff --git a/rs/moq-crypto/src/e2ee/epoch.rs b/rs/moq-e2ee/src/epoch.rs similarity index 97% rename from rs/moq-crypto/src/e2ee/epoch.rs rename to rs/moq-e2ee/src/epoch.rs index bf934ce8b65..5bec9453354 100644 --- a/rs/moq-crypto/src/e2ee/epoch.rs +++ b/rs/moq-e2ee/src/epoch.rs @@ -89,7 +89,7 @@ mod tests { assert!(Epoch::mint() > epoch); } - /// Shared with `js/crypto/src/e2ee/epoch.test.ts`, so both parse and order alike. + /// Shared with `js/e2ee/src/epoch.test.ts`, so both parse and order alike. #[test] fn epoch_vectors() { let vectors: serde_json::Value = serde_json::from_str(include_str!("epoch.json")).unwrap(); diff --git a/rs/moq-crypto/src/e2ee/error.rs b/rs/moq-e2ee/src/error.rs similarity index 95% rename from rs/moq-crypto/src/e2ee/error.rs rename to rs/moq-e2ee/src/error.rs index 354831c03ca..56b26008e77 100644 --- a/rs/moq-crypto/src/e2ee/error.rs +++ b/rs/moq-e2ee/src/error.rs @@ -27,7 +27,7 @@ pub enum Error { /// This CPU lacks an instruction set extension the crypto requires; the message names it. #[error(transparent)] - UnsupportedCpu(#[from] crate::cpu::UnsupportedCpu), + UnsupportedCpu(#[from] moq_crypto::cpu::UnsupportedCpu), /// The underlying MoQ track failed. #[error(transparent)] diff --git a/rs/moq-crypto/src/e2ee/generation.rs b/rs/moq-e2ee/src/generation.rs similarity index 86% rename from rs/moq-crypto/src/e2ee/generation.rs rename to rs/moq-e2ee/src/generation.rs index 1ca8107c56e..4dc19e1c423 100644 --- a/rs/moq-crypto/src/e2ee/generation.rs +++ b/rs/moq-e2ee/src/generation.rs @@ -4,13 +4,13 @@ use std::collections::HashMap; use std::fmt; use std::sync::{Arc, Mutex}; -use crate::e2ee::Epoch; -use crate::e2ee::credential::{Credential, append_bytes}; -use crate::e2ee::error::Result; -use crate::e2ee::key::{Claim, TrackKey}; -use crate::e2ee::limits::{KEY_LABEL, NAME_KEY_LABEL, NAME_MAC_LABEL}; -use crate::e2ee::name::{self, Name}; -use crate::e2ee::{datagram, track}; +use crate::Epoch; +use crate::credential::{Credential, append_bytes}; +use crate::error::Result; +use crate::key::{Claim, TrackKey}; +use crate::limits::{KEY_LABEL, NAME_KEY_LABEL, NAME_MAC_LABEL}; +use crate::name::{self, Name}; +use crate::{datagram, track}; use rind::{aead, hmac}; /// Grouped-frame versus datagram key domain. @@ -53,8 +53,8 @@ impl Inner { /// A discovered epoch cannot produce tracks: /// /// ```compile_fail -/// fn encrypt(generation: moq_crypto::e2ee::generation::Consumer, broadcast: moq_net::broadcast::Producer) { -/// moq_crypto::e2ee::broadcast::Producer::new(broadcast, generation); +/// fn encrypt(generation: moq_e2ee::generation::Consumer, broadcast: moq_net::broadcast::Producer) { +/// moq_e2ee::broadcast::Producer::new(broadcast, generation); /// } /// ``` #[derive(Clone)] @@ -98,7 +98,7 @@ impl Consumer { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes. pub fn name(&self, semantic: &str) -> Result { self.0.names.seal(semantic) } @@ -107,7 +107,7 @@ impl Consumer { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes. pub(crate) fn consume(&self, track: moq_net::track::Subscriber, semantic: &str) -> Result { Ok(track::Consumer::new(track, self.keys(semantic, Domain::Group)?.key)) } @@ -116,7 +116,7 @@ impl Consumer { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes. pub(crate) fn consume_datagrams( &self, track: moq_net::datagram::Consumer, @@ -153,14 +153,14 @@ impl Consumer { } } -/// `"moq-e2ee-00 name-mac" || scope`. +/// `"moq-e2ee-01-wip name-mac" || scope`. pub(crate) fn name_mac_info(credential: &Credential, epoch: &Epoch) -> Vec { let mut info = NAME_MAC_LABEL.to_vec(); scope(&mut info, credential, epoch); info } -/// `"moq-e2ee-00 name-key" || scope`. +/// `"moq-e2ee-01-wip name-key" || scope`. pub(crate) fn name_key_info(credential: &Credential, epoch: &Epoch) -> Vec { let mut info = NAME_KEY_LABEL.to_vec(); scope(&mut info, credential, epoch); @@ -218,7 +218,7 @@ impl Producer { /// /// # Errors /// - /// [`Error::Authentication`](crate::e2ee::Error::Authentication) if this generation did not issue `name`. + /// [`Error::Authentication`](crate::Error::Authentication) if this generation did not issue `name`. pub(crate) fn open(&self, name: &Name) -> Result { self.consumer.0.names.open(name) } @@ -227,7 +227,7 @@ impl Producer { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes, and then `track` is aborted. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes, and then `track` is aborted. pub(crate) fn produce(&self, track: moq_net::track::Producer, semantic: &str) -> Result { match self.claim(semantic, Domain::Group) { Ok(claim) => Ok(track::Producer::new(track, claim)), @@ -244,7 +244,7 @@ impl Producer { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes, and then `track` is aborted. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes, and then `track` is aborted. pub(crate) fn produce_datagrams( &self, track: moq_net::datagram::Producer, @@ -264,7 +264,7 @@ impl Producer { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes. pub(crate) fn claim(&self, semantic: &str, domain: Domain) -> Result { self.consumer.keys(semantic, domain) } @@ -274,7 +274,7 @@ impl Producer { /// /// # Errors /// - /// [`Error::Identity`](crate::e2ee::Error::Identity) if `semantic` exceeds 65535 bytes. + /// [`Error::Identity`](crate::Error::Identity) if `semantic` exceeds 65535 bytes. pub(crate) fn peek(&self, semantic: &str, domain: Domain) -> Result { if let Some(claim) = self .consumer diff --git a/rs/moq-crypto/src/e2ee/group.rs b/rs/moq-e2ee/src/group.rs similarity index 97% rename from rs/moq-crypto/src/e2ee/group.rs rename to rs/moq-e2ee/src/group.rs index de6ef36bf04..52f00f1ff97 100644 --- a/rs/moq-crypto/src/e2ee/group.rs +++ b/rs/moq-e2ee/src/group.rs @@ -6,10 +6,10 @@ use std::task::{Poll, ready}; use bytes::Bytes; -use crate::e2ee::error::{Error, Result}; -use crate::e2ee::key::TrackKey; -use crate::e2ee::limits::MAX_GROUPED_PAYLOAD; -use crate::e2ee::terminal::Terminal; +use crate::error::{Error, Result}; +use crate::key::TrackKey; +use crate::limits::MAX_GROUPED_PAYLOAD; +use crate::terminal::Terminal; /// A decrypted grouped frame. #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/rs/moq-crypto/src/e2ee/key.rs b/rs/moq-e2ee/src/key.rs similarity index 95% rename from rs/moq-crypto/src/e2ee/key.rs rename to rs/moq-e2ee/src/key.rs index 196596e0462..1ed23a1389b 100644 --- a/rs/moq-crypto/src/e2ee/key.rs +++ b/rs/moq-e2ee/src/key.rs @@ -4,9 +4,9 @@ use std::sync::{Arc, Mutex}; use bytes::Bytes; use rind::aead; -use crate::e2ee::error::{Error, Result}; -use crate::e2ee::limits::{MAX_INVOCATIONS, MAX_PLAINTEXT_BYTES, TAG_LEN, check_u53}; -use crate::e2ee::protect::{nonce, open, protect}; +use crate::error::{Error, Result}; +use crate::limits::{MAX_INVOCATIONS, MAX_PLAINTEXT_BYTES, TAG_LEN, check_u53}; +use crate::protect::{nonce, open, protect}; /// A semantic name's key in one domain and its next unallocated group start or datagram sequence; /// clones share their accounting. diff --git a/rs/moq-crypto/src/e2ee/mod.rs b/rs/moq-e2ee/src/lib.rs similarity index 79% rename from rs/moq-crypto/src/e2ee/mod.rs rename to rs/moq-e2ee/src/lib.rs index b2b6697694c..ae36e2ceeaf 100644 --- a/rs/moq-crypto/src/e2ee/mod.rs +++ b/rs/moq-e2ee/src/lib.rs @@ -1,6 +1,6 @@ //! End-to-end encryption for MoQ groups, datagrams, and track names. //! -//! Implements profile `moq-e2ee-00` from [draft-lcurley-moq-e2ee]. Relays forward +//! Implements profile `moq-e2ee-01-wip` from [draft-lcurley-moq-e2ee]. Relays forward //! ciphertext; content keys never enter `moq-net`. //! //! [draft-lcurley-moq-e2ee]: https://datatracker.ietf.org/doc/draft-lcurley-moq-e2ee/ @@ -16,13 +16,16 @@ //! A caller cannot reopen an explicit epoch for production: //! //! ```compile_fail,E0624 -//! fn reopen(credential: moq_crypto::e2ee::Credential, epoch: moq_crypto::e2ee::Epoch) { -//! let _ = moq_crypto::e2ee::generation::Producer::new(credential, epoch); +//! fn reopen(credential: moq_e2ee::Credential, epoch: moq_e2ee::Epoch) { +//! let _ = moq_e2ee::generation::Producer::new(credential, epoch); //! } //! ``` //! //! AES-128-GCM is inline and synchronous: a 1 KiB frame costs about a microsecond //! on one core (see the `protect` bench), so there is no async encryption pump. +//! +//! The `poll_*` methods are always available. Enable the `async` feature for their generated +//! async wrappers (such as `read_frame` and `recv_group`); it is off by default. #![warn(missing_docs)] diff --git a/rs/moq-crypto/src/e2ee/limits.rs b/rs/moq-e2ee/src/limits.rs similarity index 81% rename from rs/moq-crypto/src/e2ee/limits.rs rename to rs/moq-e2ee/src/limits.rs index 782cc2d961c..5b566d7d3b4 100644 --- a/rs/moq-crypto/src/e2ee/limits.rs +++ b/rs/moq-e2ee/src/limits.rs @@ -1,17 +1,17 @@ /// Profile string, also the HKDF salt. -pub(crate) const PROFILE: &str = "moq-e2ee-00"; +pub(crate) const PROFILE: &str = "moq-e2ee-01-wip"; /// HKDF info prefix for opaque broadcast paths. -pub(crate) const PATH_LABEL: &[u8] = b"moq-e2ee-00 path"; +pub(crate) const PATH_LABEL: &[u8] = b"moq-e2ee-01-wip path"; /// HKDF info prefix for the HMAC-SHA-256 key that derives physical name nonces. -pub(crate) const NAME_MAC_LABEL: &[u8] = b"moq-e2ee-00 name-mac"; +pub(crate) const NAME_MAC_LABEL: &[u8] = b"moq-e2ee-01-wip name-mac"; /// HKDF info prefix for the AES-128-GCM key that seals physical names. -pub(crate) const NAME_KEY_LABEL: &[u8] = b"moq-e2ee-00 name-key"; +pub(crate) const NAME_KEY_LABEL: &[u8] = b"moq-e2ee-01-wip name-key"; /// HKDF info prefix for AEAD keys. -pub(crate) const KEY_LABEL: &[u8] = b"moq-e2ee-00 key"; +pub(crate) const KEY_LABEL: &[u8] = b"moq-e2ee-01-wip key"; /// AES-GCM tag length in bytes. pub(crate) const TAG_LEN: usize = 16; @@ -61,17 +61,17 @@ pub(crate) const DATAGRAM_WINDOW: u64 = 1024; /// Maximum length of a `bytes` field: context, epoch, or semantic name. pub(crate) const MAX_BYTES: usize = 0xffff; -pub(crate) fn check_u53(value: u64) -> crate::e2ee::Result<()> { +pub(crate) fn check_u53(value: u64) -> crate::Result<()> { if value > MAX_U53 { - Err(crate::e2ee::Error::Identity) + Err(crate::Error::Identity) } else { Ok(()) } } -pub(crate) fn check_bytes(len: usize) -> crate::e2ee::Result<()> { +pub(crate) fn check_bytes(len: usize) -> crate::Result<()> { if len > MAX_BYTES { - Err(crate::e2ee::Error::Identity) + Err(crate::Error::Identity) } else { Ok(()) } diff --git a/rs/moq-crypto/src/e2ee/name.rs b/rs/moq-e2ee/src/name.rs similarity index 97% rename from rs/moq-crypto/src/e2ee/name.rs rename to rs/moq-e2ee/src/name.rs index b3865106ddf..9ff0c88015d 100644 --- a/rs/moq-crypto/src/e2ee/name.rs +++ b/rs/moq-e2ee/src/name.rs @@ -5,8 +5,8 @@ use base64::Engine; use base64::engine::general_purpose::URL_SAFE_NO_PAD; use rind::{aead, hmac}; -use crate::e2ee::error::{Error, Result}; -use crate::e2ee::limits::{NAME_BLOCK, NAME_NONCE_LEN, TAG_LEN, check_bytes}; +use crate::error::{Error, Result}; +use crate::limits::{NAME_BLOCK, NAME_NONCE_LEN, TAG_LEN, check_bytes}; /// An opaque physical track name: unpadded base64url of a semantic name sealed under its generation. #[derive(Clone, PartialEq, Eq, Hash)] diff --git a/rs/moq-crypto/src/e2ee/protect.rs b/rs/moq-e2ee/src/protect.rs similarity index 95% rename from rs/moq-crypto/src/e2ee/protect.rs rename to rs/moq-e2ee/src/protect.rs index f716fa89ffd..e8143854b74 100644 --- a/rs/moq-crypto/src/e2ee/protect.rs +++ b/rs/moq-e2ee/src/protect.rs @@ -1,8 +1,8 @@ use bytes::Bytes; use rind::aead; -use crate::e2ee::error::{Error, Result}; -use crate::e2ee::limits::{TAG_LEN, check_u53}; +use crate::error::{Error, Result}; +use crate::limits::{TAG_LEN, check_u53}; /// 96-bit AES-GCM nonce: `u64(group) || u32(frame)`. pub(crate) fn nonce(group: u64, frame: u64) -> Result<[u8; 12]> { diff --git a/rs/moq-crypto/src/e2ee/terminal.rs b/rs/moq-e2ee/src/terminal.rs similarity index 98% rename from rs/moq-crypto/src/e2ee/terminal.rs rename to rs/moq-e2ee/src/terminal.rs index bc98c89ea48..391ef7afd62 100644 --- a/rs/moq-crypto/src/e2ee/terminal.rs +++ b/rs/moq-e2ee/src/terminal.rs @@ -7,7 +7,7 @@ use std::sync::{Arc, Mutex}; use std::task::Poll; -use crate::e2ee::error::{Error, Result}; +use crate::error::{Error, Result}; pub(crate) struct Terminal { flag: kio::Producer, diff --git a/rs/moq-crypto/src/e2ee/tests.rs b/rs/moq-e2ee/src/tests.rs similarity index 97% rename from rs/moq-crypto/src/e2ee/tests.rs rename to rs/moq-e2ee/src/tests.rs index 56d7bde2647..b14001d528e 100644 --- a/rs/moq-crypto/src/e2ee/tests.rs +++ b/rs/moq-e2ee/src/tests.rs @@ -10,19 +10,19 @@ use moq_net::Timestamp; use rind::{aead, hmac}; use serde_json::Value; -use crate::e2ee::Epoch; -use crate::e2ee::credential::{Config, Credential}; -use crate::e2ee::datagram::Event; -use crate::e2ee::error::Error; -use crate::e2ee::generation::{Consumer, Domain, Producer, name_key_info, name_mac_info}; -use crate::e2ee::limits::{ +use crate::Epoch; +use crate::credential::{Config, Credential}; +use crate::datagram::Event; +use crate::error::Error; +use crate::generation::{Consumer, Domain, Producer, name_key_info, name_mac_info}; +use crate::limits::{ DATAGRAM_WINDOW, KEY_LABEL, MAX_DATAGRAM_BODY, MAX_DATAGRAM_HEADER, MAX_DATAGRAM_PAYLOAD, MAX_DATAGRAM_PLAINTEXT, MAX_GROUPED_PAYLOAD, MAX_GROUPED_PLAINTEXT, MAX_INVOCATIONS, MAX_PLAINTEXT_BYTES, MAX_U53, NAME_BLOCK, NAME_KEY_LABEL, NAME_MAC_LABEL, NAME_NONCE_LEN, PATH_LABEL, PATH_LEN, PROFILE, SECRET_LEN, TAG_LEN, }; -use crate::e2ee::name::{Name, pad}; -use crate::e2ee::protect::{nonce, protect}; -use crate::e2ee::{datagram, group, track}; +use crate::name::{Name, pad}; +use crate::protect::{nonce, protect}; +use crate::{datagram, group, track}; /// A millisecond track: the frames written here carry timestamps. fn timed() -> moq_net::track::Info { @@ -38,7 +38,7 @@ fn timed_datagrams() -> moq_net::datagram::Info { const KEY_LEN: usize = 16; const NAME_MAC_LEN: usize = 32; -const VECTORS: &str = include_str!("../../../../drafts/moq-e2ee-00.json"); +const VECTORS: &str = include_str!("../../../drafts/moq-e2ee-01-wip.json"); fn vectors() -> Value { serde_json::from_str(VECTORS).unwrap() @@ -322,7 +322,7 @@ fn negative_vectors() { } fn test_secret() -> [u8; SECRET_LEN] { - *b"moq-e2ee-00 test secret!!!!!!!!!" + *b"moq-e2ee-01-wip test secret!!!!!" } fn test_credential() -> Credential { @@ -755,8 +755,8 @@ fn refused_track_is_aborted() { /// One broadcast seen through the wrappers and, raw, the way a relay sees it. struct Protected { - producer: crate::e2ee::broadcast::Producer, - consumer: crate::e2ee::broadcast::Consumer, + producer: crate::broadcast::Producer, + consumer: crate::broadcast::Consumer, raw: moq_net::broadcast::Consumer, } @@ -764,9 +764,9 @@ fn protected() -> Protected { let generation = test_generation(); let net = moq_net::broadcast::Info::new().produce(); Protected { - consumer: crate::e2ee::broadcast::Consumer::new(net.consume(), consume(&generation)), + consumer: crate::broadcast::Consumer::new(net.consume(), consume(&generation)), raw: net.consume(), - producer: crate::e2ee::broadcast::Producer::new(net, generation), + producer: crate::broadcast::Producer::new(net, generation), } } @@ -822,7 +822,7 @@ fn reserved_track_serves_on_demand() { #[test] fn broadcast_claims_span_outputs() { let generation = test_generation(); - let first = crate::e2ee::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), generation.clone()); + let first = crate::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), generation.clone()); let mut video = first.create_track("video", timed()).unwrap(); video.create_group(2).unwrap(); let mut audio = first.reserve_track("audio").unwrap().accept(timed()); @@ -831,7 +831,7 @@ fn broadcast_claims_span_outputs() { voice.append(ms(1), b"opus").unwrap(); // A clone of the generation on another output resumes each name above its marks. - let second = crate::e2ee::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), generation); + let second = crate::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), generation); let mut video = second.create_track("video", timed()).unwrap(); assert_eq!( video @@ -877,7 +877,7 @@ fn recovery_claims_nothing() { } /// Poll a handler once, expecting a request. -fn requested(requests: &mut crate::e2ee::broadcast::Requests) -> track::Request { +fn requested(requests: &mut crate::broadcast::Requests) -> track::Request { match requests.poll_requested_track(&kio::Waiter::noop()) { Poll::Ready(Ok(request)) => request, other => panic!("expected a request, got {other:?}"), @@ -988,7 +988,7 @@ fn requests_claim_only_accepted_names() { let _ = subscribing.poll_ok(&kio::Waiter::noop()); let request = requested(&mut requests); assert_eq!(generation.claims(), 0); - let other = crate::e2ee::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), generation.clone()); + let other = crate::broadcast::Producer::new(moq_net::broadcast::Info::new().produce(), generation.clone()); other.create_track("video", timed()).unwrap().create_group(5).unwrap(); let mut video = request.accept(timed()); assert_eq!(generation.claims(), 1); @@ -1582,7 +1582,7 @@ fn resumed_group_opens_at_transport_index() { }; net_group.skip_to(1); let key = Arc::new(Mutex::new(consume(&generation).key("video", Domain::Group).unwrap())); - let mut group = group::Consumer::new(net_group, key, crate::e2ee::terminal::Terminal::new(None)); + let mut group = group::Consumer::new(net_group, key, crate::terminal::Terminal::new(None)); assert_eq!(read_frame(&mut group).plaintext, &b"one"[..]); } diff --git a/rs/moq-crypto/src/e2ee/track.rs b/rs/moq-e2ee/src/track.rs similarity index 87% rename from rs/moq-crypto/src/e2ee/track.rs rename to rs/moq-e2ee/src/track.rs index 0cdd45cb8dd..5f61c378049 100644 --- a/rs/moq-crypto/src/e2ee/track.rs +++ b/rs/moq-e2ee/src/track.rs @@ -6,11 +6,11 @@ use std::task::{Poll, ready}; use moq_net::Timestamp; -use crate::e2ee::error::Result; -use crate::e2ee::generation::Domain; -use crate::e2ee::group; -use crate::e2ee::key::{Claim, TrackKey}; -use crate::e2ee::terminal::Terminal; +use crate::error::Result; +use crate::generation::Domain; +use crate::group; +use crate::key::{Claim, TrackKey}; +use crate::terminal::Terminal; /// Exclusive producer for one physical stream track. /// @@ -40,7 +40,7 @@ impl Producer { /// /// # Errors /// - /// [`Error::Reuse`](crate::e2ee::Error::Reuse) if `start` was already allocated, [`Error::Identity`](crate::e2ee::Error::Identity) if + /// [`Error::Reuse`](crate::Error::Reuse) if `start` was already allocated, [`Error::Identity`](crate::Error::Identity) if /// it exceeds `2^53-1`, or a net error. pub fn append_group(&mut self, start: Timestamp) -> Result { // Rescaled before allocating, so a refused start allocates nothing. @@ -57,7 +57,7 @@ impl Producer { /// /// # Errors /// - /// [`Error::Reuse`](crate::e2ee::Error::Reuse) if `start` was already allocated, [`Error::Identity`](crate::e2ee::Error::Identity) if + /// [`Error::Reuse`](crate::Error::Reuse) if `start` was already allocated, [`Error::Identity`](crate::Error::Identity) if /// it exceeds `2^53-1`, or a net error. pub fn create_group(&mut self, start: u64) -> Result { let (_, inner) = self.claim.allocate(Some(start), |start| { @@ -102,15 +102,15 @@ impl fmt::Debug for Producer { /// A requested or reserved track its subscribers wait on until it is accepted. /// -/// Yielded by [`broadcast::Requests::poll_requested_track`](crate::e2ee::broadcast::Requests::poll_requested_track) -/// or made by [`broadcast::Producer::reserve_track`](crate::e2ee::broadcast::Producer::reserve_track), +/// Yielded by [`broadcast::Requests::poll_requested_track`](crate::broadcast::Requests::poll_requested_track) +/// or made by [`broadcast::Producer::reserve_track`](crate::broadcast::Producer::reserve_track), /// which claims its name up front. A requested name is claimed only once accepted, so a /// subscriber cannot make the publisher hold names it never serves. Accept it once its /// [`demand`](Self::demand) shows a subscriber, or up front. Dropping it without /// [`accept`](Self::accept) rejects the waiting subscribers. pub struct Request { inner: moq_net::track::Request, - generation: crate::e2ee::generation::Producer, + generation: crate::generation::Producer, // From `generation::Producer::peek` or `claim`; claimed by `accept`. claim: Claim, semantic: String, @@ -119,7 +119,7 @@ pub struct Request { impl Request { pub(crate) fn new( inner: moq_net::track::Request, - generation: crate::e2ee::generation::Producer, + generation: crate::generation::Producer, claim: Claim, semantic: String, ) -> Self { @@ -159,11 +159,11 @@ impl fmt::Debug for Request { } } -/// The pollable state of a [`broadcast::Consumer::subscribe`](crate::e2ee::broadcast::Consumer::subscribe); +/// The pollable state of a [`broadcast::Consumer::subscribe`](crate::broadcast::Consumer::subscribe); /// awaited via the [`kio::Pending`] wrapper, whose `DerefMut` exposes [`Self::update`]. pub struct Subscribing { inner: kio::Pending, - generation: crate::e2ee::generation::Consumer, + generation: crate::generation::Consumer, // Keys derive from the name subscribed to, never from the name a relay hands back. semantic: String, } @@ -171,7 +171,7 @@ pub struct Subscribing { impl Subscribing { pub(crate) fn new( inner: kio::Pending, - generation: crate::e2ee::generation::Consumer, + generation: crate::generation::Consumer, semantic: String, ) -> Self { Self { @@ -212,7 +212,7 @@ impl kio::Task for Subscribing { /// Subscriber for one physical stream track. /// /// Grouped authentication failure ends the track and wakes pending reads with -/// [`Error::Authentication`](crate::e2ee::Error::Authentication). +/// [`Error::Authentication`](crate::Error::Authentication). pub struct Consumer { name: String, // Shared with every other subscription to this name under the generation. @@ -239,7 +239,7 @@ impl Consumer { /// /// # Errors /// - /// [`Error::Authentication`](crate::e2ee::Error::Authentication) once a grouped frame has failed to open, or a net error. + /// [`Error::Authentication`](crate::Error::Authentication) once a grouped frame has failed to open, or a net error. #[cfg_attr(feature = "async", kio::wrapper)] pub fn poll_recv_group(&mut self, waiter: &kio::Waiter) -> Poll>> { let terminal = Arc::clone(&self.terminal); diff --git a/rs/moq-crypto/src/e2ee/window.rs b/rs/moq-e2ee/src/window.rs similarity index 98% rename from rs/moq-crypto/src/e2ee/window.rs rename to rs/moq-e2ee/src/window.rs index 1f3a69bdf5a..467a8f4985e 100644 --- a/rs/moq-crypto/src/e2ee/window.rs +++ b/rs/moq-e2ee/src/window.rs @@ -1,4 +1,4 @@ -use crate::e2ee::limits::DATAGRAM_WINDOW; +use crate::limits::DATAGRAM_WINDOW; /// Datagram duplicate suppression: a 1024-bit sliding bitmask below the greatest opened sequence. /// diff --git a/rs/moq-crypto/tests/support/harness.rs b/rs/moq-e2ee/tests/support/harness.rs similarity index 100% rename from rs/moq-crypto/tests/support/harness.rs rename to rs/moq-e2ee/tests/support/harness.rs diff --git a/rs/moq-crypto/tests/support/mod.rs b/rs/moq-e2ee/tests/support/mod.rs similarity index 100% rename from rs/moq-crypto/tests/support/mod.rs rename to rs/moq-e2ee/tests/support/mod.rs diff --git a/rs/moq-crypto/tests/transport.rs b/rs/moq-e2ee/tests/transport.rs similarity index 86% rename from rs/moq-crypto/tests/transport.rs rename to rs/moq-e2ee/tests/transport.rs index c983c6d516d..40d69d24353 100644 --- a/rs/moq-crypto/tests/transport.rs +++ b/rs/moq-e2ee/tests/transport.rs @@ -4,8 +4,8 @@ mod support; use std::time::Duration; -use moq_crypto::e2ee::Credential; -use moq_crypto::e2ee::credential::Config; +use moq_e2ee::Credential; +use moq_e2ee::credential::Config; use moq_net::{Timestamp, Version}; use support::harness::{MockConnectOptions, MockPair, connect_mock}; @@ -30,8 +30,8 @@ fn timed_datagrams() -> moq_net::datagram::Info { /// A protected broadcast and its subscriber's view across one session. struct Fixture { - producer: moq_crypto::e2ee::broadcast::Producer, - consumer: moq_crypto::e2ee::broadcast::Consumer, + producer: moq_e2ee::broadcast::Producer, + consumer: moq_e2ee::broadcast::Consumer, _broadcast: moq_net::origin::Route, _pair: MockPair, } @@ -40,7 +40,7 @@ async fn connect_protected(version: Version, label: &str) -> Fixture { let cred = Credential::new(Config { context: format!("transport-{version}-{label}").into(), kid: 7, - secret: *b"moq-e2ee-00 test secret!!!!!!!!!", + secret: *b"moq-e2ee-01-wip test secret!!!!!", }) .unwrap(); let generation = cred.produce(); @@ -51,7 +51,7 @@ async fn connect_protected(version: Version, label: &str) -> Fixture { let options = moq_net::origin::RouteOptions::hidden().with_instance(generation.epoch().instance(), 0); let broadcast = publisher.route(&path, options).unwrap(); - let producer = moq_crypto::e2ee::broadcast::Producer::new(broadcast.broadcast().clone(), generation.clone()); + let producer = moq_e2ee::broadcast::Producer::new(broadcast.broadcast().clone(), generation.clone()); broadcast.announce().unwrap(); let mut options = MockConnectOptions::new(version); @@ -71,13 +71,13 @@ async fn connect_protected(version: Version, label: &str) -> Fixture { .unwrap(); if version.to_string().starts_with("moq-lite-07") { assert_eq!( - moq_crypto::e2ee::Epoch::of(&remote).as_ref(), + moq_e2ee::Epoch::of(&remote).as_ref(), Some(generation.epoch()), "lite-07 announces the epoch" ); } - let epoch = moq_crypto::e2ee::Epoch::of(&remote).unwrap_or_else(|| generation.epoch().clone()); - let consumer = moq_crypto::e2ee::broadcast::Consumer::new(remote, cred.consume(epoch)); + let epoch = moq_e2ee::Epoch::of(&remote).unwrap_or_else(|| generation.epoch().clone()); + let consumer = moq_e2ee::broadcast::Consumer::new(remote, cred.consume(epoch)); Fixture { producer, @@ -136,7 +136,7 @@ async fn datagram_roundtrip(version: &str, plaintext: &[u8]) { let sequence = producer.append(Timestamp::from_millis(9).unwrap(), plaintext).unwrap(); match consumer.recv().await.unwrap() { - Some(moq_crypto::e2ee::datagram::Event::Datagram(d)) => { + Some(moq_e2ee::datagram::Event::Datagram(d)) => { assert_eq!(&d.plaintext[..], plaintext); assert_eq!(d.sequence, sequence); } @@ -155,7 +155,7 @@ async fn datagrams_over_lite_05() { /// The largest plaintext still fits lite-07's datagram body at its widest header. #[tokio::test] async fn max_datagram_over_lite_07() { - datagram_roundtrip("moq-lite-07-wip", &[7; moq_crypto::e2ee::MAX_DATAGRAM_PLAINTEXT]).await; + datagram_roundtrip("moq-lite-07-wip", &[7; moq_e2ee::MAX_DATAGRAM_PLAINTEXT]).await; } #[tokio::test] diff --git a/sh/gh/nightly.sh b/sh/gh/nightly.sh index 54c6d7e9f80..9fc3575680a 100755 --- a/sh/gh/nightly.sh +++ b/sh/gh/nightly.sh @@ -157,7 +157,7 @@ case "$1" in criterion msf -p moq-msf --bench catalog # The allocation/window/play-buffer/batch/receive-bursts/openh264 tables keep their stdout in the run; # only Criterion estimates enter the trend report. - criterion extra --no-fail-fast -p moq-crypto -p moq-json -p moq-archive -p moq-cli -p moq-mux -p moq-audio \ + criterion extra --no-fail-fast -p moq-e2ee -p moq-json -p moq-archive -p moq-cli -p moq-mux -p moq-audio \ -p moq-quic -p moq-sock -p moq-tokio -p moq-transcode -p moq-hls -p moq-video \ --features moq-json/bench,moq-quic/fuzz,moq-video/openh264 \ --bench protect --bench codec --bench table --bench allocations --bench window \ diff --git a/test/justfile b/test/justfile index 69e03d465b3..1dfd24d35fc 100644 --- a/test/justfile +++ b/test/justfile @@ -68,7 +68,7 @@ harness: [positional-arguments] interop *args: uv run --no-project python ../sh/js/install.py frozen - just rs test -p moq-net -p moq-crypto --lib \ + just rs test -p moq-net --features moq-net/async --lib \ auth_unsupported_interop \ ietf_compression_fallback_interop \ ietf_datagram_interop \