mithril_common/crypto_helper/cardano/kes/
interface.rs

1use std::fmt::Debug;
2
3use kes_summed_ed25519::kes::Sum6KesSig;
4
5use crate::{
6    crypto_helper::{KesPeriod, OpCert},
7    StdResult,
8};
9
10/// Trait for KES (Key Evolving Signature) signing operation.
11#[cfg_attr(test, mockall::automock)]
12pub trait KesSigner: Send + Sync {
13    /// Return signed bytes with the KES secret key and the associated Operational Certificate
14    fn sign(&self, message: &[u8], kes_period: KesPeriod) -> StdResult<(Sum6KesSig, OpCert)>;
15}
16
17/// Trait for KES (Key Evolving Signature) verification operation.
18#[cfg_attr(test, mockall::automock)]
19pub trait KesVerifier: Send + Sync + Debug {
20    /// Verify the signed message and return the original message.
21    fn verify(
22        &self,
23        message: &[u8],
24        signature: &Sum6KesSig,
25        operational_certificate: &OpCert,
26        kes_period: KesPeriod,
27    ) -> StdResult<()>;
28}