Skip to main content

tecdsa_core/
error.rs

1//! Crate-wide error type.
2use thiserror::Error;
3
4#[derive(Debug, Error, Clone, Copy, PartialEq, Eq)]
5pub enum Error {
6    #[error("value out of range")]
7    OutOfRange,
8    #[error("element is not invertible")]
9    NotInvertible,
10    #[error("invalid encoding")]
11    InvalidEncoding,
12    #[error("invalid modulus")]
13    InvalidModulus,
14    #[error("verification failed")]
15    VerificationFailed,
16    #[error("parameter sampling failed")]
17    Sampling,
18    #[error("session timed out")]
19    Timeout,
20    #[error("secret not found")]
21    NotFound,
22    #[error("secret store failure")]
23    Storage,
24}
25
26impl From<crate::rsa::tough::ToughError> for Error {
27    fn from(_: crate::rsa::tough::ToughError) -> Self {
28        Self::Sampling
29    }
30}
31
32pub type Result<T> = core::result::Result<T, Error>;