herolib_crypt/httpsig/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum HttpSigError {
6 #[error("Missing required header: {0}")]
8 MissingHeader(String),
9
10 #[error("Invalid signature format: {0}")]
12 InvalidSignature(String),
13
14 #[error("Signature verification failed")]
16 VerificationFailed,
17
18 #[error("Content-Digest mismatch")]
20 DigestMismatch,
21
22 #[error("Timestamp out of tolerance: created={created}, now={now}, tolerance={tolerance}s")]
24 TimestampOutOfBounds {
25 created: u64,
26 now: u64,
27 tolerance: u64,
28 },
29
30 #[error("Key not found: {0}")]
32 KeyNotFound(String),
33
34 #[error("Unsupported algorithm: {0}")]
36 UnsupportedAlgorithm(String),
37
38 #[error("Parse error: {0}")]
40 ParseError(String),
41
42 #[error("Missing authority in URI")]
44 MissingAuthority,
45
46 #[error("Invalid header value: {0}")]
48 InvalidHeader(String),
49
50 #[error("Missing required component: {0}")]
52 MissingComponent(String),
53
54 #[error("Invalid base64: {0}")]
56 InvalidBase64(#[from] base64::DecodeError),
57
58 #[error("Invalid hex: {0}")]
60 InvalidHex(#[from] hex::FromHexError),
61
62 #[error("Key error: {0}")]
64 KeyError(#[from] crate::keys::KeyError),
65
66 #[error("No key configured for verification")]
68 NoKeyConfigured,
69
70 #[error("Invalid signature label: {0}")]
72 InvalidLabel(String),
73}