lighthouse-pulse/eth2/utils/bls/src/aggregate_public_key.rs

25 lines
652 B
Rust
Raw Normal View History

use super::PublicKey;
2019-06-03 13:26:22 +10:00
use milagro_bls::AggregatePublicKey as RawAggregatePublicKey;
/// A BLS aggregate public key.
///
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
/// serialization).
2019-03-03 11:47:09 +11:00
#[derive(Debug, Clone, Default)]
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 public key.
pub fn as_raw(&self) -> &RawAggregatePublicKey {
&self.0
}
}