Add node transaction messages to Dynamic HB.
This commit is contained in:
parent
c0cef3b50b
commit
51b87b8bae
22
mod.rs
22
mod.rs
|
@ -29,7 +29,7 @@ const CHACHA_RNG_SEED_SIZE: usize = 8;
|
|||
const ERR_OS_RNG: &str = "could not initialize the OS random number generator";
|
||||
|
||||
/// A public key, or a public key share.
|
||||
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||
pub struct PublicKey(#[serde(with = "serde_impl::projective")] G1);
|
||||
|
||||
impl Hash for PublicKey {
|
||||
|
@ -38,6 +38,14 @@ impl Hash for PublicKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for PublicKey {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let uncomp = self.0.into_affine().into_uncompressed();
|
||||
let bytes = uncomp.as_ref();
|
||||
write!(f, "PublicKey({:?})", HexBytes(bytes))
|
||||
}
|
||||
}
|
||||
|
||||
impl PublicKey {
|
||||
/// Returns `true` if the signature matches the element of `G2`.
|
||||
pub fn verify_g2<H: Into<G2Affine>>(&self, sig: &Signature, hash: H) -> bool {
|
||||
|
@ -82,7 +90,7 @@ impl fmt::Debug for Signature {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let uncomp = self.0.into_affine().into_uncompressed();
|
||||
let bytes = uncomp.as_ref();
|
||||
write!(f, "{:?}", HexBytes(bytes))
|
||||
write!(f, "Signature({:?})", HexBytes(bytes))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,9 +112,17 @@ impl Signature {
|
|||
}
|
||||
|
||||
/// A secret key, or a secret key share.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct SecretKey(Fr);
|
||||
|
||||
impl fmt::Debug for SecretKey {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let uncomp = self.public_key().0.into_affine().into_uncompressed();
|
||||
let bytes = uncomp.as_ref();
|
||||
write!(f, "SecretKey({:?})", HexBytes(bytes))
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SecretKey {
|
||||
fn default() -> Self {
|
||||
SecretKey(Fr::zero())
|
||||
|
|
Loading…
Reference in New Issue