openmls/extensions/
errors.rs1use crate::error::{ErrorString, LibraryError};
13
14use thiserror::Error;
15
16#[derive(Error, Debug, PartialEq, Clone)]
18pub enum ExtensionError {
19 #[error("Unsupported proposal type in required capabilities.")]
21 UnsupportedProposalType,
22 #[error("Unsupported extension type in required capabilities.")]
24 UnsupportedExtensionType,
25 #[error(transparent)]
27 LibraryError(#[from] LibraryError),
28 #[error(transparent)]
30 InvalidExtensionType(#[from] ErrorString),
31 #[error(transparent)]
33 Capabilities(#[from] CapabilitiesExtensionError),
34 #[error(transparent)]
36 KeyPackageId(#[from] KeyPackageIdError),
37 #[error(transparent)]
39 ParentHash(#[from] ParentHashError),
40 #[error(transparent)]
42 RatchetTree(#[from] RatchetTreeError),
43 #[error(transparent)]
45 InvalidExtension(#[from] InvalidExtensionError),
46}
47
48#[derive(Error, Debug, PartialEq, Eq, Clone)]
50pub enum CapabilitiesExtensionError {
51 #[error("Invalid capabilities extensions.")]
53 Invalid,
54 #[error("Capabilities extension is missing a version field.")]
56 EmptyVersionsField,
57 #[error("Capabilities contains only unsupported ciphersuites.")]
59 UnsupportedCiphersuite,
60}
61
62#[derive(Error, Debug, PartialEq, Eq, Clone)]
64pub enum KeyPackageIdError {
65 #[error("Invalid key package ID extensions.")]
67 Invalid,
68}
69
70#[derive(Error, Debug, PartialEq, Eq, Clone)]
72pub enum ParentHashError {
73 #[error("Invalid parent hash extensions.")]
75 Invalid,
76}
77
78#[derive(Error, Debug, PartialEq, Eq, Clone)]
80pub enum RatchetTreeError {
81 #[error("Invalid ratchet tree extensions.")]
83 Invalid,
84}
85
86#[derive(Error, Debug, PartialEq, Eq, Clone)]
88pub enum InvalidExtensionError {
89 #[error("The provided extension list contains duplicate extensions.")]
91 Duplicate,
92 #[error("The specified extension could not be found.")]
94 NotFound,
95 #[error(
97 "The provided extension list contains an extension that is not allowed in group contexts."
98 )]
99 IllegalInGroupContext,
100 #[error(
102 "The provided extension list contains an extension that is not allowed in leaf nodes."
103 )]
104 IllegalInLeafNodes,
105}