@@ -8,17 +8,17 @@ use crate::dkg::group_key::GroupSecretKey;
8
8
use crate :: dkg:: group_key:: GroupSecretKeyShard ;
9
9
use crate :: dkg:: round1;
10
10
use crate :: dkg:: round2;
11
- use crate :: frost:: keys:: dkg:: round2:: SecretPackage as Round2SecretPackage ;
11
+ use crate :: dkg:: round2:: import_secret_package;
12
+ use crate :: frost:: keys:: dkg:: part3;
13
+ use crate :: frost:: keys:: KeyPackage ;
14
+ use crate :: frost:: keys:: PublicKeyPackage ;
12
15
use crate :: participant:: Secret ;
13
- use reddsa:: frost:: redjubjub:: keys:: dkg:: part3;
14
- use reddsa:: frost:: redjubjub:: keys:: KeyPackage ;
15
- use reddsa:: frost:: redjubjub:: keys:: PublicKeyPackage ;
16
16
use std:: borrow:: Borrow ;
17
17
use std:: collections:: BTreeMap ;
18
18
19
19
pub fn round3 < ' a , P , Q > (
20
20
secret : & Secret ,
21
- round2_secret_package : & Round2SecretPackage ,
21
+ round2_secret_package : & [ u8 ] ,
22
22
round1_public_packages : P ,
23
23
round2_public_packages : Q ,
24
24
) -> Result < ( KeyPackage , PublicKeyPackage , GroupSecretKey ) , Error >
@@ -27,10 +27,12 @@ where
27
27
Q : IntoIterator < Item = & ' a round2:: PublicPackage > ,
28
28
{
29
29
let identity = secret. to_identity ( ) ;
30
+ let round2_secret_package =
31
+ import_secret_package ( round2_secret_package, secret) . map_err ( Error :: DecryptionError ) ?;
30
32
let round1_public_packages = round1_public_packages. into_iter ( ) . collect :: < Vec < _ > > ( ) ;
31
33
let round2_public_packages = round2_public_packages. into_iter ( ) . collect :: < Vec < _ > > ( ) ;
32
34
33
- let ( min_signers, max_signers) = round2:: get_secret_package_signers ( round2_secret_package) ;
35
+ let ( min_signers, max_signers) = round2:: get_secret_package_signers ( & round2_secret_package) ;
34
36
35
37
// Ensure that the number of public packages provided matches max_signers
36
38
let expected_round1_packages = max_signers as usize ;
@@ -125,7 +127,7 @@ where
125
127
assert_eq ! ( round2_public_packages. len( ) , round2_frost_packages. len( ) ) ;
126
128
127
129
let ( key_package, public_key_package) = part3 (
128
- round2_secret_package,
130
+ & round2_secret_package,
129
131
& round1_frost_packages,
130
132
& round2_frost_packages,
131
133
)
@@ -142,7 +144,6 @@ where
142
144
mod tests {
143
145
use super :: * ;
144
146
use crate :: dkg:: round1;
145
- use crate :: dkg:: round2:: import_secret_package;
146
147
use crate :: participant:: Secret ;
147
148
use rand:: thread_rng;
148
149
@@ -188,12 +189,9 @@ mod tests {
188
189
. find ( |p| p. recipient_identity ( ) . eq ( & identity1) )
189
190
. expect ( "should have package for identity1" ) ] ;
190
191
191
- let secret_package = import_secret_package ( & encrypted_secret_package, & secret1)
192
- . expect ( "round 2 secret package import failed" ) ;
193
-
194
192
let result = round3 (
195
193
& secret1,
196
- & secret_package ,
194
+ & encrypted_secret_package ,
197
195
[ & package2] ,
198
196
round2_public_packages,
199
197
) ;
@@ -246,12 +244,9 @@ mod tests {
246
244
. find ( |p| p. recipient_identity ( ) . eq ( & identity1) )
247
245
. expect ( "should have package for identity1" ) ] ;
248
246
249
- let secret_package = import_secret_package ( & encrypted_secret_package, & secret1)
250
- . expect ( "round 2 secret package import failed" ) ;
251
-
252
247
let result = round3 (
253
248
& secret1,
254
- & secret_package ,
249
+ & encrypted_secret_package ,
255
250
[ & package1, & package1] ,
256
251
round2_public_packages,
257
252
) ;
@@ -339,12 +334,9 @@ mod tests {
339
334
. expect ( "should have package for identity1" ) ,
340
335
] ;
341
336
342
- let secret_package = import_secret_package ( & encrypted_secret_package, & secret1)
343
- . expect ( "round 2 secret package import failed" ) ;
344
-
345
337
round3 (
346
338
& secret1,
347
- & secret_package ,
339
+ & encrypted_secret_package ,
348
340
[ & package1, & package2, & package3] ,
349
341
round2_public_packages,
350
342
)
0 commit comments