pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("unsupported wire format version {0}")]
UnsupportedVersion(u8),
#[error("unsupported cipher suite {0}")]
UnsupportedSuite(u8),
#[error(
"quantum-shield v1 (0.1.x) artifacts are not supported; \
decrypt with a 0.1.x build and re-encrypt with v2"
)]
LegacyV1Artifact,
#[error("invalid key material")]
InvalidKey,
#[error("invalid envelope encoding")]
InvalidEnvelope,
#[error("invalid signature encoding")]
InvalidSignature,
#[error("decryption failed")]
DecryptionFailed,
#[error("signature verification failed")]
VerificationFailed,
#[error("message too large: {len} bytes exceeds the {max}-byte limit")]
MessageTooLarge {
len: usize,
max: usize,
},
#[error("context longer than 255 bytes")]
ContextTooLong,
#[error("operating system randomness unavailable")]
RandomnessUnavailable,
#[error("no recipients")]
NoRecipients,
#[error("too many recipients: {count} exceeds the {max} limit")]
TooManyRecipients {
count: usize,
max: usize,
},
#[error("stream already finished")]
StreamFinished,
#[error("stream truncated")]
StreamTruncated,
}