Skip to main content

moq_e2ee/
error.rs

1/// Typed failures from [draft-lcurley-moq-e2ee](https://datatracker.ietf.org/doc/draft-lcurley-moq-e2ee/).
2///
3/// Display is the profile code. Secrets, keys, and plaintext never appear here.
4#[derive(thiserror::Error, Debug, Clone)]
5#[non_exhaustive]
6pub enum Error {
7	/// An integer is outside the profile bounds, a `bytes` field exceeds 65535, an epoch is empty or contains `/`, or a name is not 22 base64url characters.
8	#[error("identity")]
9	Identity,
10
11	/// The next AEAD operation would exceed `2^24` uses of that key or `2^36` plaintext bytes under that key.
12	#[error("exhausted")]
13	Exhausted,
14
15	/// Encrypting at a sequence this generation already allocated, or producing a track it already claimed.
16	#[error("reuse")]
17	Reuse,
18
19	/// Plaintext plus tag exceeds the transport payload limit, or a ciphertext is shorter than the tag or larger than that limit.
20	#[error("oversize")]
21	Oversize,
22
23	/// AEAD open failed, including relocation across any identity field.
24	#[error("authentication")]
25	Authentication,
26
27	/// The underlying MoQ track failed.
28	#[error(transparent)]
29	Net(#[from] moq_net::Error),
30}
31
32/// A [`Result`](std::result::Result) using this crate's [`Error`].
33pub type Result<T> = std::result::Result<T, Error>;