randomized: add Debug to structs

This commit is contained in:
Conrado Gouvea 2024-02-28 13:44:23 -03:00
parent d048057a21
commit bc633a23f5
2 changed files with 30 additions and 0 deletions

View File

@ -23,6 +23,7 @@ rustdoc-args = ["--cfg", "docsrs"]
derive-getters = "0.3.0"
document-features = "0.2.7"
frost-core = { path = "../frost-core", version = "1.0.0", features = ["internals"] }
hex = "0.4.3"
rand_core = "0.6"
[dev-dependencies]

View File

@ -249,6 +249,19 @@ where
}
}
impl<C> core::fmt::Debug for Randomizer<C>
where
C: Ciphersuite,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("Randomizer")
.field(&hex::encode(
<<C::Group as Group>::Field>::serialize(&self.0).as_ref(),
))
.finish()
}
}
/// Randomized parameters for a signing instance of randomized FROST.
#[derive(Clone, PartialEq, Eq, Getters)]
pub struct RandomizedParams<C: Ciphersuite> {
@ -303,3 +316,19 @@ where
}
}
}
impl<C> core::fmt::Debug for RandomizedParams<C>
where
C: Ciphersuite,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RandomizedParams")
.field("randomizer", &self.randomizer)
.field(
"randomizer_element",
&hex::encode(<C::Group as Group>::serialize(&self.randomizer_element).as_ref()),
)
.field("randomized_verifying_key", &self.randomized_verifying_key)
.finish()
}
}