Skip to content

Commit 41ed850

Browse files
Add signature verification trait (#38)
* Add Signature verification trait * Fix fmt Co-authored-by: Weikeng Chen <[email protected]>
1 parent 6be6062 commit 41ed850

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/signature/constraints.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ use ark_relations::r1cs::SynthesisError;
44

55
use crate::signature::SignatureScheme;
66

7+
pub trait SigVerifyGadget<S: SignatureScheme, ConstraintF: Field> {
8+
type ParametersVar: AllocVar<S::Parameters, ConstraintF> + Clone;
9+
10+
type PublicKeyVar: ToBytesGadget<ConstraintF> + AllocVar<S::PublicKey, ConstraintF> + Clone;
11+
12+
type SignatureVar: ToBytesGadget<ConstraintF> + AllocVar<S::Signature, ConstraintF> + Clone;
13+
14+
fn verify(
15+
parameters: &Self::ParametersVar,
16+
public_key: &Self::PublicKeyVar,
17+
// TODO: Should we make this take in bytes or something different?
18+
message: &[UInt8<ConstraintF>],
19+
signature: &Self::SignatureVar,
20+
) -> Result<Boolean<ConstraintF>, SynthesisError>;
21+
}
22+
723
pub trait SigRandomizePkGadget<S: SignatureScheme, ConstraintF: Field> {
824
type ParametersVar: AllocVar<S::Parameters, ConstraintF> + Clone;
925

0 commit comments

Comments
 (0)