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