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
|
|
|
|
|
|
|
|
//! A list of error types which are produced during an execution of the protocol
|
|
|
|
|
#[cfg(feature = "std")]
|
|
|
|
|
use std::error::Error;
|
|
|
|
|
|
|
|
|
|
use displaydoc::Display;
|
|
|
|
|
|
|
|
|
|
/// Represents an error in the manipulation of internal cryptographic data
|
2021-10-11 02:51:12 +02:00
|
|
|
#[derive(Clone, Debug, Display, Eq, Hash, PartialEq)]
|
2021-09-09 01:56:54 -07:00
|
|
|
pub enum InternalError {
|
|
|
|
|
/// 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,
|
2021-09-13 16:02:09 -07:00
|
|
|
/// 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,
|
2021-09-15 11:38:13 -07:00
|
|
|
/// Encountered insufficient bytes when attempting to deserialize
|
|
|
|
|
SizeError,
|
2021-09-27 18:29:08 -07:00
|
|
|
/// Encountered a zero scalar
|
|
|
|
|
ZeroScalarError,
|
2021-09-09 01:56:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "std")]
|
|
|
|
|
impl Error for InternalError {}
|