Move Serde De/Serialization to Group Implementation (#380)

* Move Serde De/Serialization to `Group` implementation

* Clean up Serde formats

* Fix typo
This commit is contained in:
daxpedda
2025-07-14 19:54:43 -07:00
committed by GitHub
parent 5b492aedbf
commit 1b6633cdcc
12 changed files with 415 additions and 220 deletions
+8 -2
View File
@@ -58,7 +58,10 @@ pub struct RegistrationRequest<CS: CipherSuite> {
#[cfg_attr(
feature = "serde",
derive(serde::Deserialize, serde::Serialize),
serde(bound = "")
serde(bound(
deserialize = "<KeGroup<CS> as Group>::Pk: serde::Deserialize<'de>",
serialize = "<KeGroup<CS> as Group>::Pk: serde::Serialize"
))
)]
#[derive_where(Clone)]
#[derive_where(Debug, Eq, Hash, Ord, PartialEq, PartialOrd; voprf::EvaluationElement<CS::OprfCs>, <KeGroup<CS> as Group>::Pk)]
@@ -74,7 +77,10 @@ pub struct RegistrationResponse<CS: CipherSuite> {
#[cfg_attr(
feature = "serde",
derive(serde::Deserialize, serde::Serialize),
serde(bound = "")
serde(bound(
deserialize = "<KeGroup<CS> as Group>::Pk: serde::Deserialize<'de>",
serialize = "<KeGroup<CS> as Group>::Pk: serde::Serialize"
))
)]
#[derive_where(Clone, ZeroizeOnDrop)]
#[derive_where(Debug, Eq, Hash, Ord, PartialEq, PartialOrd; <KeGroup<CS> as Group>::Pk)]