use crate::error::{ErrorString, LibraryError};
use thiserror::Error;
#[derive(Error, Debug, PartialEq, Clone)]
pub enum ExtensionError {
#[error("Found a duplicate ratchet tree extension.")]
DuplicateRatchetTreeExtension,
#[error("Unsupported proposal type in required capabilities.")]
UnsupportedProposalType,
#[error("Unsupported extension type in required capabilities.")]
UnsupportedExtensionType,
#[error(transparent)]
LibraryError(#[from] LibraryError),
#[error(transparent)]
InvalidExtensionType(#[from] ErrorString),
#[error(transparent)]
Capabilities(#[from] CapabilitiesExtensionError),
#[error(transparent)]
Lifetime(#[from] LifetimeExtensionError),
#[error(transparent)]
KeyPackageId(#[from] KeyPackageIdError),
#[error(transparent)]
ParentHash(#[from] ParentHashError),
#[error(transparent)]
RatchetTree(#[from] RatchetTreeError),
#[error(transparent)]
InvalidExtension(#[from] InvalidExtensionError),
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum LifetimeExtensionError {
#[error("Invalid lifetime extensions.")]
Invalid,
#[error("Lifetime extension is expired.")]
Expired,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum CapabilitiesExtensionError {
#[error("Invalid capabilities extensions.")]
Invalid,
#[error("Capabilities extension is missing a version field.")]
EmptyVersionsField,
#[error("Capabilities contains only unsupported ciphersuites.")]
UnsupportedCiphersuite,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum KeyPackageIdError {
#[error("Invalid key package ID extensions.")]
Invalid,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum ParentHashError {
#[error("Invalid parent hash extensions.")]
Invalid,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum RatchetTreeError {
#[error("Invalid ratchet tree extensions.")]
Invalid,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum InvalidExtensionError {
#[error("The provided extension list contains duplicate extensions.")]
Duplicate,
}