openmls/key_packages/
errors.rs1use openmls_traits::types::Ciphersuite;
6use thiserror::Error;
7
8use crate::{
9 ciphersuite::signable::SignatureError,
10 error::LibraryError,
11 prelude::ExtensionTypeNotValidInKeyPackageError,
12 treesync::{errors::LifetimeError, node::leaf_node::LeafNodeBuildError},
13};
14
15#[derive(Error, Debug, PartialEq, Clone)]
17pub enum KeyPackageVerifyError {
18 #[error(transparent)]
20 LibraryError(#[from] LibraryError),
21 #[error(transparent)]
23 LifetimeError(#[from] LifetimeError),
24 #[error("The lifetime of the leaf node is missing.")]
26 MissingLifetime,
27 #[error("A key package extension is not supported in the leaf's capabilities.")]
29 UnsupportedExtension,
30 #[error("The key package signature is not valid.")]
32 InvalidSignature,
33 #[error("The leaf node signature is not valid.")]
35 InvalidLeafNodeSignature,
36 #[error("Invalid LeafNode source type")]
38 InvalidLeafNodeSourceType,
39 #[error("The init key and the encryption key are equal.")]
41 InitKeyEqualsEncryptionKey,
42 #[error("The protocol version is not valid.")]
44 InvalidProtocolVersion,
45 #[error("Ciphersuite {0:?} is not supported by the crypto provider.")]
47 UnsupportedCiphersuite(Ciphersuite),
48 #[error(transparent)]
50 ExtensionTypeNotValidInKeyPackage(#[from] ExtensionTypeNotValidInKeyPackageError),
51}
52
53#[derive(Error, Debug, PartialEq, Eq, Clone)]
55pub enum KeyPackageExtensionSupportError {
56 #[error("The key package does not support all required extensions.")]
58 UnsupportedExtension,
59}
60
61#[derive(Error, Debug, PartialEq, Clone)]
63pub enum KeyPackageNewError {
64 #[error(transparent)]
66 LibraryError(#[from] LibraryError),
67 #[error("The ciphersuite does not match the signature scheme.")]
69 CiphersuiteSignatureSchemeMismatch,
70 #[error("Ciphersuite {0:?} is not supported by the crypto provider.")]
72 UnsupportedCiphersuite(Ciphersuite),
73 #[error("Accessing storage failed.")]
75 StorageError,
76 #[error(transparent)]
78 SignatureError(#[from] SignatureError),
79 #[error(transparent)]
81 LeafNodeBuild(#[from] LeafNodeBuildError),
82 #[cfg(feature = "virtual-clients-draft")]
84 #[error(transparent)]
85 VirtualClientsError(#[from] crate::components::vc_derivation_info::VirtualClientsError),
86 #[cfg(feature = "virtual-clients-draft")]
88 #[error("A virtual-clients KeyPackage batch must request at least one KeyPackage.")]
89 EmptyBatch,
90}