Files
voprf-vx/src/error.rs
T

43 lines
1.5 KiB
Rust
Raw Normal View History

2021-09-09 01:56:54 -07:00
// Copyright (c) Facebook, Inc. and its affiliates.
//
2021-09-27 18:53:06 -07:00
// This source code is licensed under both the MIT license found in the
// LICENSE-MIT file in the root directory of this source tree and the Apache
// License, Version 2.0 found in the LICENSE-APACHE file in the root directory
// of this source tree.
2021-09-09 01:56:54 -07:00
2021-12-25 22:54:27 +01:00
//! Errors which are produced during an execution of the protocol
2021-09-09 01:56:54 -07:00
use displaydoc::Display;
2021-12-25 22:54:27 +01:00
/// [`Result`](core::result::Result) shorthand that uses [`Error`].
pub type Result<T> = core::result::Result<T, Error>;
2021-09-09 01:56:54 -07:00
/// Represents an error in the manipulation of internal cryptographic data
2021-12-21 20:17:02 +01:00
#[derive(Clone, Copy, Debug, Display, Eq, Hash, Ord, PartialEq, PartialOrd)]
2021-12-25 22:54:27 +01:00
pub enum Error {
2021-09-09 01:56:54 -07:00
/// Could not parse byte sequence for key
InvalidByteSequence,
2021-09-27 18:29:08 -07:00
/// Could not deserialize element, or deserialized to the identity element
2021-09-09 01:56:54 -07:00
PointError,
/// Computing the hash-to-curve function failed
HashToCurveError,
/// Failure to serialize or deserialize bytes
SerializationError,
/// Use of incompatible modes (base vs. verifiable)
IncompatibleModeError,
/**
* Internal error thrown when different-lengthed slices are supplied
* to the compute_composites() function.
*/
MismatchedLengthsForCompositeInputs,
/// In verifiable mode, occurs when the proof failed to verify
ProofVerificationError,
/// Encountered insufficient bytes when attempting to deserialize
SizeError,
2022-01-18 12:34:28 +01:00
/// Encountered an invalid scalar
ScalarError,
2021-09-09 01:56:54 -07:00
}
#[cfg(feature = "std")]
2021-12-25 22:54:27 +01:00
impl std::error::Error for Error {}