use crate::utils::Base;
pub type Result<T, E = Error> = ::core::result::Result<T, E>;
#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
pub enum Error {
#[error("Crypto Error: {0}")]
Crypto(crypto::Error),
#[error("Failed to encode JSON: {0}")]
EncodeJSON(serde_json::Error),
#[error("Failed to decode JSON: {0}")]
DecodeJSON(serde_json::Error),
#[error("Failed to decode {0:?} data")]
DecodeBase(Base, #[source] multibase::Error),
#[error("Failed to decode multibase data: {0}")]
DecodeMultibase(#[from] multibase::Error),
#[deprecated(since = "0.5.0", note = "diff chain features are slated for removal")]
#[error("Invalid Document Diff: {0}")]
InvalidDiff(#[from] identity_diff::Error),
#[error("Invalid Url: {0}")]
InvalidUrl(#[from] url::ParseError),
#[error("Invalid Timestamp: {0}")]
InvalidTimestamp(#[from] time::error::Error),
#[error("OneOrSet cannot be empty")]
OneOrSetEmpty,
#[error("duplicate key in OrderedSet")]
OrderedSetDuplicate,
#[error("Invalid ProofPurpose")]
InvalidProofPurpose,
#[error("Invalid Proof Value: {0}")]
InvalidProofValue(&'static str),
#[error("Invalid Key Format")]
InvalidKeyFormat,
#[error("Invalid Key Length. Received {0}, Expected {1}")]
InvalidKeyLength(usize, usize),
#[error("Invalid Signature Length. Received {0}, Expected {1}")]
InvalidSigLength(usize, usize),
#[error("Signature Not Found")]
MissingSignature,
}
impl From<crypto::Error> for Error {
fn from(other: crypto::Error) -> Self {
Self::Crypto(other)
}
}