use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum CryptoError {
#[error("invalid SRP parameter: {0}")]
SrpBadParameters(&'static str),
#[error("SRP proof verification failed (aborting the exchange)")]
SrpProofMismatch,
#[error("crypto value encoding error: {0}")]
Encoding(&'static str),
#[error("malformed TLV8 in pairing message: {0}")]
Tlv(#[from] hap_tlv8::Tlv8Error),
#[error("HKDF-SHA512 key derivation failed: {0}")]
Kdf(&'static str),
#[error("ChaCha20-Poly1305 AEAD operation failed (authentication or usage error)")]
Aead,
#[error("Ed25519 signature verification failed")]
Signature,
}
pub type Result<T> = core::result::Result<T, CryptoError>;