Trait aleph_bft::KeyBox [−][src]
pub trait KeyBox: Index + Clone + Send + Sync + 'static {
type Signature: Signature;
fn node_count(&self) -> NodeCount;
fn sign<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Self::Signature> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn verify(
&self,
msg: &[u8],
sgn: &Self::Signature,
index: NodeIndex
) -> bool;
}
Expand description
Abstraction of the signing data and verifying signatures.
A typical implementation of KeyBox would be a collection of N
public keys,
an index i
and a single private key corresponding to the public key number i
.
The meaning of sign is then to produce a signature s
using the given private key,
and verify(msg, s, j)
is to verify whether the signature s under the message msg is
correct with respect to the public key of the jth node.
Associated Types
Required methods
fn node_count(&self) -> NodeCount
fn node_count(&self) -> NodeCount
Returns the total number of known public keys.
Signs a message msg
.