1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
use ockam_core::Error; /// Types of errors that may occur constructing a secure channel. pub enum SecureChannelError { /// No error. None, /// The key exchange process failed. KeyExchange, /// Internal state is invalid. InvalidInternalState, /// Expected nonce was invalid. InvalidNonce, /// Key exchange process did not complete. KeyExchangeNotComplete, /// Invalid response received from the Hub. InvalidHubResponse, } impl SecureChannelError { /// Integer code associated with the error domain. pub const DOMAIN_CODE: u32 = 16_000; /// Error domain pub const DOMAIN_NAME: &'static str = "OCKAM_SECURE_CHANNEL"; } impl Into<Error> for SecureChannelError { fn into(self) -> Error { Error::new(Self::DOMAIN_CODE + (self as u32), Self::DOMAIN_NAME) } }