Skip to content

Commit

Permalink
Actrually we can do just PublicKey here
Browse files Browse the repository at this point in the history
  • Loading branch information
¨Jeff committed Aug 31, 2023
1 parent 48b8507 commit a2ded0c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dleq_vrf/src/thin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ pub struct ThinVrf<C: AffineRepr> {
pub keying_base: C,
}

impl<C: AffineRepr> Default for ThinVrf<C> {
fn default() -> Self {
ThinVrf { keying_base: C::generator(), }
}
}


impl<C: AffineRepr> Flavor for ThinVrf<C> {
type ScalarField = <C as AffineRepr>::ScalarField;
Expand Down
15 changes: 15 additions & 0 deletions dleq_vrf/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,21 @@ impl<K: AffineRepr> EcVrfVerifier for (&crate::ThinVrf<K>,&crate::PublicKey<K>)
}
}

impl<K: AffineRepr> EcVrfVerifier for crate::PublicKey<K> {
type H = K;
type VrfProof = crate::Signature<crate::ThinVrf<K>>;
type Error = error::SignatureError;
fn vrf_verify_detached<'a>(
&self,
t: impl IntoTranscript,
ios: &'a [EcVrfInOut<Self>],
signature: &EcVrfProof<Self>,
) -> Result<&'a [EcVrfInOut<Self>],error::SignatureError>
{
crate::ThinVrf::default().verify_thin_vrf(t,ios,self,signature)
}
}


pub type EcVrfInput<V> = VrfInput<<V as EcVrfVerifier>::H>;
pub type EcVrfPreOut<V> = VrfPreOut<<V as EcVrfVerifier>::H>;
Expand Down

0 comments on commit a2ded0c

Please sign in to comment.