blsful 3.1.0

BLS signature implementation according to the IETF spec on the BLS12-381 curve.
Documentation
use thiserror::Error;

/// The error types generated by this library
#[derive(Error, Clone, Debug)]
pub enum BlsError {
    /// Invalid signing operation
    #[error("invalid signing operation: {0}")]
    SigningError(String),
    /// Invalid inputs to a function
    #[error("invalid inputs: {0}")]
    InvalidInputs(String),
    /// An invalid signature error
    #[error("invalid signature")]
    InvalidSignature,
    /// The proof was invalid
    #[error("invalid proof")]
    InvalidProof,
    /// The signature schemes don't match
    #[error("Invalid signature scheme")]
    InvalidSignatureScheme,
    /// The decryption share is invalid
    #[error("Invalid sign cryption share")]
    InvalidDecryptionShare,
    /// A verifiable secret sharing scheme error
    #[error("an error occurred during secret sharing")]
    VsssError,
    /// An error occurred during serialization
    #[error("serialization error: {0}")]
    DeserializationError(String),
}

/// The result type generated by this library
pub type BlsResult<T> = anyhow::Result<T, BlsError>;

impl From<vsss_rs::Error> for BlsError {
    fn from(_: vsss_rs::Error) -> Self {
        Self::VsssError
    }
}

impl From<serde_bare::error::Error> for BlsError {
    fn from(e: serde_bare::error::Error) -> Self {
        Self::DeserializationError(e.to_string())
    }
}