use thiserror::Error;
#[derive(Debug, Error)]
pub enum MoqSecureError {
#[error("invalid magic bytes")]
InvalidMagic,
#[error("unsupported version: {0}")]
UnsupportedVersion(u8),
#[error("unsupported AEAD algorithm: {0}")]
UnsupportedAlgorithm(u8),
#[error("not enough bytes in frame")]
TruncatedFrame,
#[error("ciphertext too short for AEAD tag")]
CiphertextTooShort,
#[error("invalid padding length")]
InvalidPadLength,
#[error("invalid sigFlag: expected 0 or 1, got {0}")]
InvalidSigFlag(u8),
#[error("AEAD authentication failed")]
AeadAuthFailed,
#[error("signature invalid or signature verification failed")]
InvalidSignature,
#[error(
"signing is disabled but sigFlag indicates a signature or sigSlot is non-zero"
)]
SigningMismatch,
#[error(
"signing enabled but sigFlag indicates a signature while sigSlot is missing or zero"
)]
MissingSigSlot,
#[error("signature present with sigFlag=1 but nSigned is 0")]
SignatureNotAllowedByNSigned,
#[error("decryption failed")]
DecryptFailed,
#[error("unknown or not-loaded key_id: {0}")]
InvalidKeyId(u8),
#[error("replay detected, ctr lower than previous high watermark")]
ReplayDetected,
}