MoQ is under active development. APIs and protocols may change between releases.

Skip to content

moq-token

crates.iodocs.rs

The tokens moq-relay authenticates with, as a library. Use it in an auth service that mints tokens for clients, or in your own server that wants the relay's path rules.

  • Keys: generate HS256/384/512, RS256/384/512, PS256/384/512, ES256/384, or EdDSA keys as JWKs, with a kid for rotation and an optional immutable scope that caps every token the key signs.
  • Claims: root, put, get, exp, iat. Key::sign and Key::verify handle the signature and expiry.
  • Authorization: Claims::authorize(path) scopes verified claims to the path a client dialed and returns the publish and subscribe prefixes, exactly as the relay does.
bash
cargo add moq-token

The CLI is moq token in moq-cli or the standalone moq-token-cli package; both wrap this crate. Examples: basic.rs and asymmetric.rs. The TypeScript twin, @moq/token, mints identical tokens. API: docs.rs/moq-token.

Licensed under MIT or Apache-2.0