moq-token
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
kidfor rotation and an optional immutable scope that caps every token the key signs. - Claims:
root,put,get,exp,iat.Key::signandKey::verifyhandle 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-tokenThe 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.