hohibe/
error.rs

1//! Error definitions for HIBE operations.
2use thiserror::Error;
3
4/// Type for all errors that can occur when working with the HIBE implementations of this crate.
5#[derive(Debug, Error)]
6pub enum Error {
7    /// Error returned when the identity that was supplied exceeded the given maximum hierarchy
8    /// depth.
9    ///
10    /// Can also be returned when trying to derive a key that would exceed the maximum identity
11    /// depth.
12    #[error("The supplied identity was too long")]
13    IdentityTooLong,
14
15    /// Error returned when trying to derive the root identity, as there is no parent key for the
16    /// root.
17    #[error("Cannot derive the root identity")]
18    DerivingRoot,
19
20    /// Error when the given ciphertext was malformed.
21    ///
22    /// Note that this crate does not verify the integrity of ciphertexts. The absence of a
23    /// malformation therefore does *not* mean that the ciphertext has not been tampered with!
24    #[error("The supplied ciphertext was malforemd")]
25    MalformedCiphertext,
26}
27
28/// Shortcut for [`std::result::Result`] with [`enum@Error`] as the default error.
29pub type Result<V, E=Error> = std::result::Result<V, E>;