Skip to main content

openmls/group/mls_group/
errors.rs

1//! # MlsGroup errors
2//!
3//! This module defines the public errors that can be returned from all calls
4//! to methods of [`MlsGroup`](super::MlsGroup).
5
6// These errors are exposed through `crate::group::errors`.
7
8use thiserror::Error;
9
10use crate::{
11    error::LibraryError,
12    extensions::errors::InvalidExtensionError,
13    group::{
14        errors::{
15            CreateAddProposalError, CreateCommitError, MergeCommitError, StageCommitError,
16            ValidationError,
17        },
18        CommitBuilderStageError, CreateGroupContextExtProposalError,
19    },
20    schedule::errors::PskError,
21    treesync::{
22        errors::{LeafNodeValidationError, PublicTreeError},
23        node::leaf_node::LeafNodeUpdateError,
24    },
25};
26
27#[cfg(feature = "extensions-draft-08")]
28pub use crate::schedule::application_export_tree::ApplicationExportTreeError;
29
30#[cfg(doc)]
31use crate::group::GroupId;
32
33/// New group error
34#[derive(Error, Debug, PartialEq, Clone)]
35pub enum NewGroupError<StorageError> {
36    /// See [`LibraryError`] for more details.
37    #[error(transparent)]
38    LibraryError(#[from] LibraryError),
39    /// No matching KeyPackage was found in the key store.
40    #[error("No matching KeyPackage was found in the key store.")]
41    NoMatchingKeyPackage,
42    /// Error accessing the storage.
43    #[error("Error accessing the storage.")]
44    StorageError(StorageError),
45    /// Unsupported proposal type in required capabilities.
46    #[error("Unsupported proposal type in required capabilities.")]
47    UnsupportedProposalType,
48    /// Unsupported extension type in required capabilities.
49    #[error("Unsupported extension type in required capabilities.")]
50    UnsupportedExtensionType,
51    /// Invalid extensions set in configuration
52    #[error("Invalid extensions set in configuration")]
53    InvalidExtensions(#[from] InvalidExtensionError),
54    /// A group with the given [`GroupId`] already exists.
55    #[error("A group with the given GroupId already exists.")]
56    GroupAlreadyExists,
57}
58
59/// An error when deleting past epoch secrets.
60#[derive(Error, Debug, PartialEq, Eq, Clone)]
61pub enum DeletePastEpochSecretsError<StorageError> {
62    /// Error accessing the storage.
63    #[error(transparent)]
64    StorageError(#[from] StorageError),
65}
66
67/// An error when setting the past epoch deletion policy.
68#[derive(Error, Debug, PartialEq, Eq, Clone)]
69pub enum SetPastEpochDeletionPolicyError<StorageError> {
70    /// Error accessing the storage.
71    #[error(transparent)]
72    StorageError(#[from] StorageError),
73}
74
75/// EmptyInput error
76#[derive(Error, Debug, PartialEq, Eq, Clone)]
77pub enum EmptyInputError {
78    /// An empty list of KeyPackages was provided.
79    #[error("An empty list of KeyPackages was provided.")]
80    AddMembers,
81    /// An empty list of KeyPackage references was provided.
82    #[error("An empty list of KeyPackage references was provided.")]
83    RemoveMembers,
84}
85
86/// Group state error
87#[derive(Error, Debug, PartialEq, Clone)]
88pub enum MlsGroupStateError {
89    /// See [`LibraryError`] for more details.
90    #[error(transparent)]
91    LibraryError(#[from] LibraryError),
92    /// Tried to use a group after being evicted from it.
93    #[error("Tried to use a group after being evicted from it.")]
94    UseAfterEviction,
95    /// Can't create message because a pending proposal exists.
96    #[error("Can't create message because a pending proposal exists.")]
97    PendingProposal,
98    /// Can't execute operation because a pending commit exists.
99    #[error("Can't execute operation because a pending commit exists.")]
100    PendingCommit,
101    /// Can't execute operation because there is no pending commit.
102    #[error("Can't execute operation because there is no pending commit")]
103    NoPendingCommit,
104    /// Requested pending proposal hasn't been found in local pending proposals
105    #[error("Requested pending proposal hasn't been found in local pending proposals.")]
106    PendingProposalNotFound,
107}
108
109/// Error merging pending commit
110#[derive(Error, Debug, PartialEq, Clone)]
111pub enum MergePendingCommitError<StorageError> {
112    /// See [`MlsGroupStateError`] for more details.
113    #[error(transparent)]
114    MlsGroupStateError(#[from] MlsGroupStateError),
115    /// See [`MergeCommitError`] for more details.
116    #[error(transparent)]
117    MergeCommitError(#[from] MergeCommitError<StorageError>),
118}
119
120/// Process message error
121#[derive(Error, Debug, PartialEq, Clone)]
122pub enum PublicProcessMessageError {
123    /// See [`LibraryError`] for more details.
124    #[error(transparent)]
125    LibraryError(#[from] LibraryError),
126    /// The message's wire format is incompatible with the group's wire format policy.
127    #[error("The message's wire format is incompatible with the group's wire format policy.")]
128    IncompatibleWireFormat,
129    /// See [`ValidationError`] for more details.
130    #[error(transparent)]
131    ValidationError(#[from] ValidationError),
132    /// See [`StageCommitError`] for more details.
133    #[error(transparent)]
134    InvalidCommit(#[from] StageCommitError),
135    /// External application messages are not permitted.
136    #[error("External application messages are not permitted.")]
137    UnauthorizedExternalApplicationMessage,
138    /// External commit messages are not permitted.
139    #[error("Commit messages from external senders are not permitted.")]
140    UnauthorizedExternalCommitMessage,
141    /// The proposal is invalid for the Sender of type [External](crate::prelude::Sender::External)
142    #[error("The proposal is invalid for the Sender of type External")]
143    UnsupportedProposalType,
144
145    /// The group's GroupContext requires Safe AAD framing, but the message's
146    /// `authenticated_data` did not start with a well-formed `SafeAad`.
147    #[cfg(feature = "extensions-draft-08")]
148    #[error("malformed SafeAAD prefix in authenticated_data")]
149    MalformedSafeAad,
150}
151
152/// Process message error
153#[derive(Error, Debug, PartialEq, Clone)]
154pub enum ProcessMessageError<StorageError> {
155    /// See [`LibraryError`] for more details.
156    #[error(transparent)]
157    LibraryError(#[from] LibraryError),
158    /// Error writing to storage.
159    #[error("Error writing to storage: {0}")]
160    StorageError(StorageError),
161    /// The message's wire format is incompatible with the group's wire format policy.
162    #[error("The message's wire format is incompatible with the group's wire format policy.")]
163    IncompatibleWireFormat,
164    /// See [`ValidationError`] for more details.
165    #[error(transparent)]
166    ValidationError(#[from] ValidationError),
167    /// See [`MlsGroupStateError`] for more details.
168    #[error(transparent)]
169    GroupStateError(#[from] MlsGroupStateError),
170    /// See [`StageCommitError`] for more details.
171    #[error(transparent)]
172    InvalidCommit(#[from] StageCommitError),
173    /// External application messages are not permitted.
174    #[error("External application messages are not permitted.")]
175    UnauthorizedExternalApplicationMessage,
176    /// External commit messages are not permitted.
177    #[error("Commit messages from external senders are not permitted.")]
178    UnauthorizedExternalCommitMessage,
179    /// The proposal is invalid for the Sender of type [External](crate::prelude::Sender::External)
180    #[error("The proposal is invalid for the Sender of type External")]
181    UnsupportedProposalType,
182
183    /// Use `_with_app_data_update` functions for handling AppDataUpdate proposals
184    #[cfg(feature = "extensions-draft-08")]
185    #[error("Use `_with_app_data_update` functions for handling AppDataUpdate proposals")]
186    FoundAppDataUpdateProposal,
187
188    /// The group's GroupContext requires Safe AAD framing, but the message's
189    /// `authenticated_data` did not start with a well-formed `SafeAad`.
190    #[cfg(feature = "extensions-draft-08")]
191    #[error("malformed SafeAAD prefix in authenticated_data")]
192    MalformedSafeAad,
193}
194
195/// Create message error
196#[cfg(not(feature = "virtual-clients-draft"))]
197#[derive(Error, Debug, PartialEq, Clone)]
198pub enum CreateMessageError {
199    /// See [`LibraryError`] for more details.
200    #[error(transparent)]
201    LibraryError(#[from] LibraryError),
202    /// See [`MlsGroupStateError`] for more details.
203    #[error(transparent)]
204    GroupStateError(#[from] MlsGroupStateError),
205}
206
207/// Add members error
208#[derive(Error, Debug, PartialEq, Clone)]
209pub enum AddMembersError<StorageError> {
210    /// See [`LibraryError`] for more details.
211    #[error(transparent)]
212    LibraryError(#[from] LibraryError),
213    /// See [`EmptyInputError`] for more details.
214    #[error(transparent)]
215    EmptyInput(#[from] EmptyInputError),
216    /// See [`CreateCommitError`] for more details.
217    #[error(transparent)]
218    CreateCommitError(#[from] CreateCommitError),
219    /// See [`CommitBuilderStageError`] for more details.
220    #[error(transparent)]
221    CommitBuilderStageError(#[from] CommitBuilderStageError<StorageError>),
222    /// See [`MlsGroupStateError`] for more details.
223    #[error(transparent)]
224    GroupStateError(#[from] MlsGroupStateError),
225    /// Error writing to storage.
226    #[error("Error writing to storage")]
227    StorageError(StorageError),
228}
229
230/// Add members error
231#[derive(Error, Debug, PartialEq, Clone)]
232pub enum SwapMembersError<StorageError> {
233    /// Unable to map the key packages to the given leaf indices.
234    #[error("Number of added and removed members is not the same")]
235    InvalidInput,
236
237    /// See [`EmptyInputError`] for more details.
238    #[error(transparent)]
239    EmptyInput(#[from] EmptyInputError),
240
241    /// See [`MlsGroupStateError`] for more details.
242    #[error(transparent)]
243    GroupStateError(#[from] MlsGroupStateError),
244
245    /// See [`LibraryError`] for more details.
246    #[error(transparent)]
247    LibraryError(#[from] LibraryError),
248
249    /// The member that should be removed can not be found.
250    #[error("The member that should be removed can not be found.")]
251    UnknownMember,
252
253    /// Error writing to storage
254    #[error("Error writing to storage: {0}")]
255    StorageError(StorageError),
256
257    /// See [`CommitBuilderStageError`] for more details.
258    #[error(transparent)]
259    CommitBuilderStageError(#[from] CommitBuilderStageError<StorageError>),
260
261    /// See [`CreateCommitError`] for more details.
262    #[error(transparent)]
263    CreateCommitError(#[from] CreateCommitError),
264}
265
266/// Propose add members error
267#[derive(Error, Debug, PartialEq, Clone)]
268pub enum ProposeAddMemberError<StorageError> {
269    /// See [`LibraryError`] for more details.
270    #[error(transparent)]
271    LibraryError(#[from] LibraryError),
272    /// The new member does not support all required extensions.
273    #[error("The new member does not support all required extensions.")]
274    UnsupportedExtensions,
275    /// See [`MlsGroupStateError`] for more details.
276    #[error(transparent)]
277    GroupStateError(#[from] MlsGroupStateError),
278    /// See [`LeafNodeValidationError`] for more details.
279    #[error(transparent)]
280    LeafNodeValidation(#[from] LeafNodeValidationError),
281    /// Error writing to storage
282    #[error("Error writing to storage: {0}")]
283    StorageError(StorageError),
284}
285
286/// Propose remove members error
287#[derive(Error, Debug, PartialEq, Clone)]
288pub enum ProposeRemoveMemberError<StorageError> {
289    /// See [`LibraryError`] for more details.
290    #[error(transparent)]
291    LibraryError(#[from] LibraryError),
292    /// See [`MlsGroupStateError`] for more details.
293    #[error(transparent)]
294    GroupStateError(#[from] MlsGroupStateError),
295    /// The member that should be removed can not be found.
296    #[error("The member that should be removed can not be found.")]
297    UnknownMember,
298    /// Error writing to storage
299    #[error("Error writing to storage: {0}")]
300    StorageError(StorageError),
301}
302
303/// Remove members error
304#[derive(Error, Debug, PartialEq, Clone)]
305pub enum RemoveMembersError<StorageError> {
306    /// See [`LibraryError`] for more details.
307    #[error(transparent)]
308    LibraryError(#[from] LibraryError),
309    /// See [`EmptyInputError`] for more details.
310    #[error(transparent)]
311    EmptyInput(#[from] EmptyInputError),
312    /// See [`CreateCommitError`] for more details.
313    #[error(transparent)]
314    CreateCommitError(#[from] CreateCommitError),
315    /// See [`CommitBuilderStageError`] for more details.
316    #[error(transparent)]
317    CommitBuilderStageError(#[from] CommitBuilderStageError<StorageError>),
318    /// See [`MlsGroupStateError`] for more details.
319    #[error(transparent)]
320    GroupStateError(#[from] MlsGroupStateError),
321    /// The member that should be removed can not be found.
322    #[error("The member that should be removed can not be found.")]
323    UnknownMember,
324    /// Error writing to storage
325    #[error("Error writing to storage: {0}")]
326    StorageError(StorageError),
327}
328
329/// Leave group error
330#[derive(Error, Debug, PartialEq, Clone)]
331pub enum LeaveGroupError<StorageError> {
332    /// See [`LibraryError`] for more details.
333    #[error(transparent)]
334    LibraryError(#[from] LibraryError),
335    /// See [`MlsGroupStateError`] for more details.
336    #[error(transparent)]
337    GroupStateError(#[from] MlsGroupStateError),
338    /// An error ocurred while writing to storage
339    #[error("An error ocurred while writing to storage")]
340    StorageError(StorageError),
341    /// SelfRemove not allowed with pure ciphertext outgoing wire format policy.
342    #[error("SelfRemove not allowed with pure ciphertext outgoing wire format policy.")]
343    CannotSelfRemoveWithPureCiphertext,
344}
345
346/// Self update error
347#[derive(Error, Debug, PartialEq, Clone)]
348pub enum SelfUpdateError<StorageError> {
349    /// See [`LibraryError`] for more details.
350    #[error(transparent)]
351    LibraryError(#[from] LibraryError),
352    /// See [`CreateCommitError`] for more details.
353    #[error(transparent)]
354    CreateCommitError(#[from] CreateCommitError),
355    /// See [`CommitBuilderStageError`] for more details.
356    #[error(transparent)]
357    CommitBuilderStageError(#[from] CommitBuilderStageError<StorageError>),
358    /// See [`MlsGroupStateError`] for more details.
359    #[error(transparent)]
360    GroupStateError(#[from] MlsGroupStateError),
361    /// Error accessing the storage.
362    #[error("Error accessing the storage.")]
363    StorageError(StorageError),
364}
365
366/// Propose self update error
367#[derive(Error, Debug, PartialEq, Clone)]
368pub enum ProposeSelfUpdateError<StorageError> {
369    /// See [`LibraryError`] for more details.
370    #[error(transparent)]
371    LibraryError(#[from] LibraryError),
372
373    /// See [`MlsGroupStateError`] for more details.
374    #[error(transparent)]
375    GroupStateError(#[from] MlsGroupStateError),
376    /// Error accessing storage.
377    #[error("Error accessing storage.")]
378    StorageError(StorageError),
379    /// See [`PublicTreeError`] for more details.
380    #[error(transparent)]
381    PublicTreeError(#[from] PublicTreeError),
382    /// See [`LeafNodeUpdateError`] for more details.
383    #[error(transparent)]
384    LeafNodeUpdateError(#[from] LeafNodeUpdateError<StorageError>),
385    /// The updated leaf node does not support all group context extensions.
386    #[error("The updated leaf node does not support all group context extensions.")]
387    UnsupportedGroupContextExtensions,
388    /// The `leaf_node_parameters.credential_with_key` does not match
389    /// `new_signer.credential_with_key` (rotation paths only).
390    #[error("Mismatched credential_with_key between leaf_node_parameters and new_signer")]
391    InvalidLeafNodeParameters,
392    /// The `leaf_node_parameters.credential_with_key` does not match
393    /// `new_signer.credential_with_key` (rotation paths only).
394    #[error("Mismatched ciphersuite between new_signer and the group")]
395    InvalidSignerCiphersuite,
396}
397
398/// Commit to pending proposals error
399#[derive(Error, Debug, PartialEq, Clone)]
400pub enum CommitToPendingProposalsError<StorageError> {
401    /// See [`LibraryError`] for more details.
402    #[error(transparent)]
403    LibraryError(#[from] LibraryError),
404    /// See [`CreateCommitError`] for more details.
405    #[error(transparent)]
406    CreateCommitError(#[from] CreateCommitError),
407    /// See [`CommitBuilderStageError`] for more details.
408    #[error(transparent)]
409    CommitBuilderStageError(#[from] CommitBuilderStageError<StorageError>),
410    /// See [`MlsGroupStateError`] for more details.
411    #[error(transparent)]
412    GroupStateError(#[from] MlsGroupStateError),
413    /// Error writing to storage
414    #[error("Error writing to storage: {0}")]
415    StorageError(StorageError),
416}
417
418/// Errors that can happen when exporting a group info object.
419#[derive(Error, Debug, PartialEq, Clone)]
420pub enum ExportGroupInfoError {
421    /// See [`LibraryError`] for more details.
422    #[error(transparent)]
423    LibraryError(#[from] LibraryError),
424    /// See [`MlsGroupStateError`] for more details.
425    #[error(transparent)]
426    GroupStateError(#[from] MlsGroupStateError),
427    /// See [`InvalidExtensionError`] for more details.
428    #[error(transparent)]
429    InvalidExtensionError(#[from] InvalidExtensionError),
430}
431
432/// Export secret error
433#[cfg(feature = "extensions-draft-08")]
434#[derive(Error, Debug, PartialEq, Clone)]
435pub enum SafeExportSecretError<StorageError> {
436    /// See [`MlsGroupStateError`] for more details.
437    #[error(transparent)]
438    GroupState(#[from] MlsGroupStateError),
439    /// See [`ApplicationExportTreeError`] for more details.
440    #[error(transparent)]
441    ApplicationExportTree(#[from] ApplicationExportTreeError),
442    /// Group doesn't support application exports.
443    #[error("Group doesn't support application exports.")]
444    Unsupported,
445    /// Storage error
446    #[error("Error accessing storage: {0}")]
447    Storage(StorageError),
448}
449
450/// Export secret error
451#[cfg(feature = "extensions-draft-08")]
452#[derive(Error, Debug, PartialEq, Clone)]
453pub enum ProcessedMessageSafeExportSecretError {
454    /// See [`StagedSafeExportSecretError`] for more details.
455    #[error(transparent)]
456    SafeExportSecretError(#[from] StagedSafeExportSecretError),
457    /// Processed message is not a commit.
458    #[error("Processed message is not a commit.")]
459    NotACommit,
460}
461
462/// Export secret error
463#[cfg(feature = "extensions-draft-08")]
464#[derive(Error, Debug, PartialEq, Clone)]
465pub enum PendingSafeExportSecretError<StorageError> {
466    /// See [`StagedSafeExportSecretError`] for more details.
467    #[error(transparent)]
468    SafeExportSecretError(#[from] StagedSafeExportSecretError),
469    /// No pending commit.
470    #[error("No pending commit.")]
471    NoPendingCommit,
472    /// Storage error
473    #[error("Error accessing storage: {0}")]
474    Storage(StorageError),
475    /// Only group members can export secrets.
476    #[error("Only group members can export secrets.")]
477    NotGroupMember,
478}
479
480/// Export secret from a pending commit
481#[cfg(feature = "extensions-draft-08")]
482#[derive(Error, Debug, PartialEq, Clone)]
483pub enum StagedSafeExportSecretError {
484    /// Only group members can export secrets.
485    #[error("Only group members can export secrets.")]
486    NotGroupMember,
487    /// See [`ApplicationExportTreeError`] for more details.
488    #[error(transparent)]
489    ApplicationExportTree(#[from] ApplicationExportTreeError),
490    /// Group doesn't support application exports.
491    #[error("Group doesn't support application exports.")]
492    Unsupported,
493}
494
495/// Export secret error
496#[derive(Error, Debug, PartialEq, Clone)]
497pub enum ExportSecretError {
498    /// See [`LibraryError`] for more details.
499    #[error(transparent)]
500    LibraryError(#[from] LibraryError),
501    /// The requested key length is too long.
502    #[error("The requested key length is too long.")]
503    KeyLengthTooLong,
504    /// See [`MlsGroupStateError`] for more details.
505    #[error(transparent)]
506    GroupStateError(#[from] MlsGroupStateError),
507}
508
509/// Propose PSK error
510#[derive(Error, Debug, PartialEq, Clone)]
511pub enum ProposePskError {
512    /// See [`PskError`] for more details.
513    #[error(transparent)]
514    Psk(#[from] PskError),
515    /// See [`MlsGroupStateError`] for more details.
516    #[error(transparent)]
517    GroupStateError(#[from] MlsGroupStateError),
518    /// See [`LibraryError`] for more details.
519    #[error(transparent)]
520    LibraryError(#[from] LibraryError),
521}
522
523/// Proposal error
524#[derive(Error, Debug, PartialEq, Clone)]
525pub enum ProposalError<StorageError> {
526    /// See [`LibraryError`] for more details.
527    #[error(transparent)]
528    LibraryError(#[from] LibraryError),
529    /// See [`ProposeAddMemberError`] for more details.
530    #[error(transparent)]
531    ProposeAddMemberError(#[from] ProposeAddMemberError<StorageError>),
532    /// See [`CreateAddProposalError`] for more details.
533    #[error(transparent)]
534    CreateAddProposalError(#[from] CreateAddProposalError),
535    /// See [`ProposeSelfUpdateError`] for more details.
536    #[error(transparent)]
537    ProposeSelfUpdateError(#[from] ProposeSelfUpdateError<StorageError>),
538    /// See [`ProposeRemoveMemberError`] for more details.
539    #[error(transparent)]
540    ProposeRemoveMemberError(#[from] ProposeRemoveMemberError<StorageError>),
541    /// See [`MlsGroupStateError`] for more details.
542    #[error(transparent)]
543    GroupStateError(#[from] MlsGroupStateError),
544    /// See [`ValidationError`] for more details.
545    #[error(transparent)]
546    ValidationError(#[from] ValidationError),
547    /// See [`CreateGroupContextExtProposalError`] for more details.
548    #[error(transparent)]
549    CreateGroupContextExtProposalError(#[from] CreateGroupContextExtProposalError<StorageError>),
550    /// See [`InvalidExtensionError`]
551    #[error(transparent)]
552    InvalidExtension(#[from] InvalidExtensionError),
553    /// Error writing proposal to storage.
554    #[error("error writing proposal to storage")]
555    StorageError(StorageError),
556}
557
558/// Remove proposal error
559#[derive(Error, Debug, PartialEq, Clone)]
560pub enum RemoveProposalError<StorageError> {
561    /// Couldn't find the proposal for the given `ProposalRef`.
562    #[error("Couldn't find the proposal for the given `ProposalRef`")]
563    ProposalNotFound,
564    /// Error erasing proposal from storage.
565    #[error("error writing proposal to storage")]
566    Storage(StorageError),
567}
568
569#[cfg(feature = "virtual-clients-draft")]
570pub use virtual_clients_draft::*;
571
572#[cfg(feature = "virtual-clients-draft")]
573mod virtual_clients_draft {
574    use thiserror::Error;
575
576    use super::MlsGroupStateError;
577    use crate::error::LibraryError;
578    use crate::framing::MessageEncryptionError;
579    use crate::tree::secret_tree::SecretTreeError;
580
581    /// Create message error
582    #[derive(Error, Debug, PartialEq, Clone)]
583    pub enum CreateMessageError<StorageError> {
584        /// See [`LibraryError`] for more details.
585        #[error(transparent)]
586        LibraryError(#[from] LibraryError),
587        /// See [`MlsGroupStateError`] for more details.
588        #[error(transparent)]
589        GroupStateError(#[from] MlsGroupStateError),
590        /// See [`MessageEncryptionError`] for more details.
591        #[error(transparent)]
592        MessageEncryptionError(#[from] MessageEncryptionError<StorageError>),
593        /// Error writing to storage.
594        #[error("Error writing to storage: {0}")]
595        StorageError(StorageError),
596    }
597
598    /// Confirm message error
599    #[derive(Error, Debug, PartialEq, Clone)]
600    pub enum ConfirmMessageError<StorageError> {
601        /// See [`SecretTreeError`] for more details.
602        #[error(transparent)]
603        SecretTreeError(#[from] SecretTreeError),
604        /// Error writing to storage.
605        #[error("Error writing to storage: {0}")]
606        StorageError(StorageError),
607    }
608
609    impl<StorageError> From<ConfirmMessageError<StorageError>> for CreateMessageError<StorageError> {
610        fn from(err: ConfirmMessageError<StorageError>) -> Self {
611            match err {
612                ConfirmMessageError::SecretTreeError(e) => {
613                    CreateMessageError::MessageEncryptionError(
614                        MessageEncryptionError::SecretTreeError(e),
615                    )
616                }
617                ConfirmMessageError::StorageError(e) => CreateMessageError::StorageError(e),
618            }
619        }
620    }
621}