1use 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 #[error("a secret already exists under this name")]
25 AlreadyExists,
26}
27
28impl From<crate::rsa::tough::ToughError> for Error {
29 fn from(_: crate::rsa::tough::ToughError) -> Self {
30 Self::Sampling
31 }
32}
33
34pub type Result<T> = core::result::Result<T, Error>;