use displaydoc::Display;
use thiserror_no_std::Error;
#[derive(Debug, Error, Display)]
pub enum HandshakeError {
MissingMaterial,
InvalidState,
BufferTooSmall,
InvalidMessage,
ErrorState,
PskMissing,
Kem(#[from] KemError),
Dh(#[from] DhError),
Cipher(#[from] CipherError),
Transport(#[from] TransportError),
}
pub type HandshakeResult<T> = Result<T, HandshakeError>;
#[derive(Debug, Error, Display)]
pub enum TransportError {
BufferTooSmall,
TooShort,
Cipher(#[from] CipherError),
}
pub type TransportResult<T> = Result<T, TransportError>;
#[derive(Debug, Error, Display)]
pub enum KemError {
Input,
Decapsulation,
Encapsulation,
KeyGeneration,
}
pub type KemResult<T> = Result<T, KemError>;
#[derive(Debug, Error, Display)]
pub enum DhError {
KeyGeneration,
}
pub type DhResult<T> = Result<T, DhError>;
#[derive(Debug, Error, Display)]
pub enum CipherError {
NonceOverflow,
Decrypt,
}
pub type CipherResult<T> = Result<T, CipherError>;