use cryptimitives::errors::{AeadError, KdfError, KeyPairError, SignatureError};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum XxxDhError {
#[error("there are no one-time prekeys available")]
EmptyPrekeyList,
#[error("unknown prekey")]
UnknownPrekey,
#[error("{0:?}")]
KdfError(KdfError),
#[error("{0:?}")]
KeypairError(KeyPairError),
#[error("{0:?}")]
AeadError(AeadError),
#[error("{0:?}")]
SignatureError(SignatureError),
#[error(transparent)]
StorageError(#[from] StorageError),
}
#[allow(dead_code)]
#[derive(Debug, Error)]
pub enum StorageError {
#[error("unknown error")]
UnknownError,
}
impl From<KdfError> for XxxDhError {
fn from(e: KdfError) -> Self {
Self::KdfError(e)
}
}
impl From<AeadError> for XxxDhError {
fn from(e: AeadError) -> Self {
Self::AeadError(e)
}
}
impl From<SignatureError> for XxxDhError {
fn from(e: SignatureError) -> Self {
Self::SignatureError(e)
}
}
pub type XxxDhResult<T> = Result<T, XxxDhError>;
pub type StorageResult<T> = Result<T, StorageError>;