Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ default-members = [
"rs/moq-rtsp",
"rs/moq-scene",
"rs/moq-shaper",
"rs/moq-sign",
"rs/moq-sock",
"rs/moq-srt",
"rs/moq-stats",
Expand Down Expand Up @@ -106,6 +107,7 @@ clap = { version = "4", features = ["derive"] }
# CUDA driver bindings for the NVENC/NVDEC path. dlopen'd at runtime
# (`fallback-dynamic-loading`), so nothing links against libcuda at build time.
cudarc = { version = "0.19", default-features = false, features = ["driver", "fallback-dynamic-loading", "cuda-12020"] }
data-encoding = "2.11"
dispatch2 = "0.3.1"
ebml-iterable = "0.7.1"
flate2 = { version = "1.1", default-features = false }
Expand Down
15 changes: 15 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions doc/concept/standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ with it, while shipping a simpler profile you can use today.
| [moq-transport](https://datatracker.ietf.org/doc/draft-ietf-moq-transport/) | The IETF pub/sub protocol | Drafts 18, 20, and 22 negotiated by ALPN; [moq-lite](/concept/moq-lite) is a forward-compatible subset |
| [MSF](https://datatracker.ietf.org/doc/draft-ietf-moq-msf/) | The IETF catalog format | Read and written; broadcasts ending in `.msf` select it |
| [LOC](https://datatracker.ietf.org/doc/draft-ietf-moq-loc/) | The IETF low-overhead container | Supported as a hang container kind |
| [moq-lite](/draft/moq-lite), [hang](/draft/moq-hang), [e2ee](/draft/moq-e2ee), and friends | This project's own drafts | Normative for the implementation, published to the datatracker from [`drafts/`](https://github.com/moq-dev/moq/tree/main/drafts) |
| [moq-lite](/draft/moq-lite), [hang](/draft/moq-hang), [e2ee](/draft/moq-e2ee), [sign](/draft/moq-sign), and friends | This project's own drafts | Normative for the implementation, published to the datatracker from [`drafts/`](https://github.com/moq-dev/moq/tree/main/drafts) |

## moq-transport

Expand Down Expand Up @@ -62,7 +62,9 @@ does not offer it does not carry this state. Only Rust offers the extension, whe
`extensions.ietf` is set, and `moq-relay` always does on moq-lite-07.
[moq-e2ee](/draft/moq-e2ee) is not a transport extension. It encrypts
application payloads, so relays still forward named tracks they cannot read.
See [Encryption](/concept/hang#encryption).
See [Encryption](/concept/hang#encryption). [moq-sign](/draft/moq-sign) is not
one either: it appends an Ed25519 signature to each frame, so relays still
forward and cache frames they cannot forge.

### Deliberate deviations

Expand Down
1 change: 1 addition & 0 deletions doc/lib/js/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ small examples. The [API reference](/lib/js/api/) covers every package; source l
| [@moq/signals](/lib/js/signals) | The reactive primitives every package exposes its state through. |
| [@moq/json](/lib/js/json) | JSON over tracks: snapshots with merge-patch deltas, or append logs. |
| [@moq/e2ee](https://github.com/moq-dev/moq/tree/main/js/e2ee) | End-to-end encryption of groups, datagrams, and track names, scoped to a publisher epoch. Workspace-only until the browser components use it. |
| [@moq/sign](https://github.com/moq-dev/moq/tree/main/js/sign) | Per-frame Ed25519 signatures, so relays forward content they cannot forge, retime, or relocate. Workspace-only until the mesh uses it. |
| [@moq/loc](/lib/js/api/loc), [@moq/msf](/lib/js/api/msf) | The IETF LOC container and MSF catalog. |
| [@moq/boy](/lib/js/api/boy) | The [MoQ Boy](/bin/demo) player element. |

Expand Down
1 change: 1 addition & 0 deletions doc/lib/rs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ see [Applications](/bin/). [Examples](/setup/examples) links runnable consumers;
| [moq-room](/lib/rs/moq-room) | Workspace-only native rooms; use the published JS room API for applications. |
| [moq-json](/lib/rs/moq-json) | JSON over tracks: snapshots with merge-patch deltas, or append logs. |
| [moq-e2ee](https://github.com/moq-dev/moq/tree/main/rs/moq-e2ee) | Workspace-only end-to-end encryption of groups, datagrams, and track names, scoped to a publisher epoch. |
| [moq-sign](https://github.com/moq-dev/moq/tree/main/rs/moq-sign) | Workspace-only per-frame Ed25519 signatures, so relays forward content they cannot forge, retime, or relocate. |
| [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. |
| [moq-clock](/lib/rs/moq-clock) | One clock for time and timers on tokio, the browser, and a deterministic test simulator. |
Expand Down
1 change: 1 addition & 0 deletions doc/setup/repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ wrap the Rust core. [Layers](/lib/layers) maps the binding namespaces.
| 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 | [`rs/moq-room`](https://github.com/moq-dev/moq/tree/main/rs/moq-room), [`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-e2ee`](https://github.com/moq-dev/moq/tree/main/rs/moq-e2ee), [`js/e2ee`](https://github.com/moq-dev/moq/tree/main/js/e2ee) | [Media encryption](/concept/hang), [E2EE draft](/draft/moq-e2ee) |
| Signed content | [`rs/moq-sign`](https://github.com/moq-dev/moq/tree/main/rs/moq-sign), [`js/sign`](https://github.com/moq-dev/moq/tree/main/js/sign) | [Signing draft](/draft/moq-sign) |
| Async primitives and deterministic time | [`rs/kio`](https://github.com/moq-dev/moq/tree/main/rs/kio), [`rs/moq-clock`](https://github.com/moq-dev/moq/tree/main/rs/moq-clock), [`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
Expand Down
213 changes: 213 additions & 0 deletions drafts/draft-lcurley-moq-sign.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
---
title: "MoQ Per-Frame Signature Profile"
abbrev: "moq-sign"
category: info

docname: draft-lcurley-moq-sign-latest
submissiontype: IETF # also: "independent", "editorial", "IAB", or "IRTF"
number:
date:
v: 3
area: wit
workgroup: moq

author:
-
fullname: Luke Curley
email: kixelated@gmail.com

normative:
moql: I-D.lcurley-moq-lite
RFC8032:
zbase32:
title: "Human-oriented base-32 encoding"
author:
- fullname: Zooko Wilcox-O'Hearn
date: 2002
target: https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt

informative:
moqt: I-D.ietf-moq-transport
e2ee: I-D.lcurley-moq-e2ee
iroh:
title: "iroh"
target: https://github.com/n0-computer/iroh
pkarr:
title: "Pkarr: Public-Key Addressable Resource Records"
target: https://github.com/pubky/pkarr

--- abstract

This document specifies moq-sign-00, a versioned profile that authenticates MoQ application payloads with a per-frame Ed25519 signature.
A publisher signs each grouped frame with its endpoint key, binding the broadcast path, the publisher epoch, the track, the group, the frame index, and the frame's timestamp.
A subscriber that expects that key delivers a frame only after its signature verifies, so a relay can forward and cache content without forging it, retiming it, or moving it to another position.

--- note_Note_to_Readers

This document was generated by an AI model from the implementation at [github.com/moq-dev/moq](https://github.com/moq-dev/moq) and is maintained alongside it.
Submit an [issue](https://github.com/moq-dev/moq/issues) or [PR](https://github.com/moq-dev/moq/pulls) if this spec sucks and you want to fix anything.

--- middle

# Conventions and Definitions
{::boilerplate bcp14-tagged}


# Introduction
MoQ relays forward named tracks of groups and frames ({{moql}}, {{moqt}}) without parsing application payloads.
Transport security protects each hop, but a relay terminates it and can rewrite whatever it forwards.
This profile lets a subscriber check that every frame it delivers came from the publisher it expects, unmodified and at the position the publisher wrote it.

A signature per frame costs 64 bytes and one verification, and adds no delay beyond receiving the whole frame: no hash chain or checkpoint has to arrive first.
The profile provides authenticity, not confidentiality; {{e2ee}} encrypts payloads and can be layered beneath it.

The profile uses public-key signatures rather than a symmetric MAC or AEAD tag.
A symmetric key, as in {{e2ee}}, is shared by everyone who verifies, so any subscriber holding it could forge frames that every other subscriber accepts.
A signature verifies under the publisher's public key alone, so only the holder of the secret key can produce one, whoever else reads the broadcast.


# Profile Version
This document defines profile `moq-sign-00`.
Both ends agree on the profile out of band; a subscriber MUST NOT accept unsigned frames, or another profile, because an announcement, catalog, or peer suggested one.


# Endpoint Key {#key}
A publisher holds an Ed25519 key pair ({{RFC8032}}).
The 32-byte public key is the endpoint ID.
Its text form is the z-base-32 encoding ({{zbase32}}) of the key, most significant bit first and without padding: 52 characters, the form {{pkarr}} and {{iroh}}'s DNS discovery use, and a valid DNS label.
The last character carries one bit of the key; its remaining four bits MUST be zero.
An implementation MUST refuse other text, including uppercase, nonzero trailing bits, and other encodings of the key such as hex, so one key has exactly one ID.

The key identifies an endpoint for as long as the endpoint exists.
An implementation MUST NOT replace a stored key that fails to load; that would silently change the endpoint's identity.

How a subscriber learns the key it expects is out of scope.
An application can, for example, publish each endpoint's broadcasts under a path containing its ID, so the subscriber reads the key from the path it subscribes to.


# Signed Message {#message}
Integers are unsigned big-endian of the stated width, and `bytes(x)` is `u64(length) || x`.

~~~
message = "moq-sign-00"
|| bytes(path)
|| bytes(epoch)
|| bytes(track)
|| u64(group)
|| u64(frame)
|| u64(timescale)
|| u64(timestamp)
|| payload
~~~

**path**:
The UTF-8 broadcast path both ends name the broadcast by.
A relay may mount a broadcast under another prefix, so this is the application's path, not the one a transport hop reports.

**epoch**:
The UUID text of the publisher instance's epoch, carried on the broadcast's route ({{moql}}).
A publisher instance MUST sign under an epoch it minted and no other instance has used.
The epoch names one sequence space: a publisher that restarts its group sequences signs under a new one.

**track**:
The UTF-8 track name.
A subscriber uses the name it subscribed to, never one a relay reports.

**group**:
The group sequence.
A publisher instance MUST NOT sign two groups at the same sequence of a track, even after the first is aborted or evicted, or after the track is replaced.

**frame**:
The frame's index within its group.
moq-lite numbers frames from 0 in write order; on MoQ Transport this is the Object ID, which a publisher assigns contiguously from zero.

**timescale**:
The track's timescale in units per second, or 0 for an untimed track.
No timescale is 0, so an untimed frame cannot be confused with a timed one.

**timestamp**:
The frame's presentation timestamp at the track's timescale, as the transport carries it, or 0 for an untimed track.
A publisher signs the value after any conversion to the track's timescale, so the subscriber verifies against exactly what it receives.

**payload**:
The application bytes.

Each length prefix keeps one field's bytes from shifting into the next.
Other frame properties are not signed.


# Frame Body {#body}
The frame carried by MoQ is the payload followed by the 64-byte Ed25519 signature of the message.

~~~
body = payload || Ed25519-Sign(secret_key, message)
~~~

A body shorter than 64 bytes, or whose signature does not verify ({{RFC8032}} Section 5.1.7) under the expected key at the frame's identity, is a `signature` failure.


# Failure Behavior {#failure}
A subscriber MUST NOT deliver any byte of a frame before its signature verifies.

A `signature` failure ends that group for the subscriber: it MUST deliver no later frame of the group.
Other groups of the track continue, since each verifies on its own.

A subscriber that cannot learn the broadcast's epoch from its route MUST refuse to read it (`epoch`).

Every hop between the publisher and the subscriber must carry the route's epoch and each frame's timestamp and timescale unchanged; in {{moql}} that is moq-lite-07.
A hop that cannot, such as a moq-lite-05 or -06 hop that stamps an untimed frame with its send time, causes `signature` failures rather than a frame delivered with the wrong time.

Datagrams are not covered by this profile; a subscriber MUST NOT deliver datagrams from a track it reads under it.


# Test Vectors {#vectors}
Known-answer and negative vectors live in `moq-sign-00.json` beside this draft.
Hex strings are octet sequences, and `endpoint` strings are endpoint ID text.
The file covers key derivation from a seed, including {{RFC8032}} Section 7.1 TEST 1, and each key's endpoint ID; signed messages and bodies for an empty payload, groups, frame indices, and timestamps above 32 bits, an empty path, a non-ASCII track, and a timed frame; relocation across every identity field, including a byte shifted between two fields, a timestamp rescaled to the same instant, and a timestamp added to or dropped from a frame; a wrong key; tampered payloads and signatures; truncated, extended, and empty bodies; and endpoint ID text that MUST be refused.


# Security Considerations
Relays, caches, and recorders are untrusted for content.
The publisher's secret key is trusted; anyone holding it can sign as that endpoint.

The signature binds every field a relay could otherwise change to move or retime an authentic frame: the path, the epoch, the track, the group, the frame index, and the timestamp.
Binding the epoch keeps a frame from an earlier instance of the same broadcast, which restarted its sequences, from verifying in a later one.
Within an instance, a signed position names one frame only because the publisher never signs a group sequence twice; a relay holding two groups signed at one sequence could splice their frames into a group that was never published.
Binding the timestamp keeps a relay from changing when a frame presents.

Any subscriber can verify but none can sign, so subscribers that share a broadcast cannot forge frames to each other, as they could with a shared symmetric key.

A relay can still delay, drop, or reorder groups.
A relay that presents a wrong epoch only causes `signature` failures.

## Freshness {#freshness}
The profile authenticates content, not liveness.
The subscriber learns the epoch from the route, which a relay presents, so a relay that recorded an instance can later announce that epoch again and replay the instance's frames, whole or in part, after the publisher has gone or restarted.
Every replayed frame verifies, because the publisher did sign it at that position.
Binding the epoch only keeps frames of different instances from being spliced into one.
An application that needs freshness learns the expected epoch from a channel it trusts, or checks the signed timestamps against a clock it shares with the publisher.

## Group End {#group-end}
Nothing authenticates where a group ends: a relay can end a group after any frame, and the subscriber sees an ordinary end of group.
MoQ already lets a relay drop the tail of a group, for example when it falls behind the subscriber's delivery deadline, so the profile does not try to prevent it.
An application MUST NOT treat a group's end as proof that it received every frame the publisher wrote.
One that needs a complete group, such as a byte stream reading the end as a clean close, signs its own end marker as the group's last frame.

A relay can observe everything a signature does not hide: paths, epochs, track names, payloads, sizes, and timing.

Ed25519 signing is deterministic, so no per-signature randomness can leak the key.


# IANA Considerations
This document requests no registrations.


--- back

# Changelog
{:numbered="false"}

## draft-lcurley-moq-sign-00
{:numbered="false"}

- Initial `moq-sign-00` profile: Ed25519 endpoint keys with a z-base-32 ID, a message binding path, epoch, track, group, frame index, and timestamp, a payload-then-signature frame body, group-ending failures, an unauthenticated group end, no freshness guarantee, and shared vectors.
Loading