@@ -16,6 +16,7 @@ use crate::{
1616 types:: { CommitProofInitResult , Message , ProofMessage } ,
1717 utils:: compute_challenge,
1818 } ,
19+ interface:: BbsInterfaceParameter ,
1920 } ,
2021 common:: util:: create_random_scalar,
2122 curves:: bls12_381:: { Bls12 , G2Prepared } ,
@@ -37,7 +38,7 @@ impl core::fmt::Display for ProofWithNym {
3738impl ProofWithNym {
3839 // TODO: remove the clippy warning de-activation
3940 #[ allow( clippy:: too_many_arguments) ]
40- pub fn new < T , G , C > (
41+ pub fn new < T , G , I > (
4142 PK : & PublicKey ,
4243 signature : & Signature ,
4344 pseudonym : & Pseudonym ,
@@ -47,14 +48,13 @@ impl ProofWithNym {
4748 ph : Option < T > ,
4849 generators : & G ,
4950 messages : & [ ProofMessage ] ,
50- api_id : Option < Vec < u8 > > ,
5151 ) -> Result < Self , Error >
5252 where
5353 T : AsRef < [ u8 ] > ,
5454 G : Generators ,
55- C : BbsCiphersuiteParameters ,
55+ I : BbsInterfaceParameter ,
5656 {
57- Self :: new_with_rng :: < _ , _ , _ , C > (
57+ Self :: new_with_rng :: < _ , _ , _ , I > (
5858 PK ,
5959 signature,
6060 pseudonym,
@@ -64,14 +64,13 @@ impl ProofWithNym {
6464 ph,
6565 generators,
6666 messages,
67- api_id,
6867 OsRng ,
6968 )
7069 }
7170
7271 // TODO: remove the clippy warning de-activation
7372 #[ allow( clippy:: too_many_arguments) ]
74- pub fn new_with_rng < T , R , G , C > (
73+ pub fn new_with_rng < T , R , G , I > (
7574 PK : & PublicKey ,
7675 signature : & Signature ,
7776 pseudonym : & Pseudonym ,
@@ -81,17 +80,14 @@ impl ProofWithNym {
8180 ph : Option < T > ,
8281 generators : & G ,
8382 messages : & [ ProofMessage ] ,
84- api_id : Option < Vec < u8 > > ,
8583 mut rng : R ,
8684 ) -> Result < Self , Error >
8785 where
8886 T : AsRef < [ u8 ] > ,
8987 R : RngCore + CryptoRng ,
9088 G : Generators ,
91- C : BbsCiphersuiteParameters ,
89+ I : BbsInterfaceParameter ,
9290 {
93- let api_id = api_id. unwrap_or ( [ ] . to_vec ( ) ) ;
94-
9591 // (r1, r2, r3, m~_j1, ..., m~_jU) = calculate_random_scalars(3+U)
9692 let mut random_scalars = RandomScalars {
9793 r1 : create_random_scalar ( & mut rng) ?,
@@ -134,19 +130,18 @@ impl ProofWithNym {
134130 }
135131 }
136132
137- let init_result = Proof :: proof_init :: < T , G , C > (
133+ let init_result = Proof :: proof_init :: < T , G , I > (
138134 PK ,
139135 signature,
140136 generators,
141137 & random_scalars,
142138 header,
143139 message_scalars,
144140 undisclosed_indexes,
145- & api_id,
146141 ) ?;
147142
148143 // Pseudonym correctness proof init
149- let OP = C :: hash_to_curve ( verifier_id. as_ref ( ) , & api_id ) ?;
144+ let OP = I :: hash_to_curve ( verifier_id. as_ref ( ) ) ?;
150145
151146 let pid_tilde = random_scalars. m_tilde_scalars . last ( ) . unwrap ( ) ;
152147 let pseudonym_proof_init = CommitProofInitResult {
@@ -156,11 +151,10 @@ impl ProofWithNym {
156151 } ;
157152
158153 // challenge calculation
159- let challenge = compute_challenge :: < _ , C > (
154+ let challenge = compute_challenge :: < _ , I > (
160155 & init_result,
161156 & disclosed_messages,
162157 ph,
163- api_id,
164158 Some ( pseudonym_proof_init) ,
165159 ) ?;
166160
@@ -181,7 +175,7 @@ impl ProofWithNym {
181175
182176 // TODO: Remove this clippy warning de-activation
183177 #[ allow( clippy:: too_many_arguments) ]
184- pub fn verify < T , G , C > (
178+ pub fn verify < T , G , I > (
185179 & self ,
186180 PK : & PublicKey ,
187181 pseudonym : & Pseudonym ,
@@ -190,12 +184,11 @@ impl ProofWithNym {
190184 ph : Option < T > ,
191185 generators : & G ,
192186 disclosed_messages : & BTreeMap < usize , Message > ,
193- api_id : Option < Vec < u8 > > ,
194187 ) -> Result < bool , Error >
195188 where
196189 T : AsRef < [ u8 ] > ,
197190 G : Generators ,
198- C : BbsCiphersuiteParameters ,
191+ I : BbsInterfaceParameter ,
199192 {
200193 // if KeyValidate(PK) is INVALID, return INVALID
201194 // `PK` should not be an identity and should belong to subgroup G2
@@ -206,7 +199,7 @@ impl ProofWithNym {
206199 // the pseudonym should be a point of G1 but not any of the constant
207200 // "reserved" points (i.e., the identity of G1 or the base
208201 // generator and the base point of G1).
209- if pseudonym. is_valid :: < C > ( ) . unwrap_u8 ( ) == 0u8 {
202+ if pseudonym. is_valid :: < I :: Ciphersuite > ( ) . unwrap_u8 ( ) == 0u8 {
210203 return Err ( Error :: InvalidPseudonym ) ;
211204 }
212205
@@ -228,19 +221,16 @@ impl ProofWithNym {
228221 }
229222 }
230223
231- let api_id = api_id. unwrap_or ( [ ] . to_vec ( ) ) ;
232-
233224 // initialize the proof verification procedure
234- let init_res = self . 0 . proof_verify_init :: < T , G , C > (
225+ let init_res = self . 0 . proof_verify_init :: < T , G , I > (
235226 PK ,
236227 header,
237228 generators,
238229 disclosed_messages,
239- & api_id,
240230 ) ?;
241231
242232 // initialize the pseudonym correctness proof verification procedure
243- let OP = C :: hash_to_curve ( verifier_id. as_ref ( ) , & api_id ) ?;
233+ let OP = I :: hash_to_curve ( verifier_id. as_ref ( ) ) ?;
244234 let pseudonym_point = pseudonym. as_point ( ) ;
245235 let proof_challenge = self . 0 . c ;
246236
@@ -256,11 +246,10 @@ impl ProofWithNym {
256246 blind_commit : Uv ,
257247 } ;
258248
259- let challenge = compute_challenge :: < _ , C > (
249+ let challenge = compute_challenge :: < _ , I > (
260250 & init_res,
261251 disclosed_messages,
262252 ph,
263- api_id,
264253 Some ( pseudonym_proof_verify_init) ,
265254 ) ?;
266255
@@ -279,7 +268,7 @@ impl ProofWithNym {
279268 // Check the signature proof
280269 // if e(Abar, W) * e(Abar, -P2) != 1, return INVALID
281270 // else return VALID
282- let P2 = C :: p2 ( ) . to_affine ( ) ;
271+ let P2 = I :: Ciphersuite :: p2 ( ) . to_affine ( ) ;
283272 Ok ( Bls12 :: multi_miller_loop ( & [
284273 (
285274 & self . 0 . A_bar . to_affine ( ) ,
0 commit comments