use thiserror::Error;
#[derive(Debug, Error)]
pub enum CapError {
#[error("encoding error: {0}")]
Encoding(String),
#[error("invalid signature")]
InvalidSignature,
#[error("token expired")]
Expired,
#[error("scope attenuation violation: {0}")]
AttenuationViolation(String),
#[error("delegation chain too deep: {depth} exceeds max {max}")]
ChainTooDeep { depth: usize, max: usize },
#[error("untrusted issuer: {0}")]
UntrustedIssuer(String),
#[error("invalid proof chain: {0}")]
InvalidProof(String),
#[error("key error: {0}")]
KeyError(String),
}
pub type Result<T> = std::result::Result<T, CapError>;