openmls/credentials/
errors.rs

1//! Credential errors
2//!
3//! This module exposes [`CredentialError`].
4
5use crate::error::LibraryError;
6use thiserror::Error;
7
8/// An error that occurs in methods of a [`super::Credential`].
9#[derive(Error, Debug, PartialEq, Clone)]
10pub enum CredentialError {
11    /// A library error occured.
12    #[error(transparent)]
13    LibraryError(#[from] LibraryError),
14    /// The type of credential is not supported.
15    #[error("Unsupported credential type.")]
16    UnsupportedCredentialType,
17    /// Verifying the signature with this credential failed.
18    #[error("Invalid signature.")]
19    InvalidSignature,
20}
21
22/// An error that occurs in methods of a [`super::Credential`].
23#[derive(Error, Debug, PartialEq, Clone)]
24pub enum BasicCredentialError {
25    /// TLS codec error
26    #[error(transparent)]
27    TlsCodecError(#[from] tls_codec::Error),
28    /// Wrong credential type
29    #[error("Wrong credential type.")]
30    WrongCredentialType,
31}