1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use thiserror::Error;
/// An error that may occur during attenuable JWT signing.
#[derive(Debug, Error)]
pub enum Error {
/// An error related to creating a JWT.
#[error("jwt error")]
JWTError(Option<Box<dyn std::error::Error>>),
/// An error creating or converting a public or private key.
#[error("key error")]
KeyError(Option<Box<dyn std::error::Error>>),
/// An error arising from cryptographic operations.
#[error("crypto error")]
CryptoError,
/// An error indicating invalid serialization.
#[error("serialization error")]
SerializationError(Box<dyn std::error::Error>),
}
/// Result type for signing operations.
pub type Result<R> = std::result::Result<R, Error>;