1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum CapError {
8 #[error("encoding error: {0}")]
10 Encoding(String),
11
12 #[error("invalid signature")]
14 InvalidSignature,
15
16 #[error("token expired")]
18 Expired,
19
20 #[error("scope attenuation violation: {0}")]
22 AttenuationViolation(String),
23
24 #[error("delegation chain too deep: {depth} exceeds max {max}")]
26 ChainTooDeep { depth: usize, max: usize },
27
28 #[error("untrusted issuer: {0}")]
30 UntrustedIssuer(String),
31
32 #[error("invalid proof chain: {0}")]
34 InvalidProof(String),
35
36 #[error("key error: {0}")]
38 KeyError(String),
39}
40
41pub type Result<T> = std::result::Result<T, CapError>;