tafrah-traits 0.1.8

Shared traits and error types for the Tafrah PQC library
Documentation
//! Traits shared by signature schemes.

use rand_core::{CryptoRng, Rng};

/// Signing capability for a signature private key type.
pub trait SigningKey {
    type Signature;
    type Error;

    /// Signs `msg` and returns the detached signature.
    fn sign(
        &self,
        msg: &[u8],
        rng: &mut (impl CryptoRng + Rng),
    ) -> Result<Self::Signature, Self::Error>;
}

/// Verification capability for a signature public key type.
pub trait VerifyingKey {
    type Signature;
    type Error;

    /// Verifies `sig` over `msg`.
    fn verify(&self, msg: &[u8], sig: &Self::Signature) -> Result<(), Self::Error>;
}