use thiserror::Error;
use crate::{error::LibraryError, extensions::errors::ExtensionError};
#[derive(Error, Debug, PartialEq, Clone)]
pub enum KeyPackageVerifyError {
#[error(transparent)]
LibraryError(#[from] LibraryError),
#[error("The lifetime extension of the key package is not valid.")]
InvalidLifetimeExtension,
#[error("A mandatory extension is missing in the key package.")]
MandatoryExtensionsMissing,
#[error("The key package signature is not valid.")]
InvalidSignature,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum KeyPackageExtensionSupportError {
#[error("The key package does not support all required extensions.")]
UnsupportedExtension,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum KeyPackageNewError {
#[error(transparent)]
LibraryError(#[from] LibraryError),
#[error("The ciphersuite does not match the signature scheme.")]
CiphersuiteSignatureSchemeMismatch,
}
#[derive(Error, Debug, PartialEq, Clone)]
pub enum KeyPackageBundleNewError {
#[error(transparent)]
LibraryError(#[from] LibraryError),
#[error("Creating a new key package requires at least one ciphersuite.")]
NoCiphersuitesSupplied,
#[error("The ciphersuite does not match the signature scheme.")]
CiphersuiteSignatureSchemeMismatch,
#[error("Duplicate extensions are not allowed.")]
DuplicateExtension,
#[error("The list of ciphersuites is not consistent with the capabilities extension.")]
CiphersuiteMismatch,
#[error(transparent)]
ExtensionError(#[from] ExtensionError),
}