1- //! Implementation of a structure [`Protocol`] aimed at generalizing the SchnorrProtocol
1+ //! Implementation of a structure [`Protocol`] aimed at generalizing the SchnorrProtocol
22//! using the compositions of the latter via AND and OR links
33//!
44//! This structure allows, for example, the construction of protocols of the form:
@@ -22,6 +22,12 @@ use crate::{
2222 traits:: { SigmaProtocol , SigmaProtocolSimulator } ,
2323} ;
2424
25+ /// A protocol proving knowledge of a witness for a composition of SchnorrProtocol's.
26+ ///
27+ /// This implementation generalizes [`SchnorrProtocol`] by using AND/OR links.
28+ ///
29+ /// # Type Parameters
30+ /// - `G`: A cryptographic group implementing [`Group`] and [`GroupEncoding`].
2531#[ derive( Clone ) ]
2632pub enum Protocol < G : Group + GroupEncoding > {
2733 Simple ( SchnorrProtocol < G > ) ,
@@ -47,13 +53,15 @@ where
4753 }
4854}
4955
56+ // Structure representing the Commitment type of Protocol as SigmaProtocol
5057#[ derive( Clone ) ]
5158pub enum ProtocolCommitment < G : Group + GroupEncoding > {
5259 Simple ( <SchnorrProtocol < G > as SigmaProtocol >:: Commitment ) ,
5360 And ( Vec < ProtocolCommitment < G > > ) ,
5461 Or ( Vec < ProtocolCommitment < G > > ) ,
5562}
5663
64+ // Structure representing the ProverState type of Protocol as SigmaProtocol
5765#[ derive( Clone ) ]
5866pub enum ProtocolProverState < G : Group + GroupEncoding > {
5967 Simple ( <SchnorrProtocol < G > as SigmaProtocol >:: ProverState ) ,
@@ -65,19 +73,22 @@ pub enum ProtocolProverState<G: Group + GroupEncoding> {
6573 ) ,
6674}
6775
76+ // Structure representing the Response type of Protocol as SigmaProtocol
6877#[ derive( Clone ) ]
6978pub enum ProtocolResponse < G : Group + GroupEncoding > {
7079 Simple ( <SchnorrProtocol < G > as SigmaProtocol >:: Response ) ,
7180 And ( Vec < ProtocolResponse < G > > ) ,
7281 Or ( Vec < ProtocolChallenge < G > > , Vec < ProtocolResponse < G > > ) ,
7382}
7483
84+ // Structure representing the Witness type of Protocol as SigmaProtocol
7585pub enum ProtocolWitness < G : Group + GroupEncoding > {
7686 Simple ( <SchnorrProtocol < G > as SigmaProtocol >:: Witness ) ,
7787 And ( Vec < ProtocolWitness < G > > ) ,
7888 Or ( usize , Vec < ProtocolWitness < G > > ) ,
7989}
8090
91+ // Structure representing the Challenge type of Protocol as SigmaProtocol
8192type ProtocolChallenge < G > = <SchnorrProtocol < G > as SigmaProtocol >:: Challenge ;
8293
8394impl < G : Group + GroupEncoding > SigmaProtocol for Protocol < G > {
0 commit comments