wire_e2e_identity/
error.rs

1// We allow missing documentation in the error module because the types are generally
2// self-descriptive.
3#![allow(missing_docs)]
4
5pub type E2eIdentityResult<T> = Result<T, E2eIdentityError>;
6
7/// All e2e identity related errors
8#[derive(Debug, thiserror::Error)]
9pub enum E2eIdentityError {
10    /// Invalid/incomplete certificate
11    #[error("Given x509 certificate is invalid and does not follow Wire's format")]
12    InvalidCertificate,
13    /// Json error
14    #[error(transparent)]
15    JsonError(#[from] serde_json::Error),
16    /// Acme error
17    #[error(transparent)]
18    AcmeError(#[from] crate::acme::RustyAcmeError),
19    /// Error creating the client Dpop token
20    #[error(transparent)]
21    JwtError(#[from] rusty_jwt_tools::prelude::RustyJwtError),
22    /// Core JWT error
23    #[error(transparent)]
24    JwtSimpleError(#[from] jwt_simple::Error),
25    /// Not supported
26    #[error("Not supported")]
27    NotSupported,
28    #[error("Incorrect usage of this API")]
29    ImplementationError,
30    #[error("Not yet supported")]
31    NotYetSupported,
32    #[error("Enrollment methods are called out of order: {0}")]
33    OutOfOrderEnrollment(&'static str),
34    #[error("Invalid OIDC RefreshToken supplied")]
35    InvalidRefreshToken,
36    #[error("The encountered ClientId does not match Wire's definition")]
37    InvalidClientId,
38    #[error("This function accepts a list of IDs as a parameter, but that list was empty")]
39    EmptyInputIdList,
40    #[error("No enrollment was found")]
41    NotFound,
42    #[error(transparent)]
43    CryptoError(#[from] openmls_traits::types::CryptoError),
44    #[error(transparent)]
45    X509Error(#[from] crate::x509_check::RustyX509CheckError),
46    #[error(transparent)]
47    UrlError(#[from] url::ParseError),
48    #[error(transparent)]
49    X509CertDerError(#[from] x509_cert::der::Error),
50    #[error("An error occured while generating an X509 certificate")]
51    CertificateGenerationError,
52    #[error("Unsupported signature scheme")]
53    UnsupportedSignatureScheme,
54    #[error("Signature key generation failed")]
55    SignatureKeyGenerationFailed,
56    #[error("Signing failed")]
57    SigningFailed(#[from] signature::Error),
58    #[error("{context}: {upstream}")]
59    CertificateValidation {
60        context: &'static str,
61        // We the programmer know that this error type comes from the `certval` crate,
62        // but that is not in scope at this point and doesn't implement `std::error::Error`,
63        // so ¯\_(ツ)_/¯
64        upstream: String,
65    },
66    #[error(transparent)]
67    Keystore(#[from] core_crypto_keystore::CryptoKeystoreError),
68}