1
#![allow(clippy::module_name_repetitions)]
2

            
3
//! See [`Error`](enum@Error). Also re-exports [`InternalError`] and
4
//! [`ProtocolError`].
5

            
6
pub use opaque_ke::errors::{InternalError, ProtocolError};
7
use thiserror::Error;
8

            
9
/// [`Result`](std::result::Result) for this crate.
10
pub type Result<T, E = Error> = std::result::Result<T, E>;
11

            
12
/// [`Error`](std::error::Error) type for this crate.
13
23
#[derive(Clone, Debug, Error, Eq, Hash, PartialEq)]
14
pub enum Error {
15
	/// Internal OPAQUE error.
16
	#[error("Internal Opaque error: {0}")]
17
	Opaque(#[from] ProtocolError),
18
	/// Servers public key didn't match expected one.
19
	#[error("Servers identity unexpected")]
20
	InvalidServer,
21
	/// Failed to construct [`Mhf`](crate::Mhf) because out-of-range integers.
22
	#[error("Integers used are out-of-range")]
23
	MhfConfig,
24
	/// [`Config`](crate::Config) doesn't match.
25
	#[error("Configuration doesn't match")]
26
	Config,
27
	/// [`PublicKey`](crate::PublicKey) in [`ClientConfig`](crate::ClientConfig)
28
	/// and [`ClientFile`](crate::ClientFile) don't match.
29
	#[error("Public keys don't match")]
30
	ConfigPublicKey,
31
	/// Credentials don't match.
32
	#[error("Credentials don't match")]
33
	Credentials,
34
	/// [`ServerFile`](crate::ServerFile) was not created with the same
35
	/// [`ServerConfig`](crate::ServerConfig).
36
	#[error("Server file was not created with the same server configuration")]
37
	ServerFile,
38
}