diff --git a/src/lib.rs b/src/lib.rs index 91dc418..26a4304 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -244,12 +244,6 @@ impl Secret { #[derive(Debug, Copy, Clone, PartialEq, CanonicalSerialize, CanonicalDeserialize)] pub struct Public(pub AffinePoint); -impl Public { - pub fn from(value: AffinePoint) -> Self { - Public(value) - } -} - /// VRF input point generic over the cipher suite. #[derive(Debug, Clone, Copy, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize)] pub struct Input(pub AffinePoint); @@ -261,7 +255,7 @@ impl Input { } /// Construct from inner affine point. - pub fn from(value: ::Affine) -> Self { + pub fn from(value: AffinePoint) -> Self { Input(value) } } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 3089a9c..5d546c7 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -35,5 +35,41 @@ macro_rules! suite_types { #[cfg(feature = "ring")] #[allow(dead_code)] pub type RingProof = $crate::ring::Proof<$suite>; + + impl From for Public { + fn from(p: AffinePoint) -> Self { + Self(p) + } + } + + impl From for AffinePoint { + fn from(p: Public) -> Self { + p.0 + } + } + + impl From for Input { + fn from(p: AffinePoint) -> Self { + Self(p) + } + } + + impl From for AffinePoint { + fn from(p: Input) -> Self { + p.0 + } + } + + impl From for Output { + fn from(p: AffinePoint) -> Self { + Self(p) + } + } + + impl From for AffinePoint { + fn from(p: Output) -> Self { + p.0 + } + } }; }