use std::string::FromUtf8Error;
use http::header::{ToStrError, InvalidHeaderValue};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Missing a field in the `Signature:` header")]
MissingField(&'static str),
#[error("`Signature:` header is missing")]
SignatureHeaderMissing,
#[error("Cannot use invalid bytes as HTTP header value")]
HeaderValue(ToStrError),
#[error("Cannot serialize HTTP header")]
SerializeHeader(InvalidHeaderValue),
#[error("Signature algorithm not implemented")]
UnknownAlgorithm(String),
#[error("Error parsing the `Signature:` header")]
ParseSignatureHeader(nom::Err<nom::error::Error<String>>),
#[error("Cannot decode base64")]
SignatureBase64(base64::DecodeError),
#[error("Cryptographic issue")]
OpenSsl(#[from] openssl::error::ErrorStack),
#[error("Invalid UTF-8")]
Utf8(#[from] FromUtf8Error),
}