use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("transport error: {0}")]
Transport(String),
#[error("transport connect failed: {0}")]
Connect(String),
#[error("transport bind failed: {0}")]
Bind(String),
#[error("stream open failed: {0}")]
StreamOpen(String),
#[error("connection closed: {0}")]
ConnectionClosed(String),
#[error("message validation failed: {0}")]
Validation(#[from] did_ma::MaError),
#[error("message signature verification failed")]
SignatureVerification,
#[error("replay detected for message {0}")]
Replay(String),
#[error("DID resolution failed for {did}: {detail}")]
Resolution { did: String, detail: String },
#[error("no inbox transport in DID document for {0}")]
NoInboxTransport(String),
#[error("invalid transport string: {0}")]
InvalidTransport(String),
#[error("secret key error: {0}")]
SecretKey(String),
#[error("endpoint ID derivation failed: {0}")]
EndpointId(String),
#[error("duplicate service ALPN: {0}")]
DuplicateService(String),
#[error(transparent)]
Other(#[from] anyhow::Error),
}
pub type Result<T> = std::result::Result<T, Error>;