bls: as_hex_string for aggregate signatures/pubkeys

This commit is contained in:
Michael Sproul 2019-06-11 18:00:05 +10:00
parent 0eea6fd367
commit 6bf6ba337d
No known key found for this signature in database
GPG Key ID: 77B1309D2E54E914
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
use super::PublicKey;
use milagro_bls::AggregatePublicKey as RawAggregatePublicKey;
use serde_hex::encode as hex_encode;
/// A BLS aggregate public key.
///
@ -21,4 +22,10 @@ impl AggregatePublicKey {
pub fn as_raw(&self) -> &RawAggregatePublicKey {
&self.0
}
/// Return a hex string representation of this key's bytes.
#[cfg(test)]
pub fn as_hex_string(&self) -> String {
hex_encode(self.as_raw().as_bytes())
}
}

View File

@ -129,6 +129,12 @@ impl AggregateSignature {
is_empty: true,
}
}
/// Return a hex string representation of the bytes of this signature.
#[cfg(test)]
pub fn as_hex_string(&self) -> String {
hex_encode(self.as_bytes())
}
}
impl_ssz!(