mirror of
https://github.com/arnaucube/schnorr.git
synced 2026-01-12 08:51:33 +01:00
Make trait SignatureVerifierBuilder
This commit is contained in:
@@ -19,8 +19,6 @@ use crate::schnorr::{SchnorrPublicKey, SchnorrSignature};
|
||||
|
||||
type GoldF = GoldilocksField;
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Mod65537Generator {
|
||||
a: Target,
|
||||
|
||||
@@ -78,8 +78,30 @@ impl SchnorrPublicKeyTarget {
|
||||
|
||||
pub struct SchnorrBuilder {}
|
||||
|
||||
impl SchnorrBuilder {
|
||||
pub fn constrain_sig <
|
||||
pub trait SignatureVerifierBuilder {
|
||||
fn constrain_sig <
|
||||
C: GenericConfig<2, F = GoldF>,
|
||||
> (
|
||||
&self,
|
||||
builder: &mut CircuitBuilder::<GoldF, 2>,
|
||||
sig: &SchnorrSignatureTarget,
|
||||
msg: &MessageTarget,
|
||||
pk: &SchnorrPublicKeyTarget,
|
||||
);
|
||||
|
||||
fn verify_sig <
|
||||
C: GenericConfig<2, F = GoldF>,
|
||||
> (
|
||||
&self,
|
||||
builder: &mut CircuitBuilder::<GoldF, 2>,
|
||||
sig: &SchnorrSignatureTarget,
|
||||
msg: &MessageTarget,
|
||||
pk: &SchnorrPublicKeyTarget,
|
||||
) -> BoolTarget;
|
||||
}
|
||||
|
||||
impl SignatureVerifierBuilder for SchnorrBuilder {
|
||||
fn constrain_sig <
|
||||
C: GenericConfig<2, F = GoldF>,
|
||||
> (
|
||||
&self,
|
||||
@@ -93,7 +115,7 @@ impl SchnorrBuilder {
|
||||
builder.connect(verification_output.target, true_target.target);
|
||||
}
|
||||
|
||||
pub fn verify_sig <
|
||||
fn verify_sig <
|
||||
C: GenericConfig<2, F = GoldF>,
|
||||
> (
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user