Using voprf as a dependency (#248)
* Using voprf as a dependency * Adding back x25519 and KeGroup * Addressing comments
This commit is contained in:
@@ -45,6 +45,10 @@ pub enum InternalError<T = Infallible> {
|
||||
IncompatibleEnvelopeModeError,
|
||||
/// This error occurs when the inner envelope is malformed
|
||||
InvalidInnerEnvelopeError,
|
||||
/// Error from the OPRF evaluation
|
||||
OprfError(voprf::errors::InternalError),
|
||||
/// Error encountered when attempting to produce a keypair
|
||||
InvalidKeypairError,
|
||||
}
|
||||
|
||||
impl<T: Debug> Debug for InternalError<T> {
|
||||
@@ -72,6 +76,8 @@ impl<T: Debug> Debug for InternalError<T> {
|
||||
f.debug_tuple("IncompatibleEnvelopeModeError").finish()
|
||||
}
|
||||
Self::InvalidInnerEnvelopeError => f.debug_tuple("InvalidInnerEnvelopeError").finish(),
|
||||
Self::OprfError(error) => f.debug_tuple("OprfError").field(error).finish(),
|
||||
Self::InvalidKeypairError => f.debug_tuple("InvalidKeypairError").finish(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,10 +108,24 @@ impl InternalError {
|
||||
Self::SealOpenHmacError => InternalError::SealOpenHmacError,
|
||||
Self::IncompatibleEnvelopeModeError => InternalError::IncompatibleEnvelopeModeError,
|
||||
Self::InvalidInnerEnvelopeError => InternalError::InvalidInnerEnvelopeError,
|
||||
Self::OprfError(error) => InternalError::OprfError(error),
|
||||
Self::InvalidKeypairError => InternalError::InvalidKeypairError,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<voprf::errors::InternalError> for InternalError {
|
||||
fn from(voprf_error: voprf::errors::InternalError) -> Self {
|
||||
Self::OprfError(voprf_error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<voprf::errors::InternalError> for ProtocolError {
|
||||
fn from(voprf_error: voprf::errors::InternalError) -> Self {
|
||||
Self::LibraryError(InternalError::OprfError(voprf_error))
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents an error in protocol handling
|
||||
#[derive(Clone, Display, Eq, Hash, PartialEq)]
|
||||
pub enum ProtocolError<T = Infallible> {
|
||||
|
||||
Reference in New Issue
Block a user