Add verify_signature()
to Attestation
This commit is contained in:
parent
25ae0f64c2
commit
75a9e0f3de
@ -1,6 +1,6 @@
|
|||||||
use super::{AttestationData, Bitfield, Hash256};
|
use super::{AggregatePublicKey, AggregateSignature, AttestationData, Bitfield, Hash256};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use bls::AggregateSignature;
|
use bls::bls_verify_aggregate;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use serde_derive::Serialize;
|
use serde_derive::Serialize;
|
||||||
use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash};
|
use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash};
|
||||||
@ -21,6 +21,17 @@ impl Attestation {
|
|||||||
pub fn signable_message(&self, custody_bit: bool) -> Vec<u8> {
|
pub fn signable_message(&self, custody_bit: bool) -> Vec<u8> {
|
||||||
self.data.signable_message(custody_bit)
|
self.data.signable_message(custody_bit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn verify_signature(
|
||||||
|
&self,
|
||||||
|
group_public_key: &AggregatePublicKey,
|
||||||
|
custody_bit: bool,
|
||||||
|
// TODO: use domain.
|
||||||
|
_domain: u64,
|
||||||
|
) -> bool {
|
||||||
|
self.aggregate_signature
|
||||||
|
.verify(&self.signable_message(custody_bit), group_public_key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Encodable for Attestation {
|
impl Encodable for Attestation {
|
||||||
|
Loading…
Reference in New Issue
Block a user