atrium_crypto/
error.rs

1use thiserror::Error;
2
3/// Error types.
4#[derive(Error, Debug)]
5pub enum Error {
6    /// Unsupported multikey type.
7    #[error("Unsupported key type")]
8    UnsupportedMultikeyType,
9    /// Incorrect prefix for DID key.
10    #[error("Incorrect prefix for did:key: {0}")]
11    IncorrectDIDKeyPrefix(String),
12    /// Low-S signature is not allowed.
13    #[error("Low-S signature is not allowed")]
14    LowSSignatureNotAllowed,
15    /// Signature is invalid.
16    #[error("Signature is invalid")]
17    InvalidSignature,
18    /// Error in [`multibase`] encoding or decoding.
19    #[error(transparent)]
20    Multibase(#[from] multibase::Error),
21    /// Error in [`ecdsa::signature`].
22    #[error(transparent)]
23    Signature(#[from] ecdsa::signature::Error),
24}
25
26/// Type alias to use this library's [`Error`](crate::Error) type in a [`Result`](core::result::Result).
27pub type Result<T> = std::result::Result<T, Error>;