openmls/key_packages/
errors.rs1use openmls_traits::types::Ciphersuite;
6use thiserror::Error;
7
8use crate::{
9 ciphersuite::signable::SignatureError, error::LibraryError,
10 prelude::ExtensionTypeNotValidInKeyPackageError, treesync::errors::LifetimeError,
11};
12
13#[derive(Error, Debug, PartialEq, Clone)]
15pub enum KeyPackageVerifyError {
16 #[error(transparent)]
18 LibraryError(#[from] LibraryError),
19 #[error(transparent)]
21 LifetimeError(#[from] LifetimeError),
22 #[error("The lifetime of the leaf node is missing.")]
24 MissingLifetime,
25 #[error("A key package extension is not supported in the leaf's capabilities.")]
27 UnsupportedExtension,
28 #[error("The key package signature is not valid.")]
30 InvalidSignature,
31 #[error("The leaf node signature is not valid.")]
33 InvalidLeafNodeSignature,
34 #[error("Invalid LeafNode source type")]
36 InvalidLeafNodeSourceType,
37 #[error("The init key and the encryption key are equal.")]
39 InitKeyEqualsEncryptionKey,
40 #[error("The protocol version is not valid.")]
42 InvalidProtocolVersion,
43 #[error(transparent)]
45 ExtensionTypeNotValidInKeyPackage(#[from] ExtensionTypeNotValidInKeyPackageError),
46}
47
48#[derive(Error, Debug, PartialEq, Eq, Clone)]
50pub enum KeyPackageExtensionSupportError {
51 #[error("The key package does not support all required extensions.")]
53 UnsupportedExtension,
54}
55
56#[derive(Error, Debug, PartialEq, Clone)]
58pub enum KeyPackageNewError {
59 #[error(transparent)]
61 LibraryError(#[from] LibraryError),
62 #[error("The ciphersuite does not match the signature scheme.")]
64 CiphersuiteSignatureSchemeMismatch,
65 #[error("Ciphersuite {0:?} is not supported by the crypto provider.")]
67 UnsupportedCiphersuite(Ciphersuite),
68 #[error("Accessing storage failed.")]
70 StorageError,
71 #[error(transparent)]
73 SignatureError(#[from] SignatureError),
74 #[cfg(feature = "virtual-clients-draft")]
76 #[error(transparent)]
77 VirtualClientsError(#[from] crate::components::vc_derivation_info::VirtualClientsError),
78 #[cfg(feature = "virtual-clients-draft")]
80 #[error("A virtual-clients KeyPackage batch must request at least one KeyPackage.")]
81 EmptyBatch,
82}