wire_e2e_identity/acquisition/
error.rs1use openmls_traits::types::Ciphersuite;
2use rusty_jwt_tools::prelude::RustyJwtError;
3
4use crate::pki_env::hooks::PkiEnvironmentHooksError;
5
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error("certificate acquisition is not supported for {0:?}")]
9 UnsupportedCipherSuite(Ciphersuite),
10 #[error("a PKI environment hook failed")]
11 HookFailed(#[from] PkiEnvironmentHooksError),
12 #[error("JSON parsing failed")]
13 Json(#[from] serde_json::Error),
14 #[error("HTTP response is missing header '{0}'")]
15 MissingHeader(&'static str),
16 #[error(transparent)]
17 Acme(#[from] crate::acme::Error),
18 #[error(transparent)]
19 RustyJwtError(#[from] RustyJwtError),
20 #[error(transparent)]
22 InvalidCertificate(#[from] CertificateError),
23}
24
25#[derive(Debug, thiserror::Error)]
27pub enum CertificateError {
28 #[error("Client ID is not in a valid format")]
30 InvalidClientId,
31 #[error("ClientId does not match expected one")]
33 ClientIdMismatch,
34 #[error("Display name does not match expected one")]
36 DisplayNameMismatch,
37 #[error("Handle does not match expected one")]
39 HandleMismatch,
40 #[error("Domain does not match expected one")]
42 DomainMismatch,
43 #[error("DisplayName is missing from the certificate")]
45 MissingDisplayName,
46 #[error("Handle is missing from the certificate")]
48 MissingHandle,
49 #[error("Domain is missing from the certificate")]
51 MissingDomain,
52 #[error("ClientId is missing from the certificate")]
54 MissingClientId,
55 #[error("X509 lacks required standard fields")]
57 InvalidFormat,
58 #[error("Certificate algorithm does not match the one of the signing keypair")]
60 AlgorithmMismatch,
61 #[error("Certificate public key does not match the one in the signing keypair")]
63 KeyMismatch,
64 #[error("The signing keypair could not be parsed for the expected signature algorithm")]
66 InvalidSigningKeypair,
67 #[error("Advertised public key is not supported")]
69 UnsupportedPublicKey,
70 #[error(transparent)]
72 Validation(#[from] crate::validation::Error),
73 #[error(transparent)]
75 Der(#[from] spki::der::Error),
76 #[error(transparent)]
78 Utf8(#[from] std::str::Utf8Error),
79 #[error(transparent)]
81 Acme(#[from] crate::acme::Error),
82 #[error(transparent)]
84 RustyJwtError(#[from] RustyJwtError),
85 #[error(transparent)]
87 JwtSimple(#[from] jwt_simple::Error),
88}