pub trait Keychain:
Index
+ Clone
+ Send
+ Sync
+ 'static {
type Signature: Signature;
// Required methods
fn node_count(&self) -> NodeCount;
fn sign(&self, msg: &[u8]) -> Self::Signature;
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 Keychain 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.
Required Associated Types§
Required Methods§
Sourcefn node_count(&self) -> NodeCount
fn node_count(&self) -> NodeCount
Returns the total number of known public keys.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.