openmls/key_packages/
errors.rs1use thiserror::Error;
6
7use crate::{
8 ciphersuite::signable::SignatureError, error::LibraryError,
9 prelude::ExtensionTypeNotValidInKeyPackageError,
10};
11
12#[derive(Error, Debug, PartialEq, Clone)]
14pub enum KeyPackageVerifyError {
15 #[error(transparent)]
17 LibraryError(#[from] LibraryError),
18 #[error("The lifetime of the leaf node is not valid.")]
20 InvalidLifetime,
21 #[error("The lifetime of the leaf node is missing.")]
23 MissingLifetime,
24 #[error("A key package extension is not supported in the leaf's capabilities.")]
26 UnsupportedExtension,
27 #[error("The key package signature is not valid.")]
29 InvalidSignature,
30 #[error("The leaf node signature is not valid.")]
32 InvalidLeafNodeSignature,
33 #[error("Invalid LeafNode source type")]
35 InvalidLeafNodeSourceType,
36 #[error("The init key and the encryption key are equal.")]
38 InitKeyEqualsEncryptionKey,
39 #[error("The protocol version is not valid.")]
41 InvalidProtocolVersion,
42 #[error(transparent)]
44 ExtensionTypeNotValidInKeyPackage(#[from] ExtensionTypeNotValidInKeyPackageError),
45}
46
47#[derive(Error, Debug, PartialEq, Eq, Clone)]
49pub enum KeyPackageExtensionSupportError {
50 #[error("The key package does not support all required extensions.")]
52 UnsupportedExtension,
53}
54
55#[derive(Error, Debug, PartialEq, Clone)]
57pub enum KeyPackageNewError {
58 #[error(transparent)]
60 LibraryError(#[from] LibraryError),
61 #[error("The ciphersuite does not match the signature scheme.")]
63 CiphersuiteSignatureSchemeMismatch,
64 #[error("Accessing storage failed.")]
66 StorageError,
67 #[error(transparent)]
69 SignatureError(#[from] SignatureError),
70}