1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! Protocol module
//!
//! This module contains types that standardize and make easier mithril protocol operations
//! such as issuing single signatures, aggregating them as multi-signatures or computing
//! aggregate verification keys.

mod multi_signer;
mod signer_builder;
mod single_signer;

pub use multi_signer::MultiSigner;
pub use signer_builder::{SignerBuilder, SignerBuilderError};
pub use single_signer::SingleSigner;

/// Trait to convert a type to a message that can be signed or verified by the Mithril protocol.
pub trait ToMessage: Sync + Send {
    /// Return a String representation of the message.
    fn to_message(&self) -> String;
}

impl ToMessage for String {
    fn to_message(&self) -> String {
        self.clone()
    }
}

impl ToMessage for &str {
    fn to_message(&self) -> String {
        self.to_string()
    }
}