pub(crate) use super::{DecodeErrorKind, DecodeErrorOrigin};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum AuthErrorKind {
NoCredentials,
NoAuthKey,
HmacMismatch,
AuthParamsNotFound,
}
impl std::fmt::Display for AuthErrorKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::NoCredentials => write!(f, "no credentials configured"),
Self::NoAuthKey => write!(f, "no authentication key available"),
Self::HmacMismatch => write!(f, "HMAC verification failed"),
Self::AuthParamsNotFound => write!(f, "could not locate auth params in message"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum CryptoErrorKind {
NoPrivKey,
}
impl std::fmt::Display for CryptoErrorKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::NoPrivKey => write!(f, "no privacy key available"),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum EncodeErrorKind {
MissingAuthParams,
}
impl std::fmt::Display for EncodeErrorKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::MissingAuthParams => {
write!(f, "could not find auth params position in encoded message")
}
}
}
}