Repository navigation
Conversation
zshenker
force-pushed
the
moqt-support
branch
from
October 19, 2026 21:43
ef7912f to
3361b25
Compare
Implement the moqt and moqt-reval claims so the library can issue and
validate tokens for MoQT relays, publishers, and clients:
- New moqt module: typed MoqtClaim/MoqtScope/BinMatch scopes,
MoqtAction codes, and MoqtRequest, with strict parsing and bytewise
Full Track Name matching.
- TokenBuilder::moqt/moqt_reval, Token::moqt_claim/moqt_reval, and
VerificationOptions::{verify_moqt, require_moqt, moqt_request,
moqt_revalidation}.
- CborValue::Float (now non_exhaustive), decoding half/single/double
floats and encoding in the shortest exact width, as needed for the
draft's half-float moqt-reval test vector.
- examples/moqt.rs covering edge relay, ingest relay, and publisher
validation; README, CHANGELOG, and FOLLOWUPS updates.
Claim keys 327/328 are provisional, taken from the draft's test vectors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
draft-ietf-moq-c4m §2: "As soon as a token is provided, all actions are explicitly blocked unless explicitly enabled." verify_moqt(true) now rejects a token with no moqt claim with MoqtNotAuthorized, instead of passing it unless require_moqt was set. require_moqt is removed as redundant (0.4.0 is unreleased). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IANA still lists both labels as TBD, so issuers may use labels other than the provisional 327/328 until registration. Add MoqtClaimLabels (Default = moqt_keys::MOQT / MOQT_REVAL, so a derived VerificationOptions::default() doesn't silently read label 0), VerificationOptions::moqt_claim_labels, and Token::moqt_claim_at / moqt_reval_at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now that the branch is based on the typed VerifyingKey API, verify tokens with verify_with_key instead of the deprecated verify(). The ES256 MoQ test uses the fixed demo key pair instead of generating one with rand_core, so it no longer depends on PS256-only dependencies. Add a test that an HMAC forgery over an ES256 public key is rejected before any moqt scope is consulted, and drop the completed FOLLOWUPS item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zshenker
force-pushed
the
moqt-support
branch
from
October 19, 2026 21:51
3361b25 to
a2cf0d8
Compare
Add MoqtScope::matches_name(namespace, track), which applies a scope's namespace field matches, trailing-nil length pin and (when a track is given) track match without consulting its actions. permits() now uses it, so callers that must re-check names against scopes they have already selected by action -- e.g. each track later routed to a publisher after PUBLISH_NAMESPACE, or namespaces returned for SUBSCRIBE_NAMESPACE discovery -- share the exact matcher instead of reimplementing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the
moqtandmoqt-revalclaims from draft-ietf-moq-c4m-01. With them, the library can issue and validate tokens for MoQ Transport relays, publishers, and clients.moqtmodule.MoqtClaim/MoqtScope/BinMatchscopes,MoqtActioncodes 0–8, andMoqtRequest, which is an action plus a Full Track Name.nilpins the namespace length.Error::InvalidMoqtClaim. It is never ignored, so it can't widen access.TokenBuilder::moqt/moqt_revalandToken::moqt_claim/moqt_reval, plusToken::moqt_claim_at/moqt_reval_atto read either claim at any label.VerificationOptionsfields:verify_moqt,moqt_request,moqt_revalidation, andmoqt_claim_labels(MoqtClaimLabels, defaulting to 327/328).MoqtNotAuthorizedandMoqtRevalidationUnsupported.moqt-revalhandling. As the draft requires, recipients that can't revalidate reject tokens with a non-zero interval. The default formoqt_revalidationisUnsupported. Recipients that can revalidate reject intervals below their supported minimum.CborValue::Float. Floats are decoded at half, single, or double precision, and encoded at the shortest width that is exact. Without this, the draft's half-floatmoqt-revaltest vector (f95cb0) fails to decode. It uses minicbor'shalffeature; thehalfcrate is already inCargo.lockthrough criterion.Validator roles
The check is the same whoever does it, so there is one role-neutral API: verify the signature with
verify_with_keyand a typedVerifyingKey(from #6), then callverify_claimswith aMoqtRequest.examples/moqt.rscovers three roles:A relay can keep a token from session setup and re-check it for later actions such as REQUEST_UPDATE. It can do that through
verify_claims, or by callingMoqtClaim::permitson a cached claim.MoqtScope::matches_nameexposes the same name matcher without the action check, for re-checking names against scopes already selected by action (for example each track routed to a publisher after PUBLISH_NAMESPACE, or SUBSCRIBE_NAMESPACE discovery).Interpretation choices (flagged in docs and FOLLOWUPS)
[[2,6], ns, track], could never PUBLISH_NAMESPACE.moqtclaim. Withverify_moqt(true), a token without amoqtclaim authorizes no MoQ action. Draft §2 says that once a token is presented, all actions are blocked unless a scope enables them. (require_moqtwas removed as redundant.)moqt_claim_labelsto interoperate with issuers that use other labels.Breaking changes (0.4.0 is unreleased)
CborValueis now#[non_exhaustive]and has a newFloatvariant.VerificationOptionshas new public fields, which breaks code that builds it with a struct literal.Relationship to #6
This PR is based on #6 and uses its API: every signature check in the new tests, example, and README goes through
verify_with_keywith a typedVerifyingKey, so it adds no deprecation warnings. MoQ publishers and origins are expected to verify with public keys, which is exactly the algorithm-confusion case #6 fixes.test_moqt_hmac_forgery_over_public_key_is_rejectedchecks that an HMAC token forged over an ES256 public key is rejected before anymoqtscope is consulted.Deferred to
FOLLOWUPS.md:or/and/nor/critclaims.Testing
src/tests_moqt.rsholds 26 tests. They are in a separate file to avoid conflicts with the edits Prevent algorithm-confusion forgery with typed VerifyingKey #6 makes tosrc/tests.rs. They cover:cargo fmt --check,cargo clippy --all-targets -- -D warnings, andcargo test(86 unit tests, 75 doctests) all pass.cargo testpass both with default features (93 unit tests, 75 doctests) and with--no-default-features(87 unit tests, 75 doctests).🤖 Generated with Claude Code