mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-23 23:04:53 +00:00
Add agg_pub to bls, add agg_sig.verify_multiple
- Adds a new-type wrapper for `AggregatePublicKey`, just like all the other types. - Adds the `verify_multiple` method to the `AggregateSignature` newtype, as was introduced in a recent version of signature-schemes.
This commit is contained in:
24
eth2/utils/bls/src/aggregate_public_key.rs
Normal file
24
eth2/utils/bls/src/aggregate_public_key.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use super::PublicKey;
|
||||
use bls_aggregates::AggregatePublicKey as RawAggregatePublicKey;
|
||||
|
||||
/// A single BLS signature.
|
||||
///
|
||||
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
|
||||
/// serialization).
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AggregatePublicKey(RawAggregatePublicKey);
|
||||
|
||||
impl AggregatePublicKey {
|
||||
pub fn new() -> Self {
|
||||
AggregatePublicKey(RawAggregatePublicKey::new())
|
||||
}
|
||||
|
||||
pub fn add(&mut self, public_key: &PublicKey) {
|
||||
self.0.add(public_key.as_raw())
|
||||
}
|
||||
|
||||
/// Returns the underlying signature.
|
||||
pub fn as_raw(&self) -> &RawAggregatePublicKey {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user