1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum DpopError {
5 #[error("Multiple DPoP headers")]
6 MultipleDpopHeaders,
7 #[error("Invalid DPoP header")]
8 InvalidDpopHeader,
9 #[error("Missing DPoP header")]
10 MissingDpopHeader,
11 #[error("malformed DPoP JWT")]
12 MalformedJws,
13 #[error("Invalid algorithm")]
14 InvalidAlg(String),
15 #[error("unsupported DPoP alg")]
16 UnsupportedAlg(String),
17 #[error("invalid DPoP signature")]
18 InvalidSignature,
19 #[error("bad JWK: {0}")]
20 BadJwk(&'static str),
21 #[error("missing claim: {0}")]
22 MissingClaim(&'static str),
23 #[error("Invalid method")]
24 InvalidMethod,
25 #[error("htm mismatch")]
26 HtmMismatch,
27 #[error("malformed htu")]
28 MalformedHtu,
29 #[error("htu mismatch")]
30 HtuMismatch,
31 #[error("Malformed ath")]
32 AthMalformed,
33 #[error("missing ath")]
34 MissingAth,
35 #[error("ath mismatch")]
36 AthMismatch,
37 #[error("iat too far in future")]
38 FutureSkew,
39 #[error("DPoP proof too old")]
40 Stale,
41 #[error("DPoP replay detected")]
42 Replay,
43 #[error("storage error: {0}")]
44 Store(Box<dyn std::error::Error + Send + Sync>),
45 #[error("Jti too long")]
46 JtiTooLong,
47 #[error("Use Dpop nonce")]
48 UseDpopNonce { nonce: String },
49 #[error("Missing Nonce")]
50 MissingNonce,
51 #[error("Nonce mismatch")]
52 NonceMismatch,
53 #[error("Nonce is stale")]
54 NonceStale,
55 #[error("Invalid HMAC configuration")]
56 InvalidHmacConfig,
57}