vrf_rfc9381/
error.rs

1use crate::Ciphersuite;
2
3#[derive(Debug, thiserror::Error)]
4pub enum VrfError {
5    #[error(transparent)]
6    IncorrectSliceSize(#[from] std::array::TryFromSliceError),
7    #[error("The length of `pi_string` is incorrect, expected: {expected} but got {actual}")]
8    IncorrectPiLength { expected: usize, actual: usize },
9    #[error("The TryAndIncrement algorithm (TAI) could not find any suitable candidate")]
10    TryAndIncrementNoCandidatesFound,
11    #[error("The requested ciphersuite ({0}) isn't supported")]
12    UnsupportedCiphersuite(Ciphersuite),
13    #[error("The verification of the Proof has failed")]
14    ProofVerificationFailure,
15    #[cfg(feature = "p256")]
16    #[error(transparent)]
17    P256Error(#[from] p256::elliptic_curve::Error),
18    #[cfg(feature = "p256")]
19    #[error(transparent)]
20    P256Hash2CurveError(#[from] hash2curve::ExpandMsgXmdError),
21    #[cfg(feature = "ec")]
22    #[error("Invalid Elliptic Curve point")]
23    InvalidEcPoint,
24}
25
26pub type VrfResult<T> = Result<T, VrfError>;