@@ -43,7 +43,7 @@ pub enum SessionState<C: Ciphersuite> {
43
43
/// Commitments sent by participants so far, for each message being
44
44
/// signed.
45
45
commitments : HashMap < Identifier < C > , Vec < SigningCommitments < C > > > ,
46
- pubkeys : HashMap < Vec < u8 > , Identifier < C > > ,
46
+ pubkeys : HashMap < PublicKey , Identifier < C > > ,
47
47
} ,
48
48
/// Commitments have been sent by all participants. Coordinator can create
49
49
/// SigningPackage and send to participants. Waiting for participants to
@@ -54,7 +54,7 @@ pub enum SessionState<C: Ciphersuite> {
54
54
/// All commitments sent by participants, for each message being signed.
55
55
commitments : HashMap < Identifier < C > , Vec < SigningCommitments < C > > > ,
56
56
/// Pubkey -> Identifier mapping.
57
- pubkeys : HashMap < Vec < u8 > , Identifier < C > > ,
57
+ pubkeys : HashMap < PublicKey , Identifier < C > > ,
58
58
/// Signature shares sent by participants so far, for each message being
59
59
/// signed.
60
60
signature_shares : HashMap < Identifier < C > , Vec < SignatureShare < C > > > ,
@@ -74,7 +74,7 @@ impl<C: Ciphersuite> SessionState<C> {
74
74
pub fn new (
75
75
num_messages : usize ,
76
76
num_signers : usize ,
77
- pubkeys : HashMap < Vec < u8 > , Identifier < C > > ,
77
+ pubkeys : HashMap < PublicKey , Identifier < C > > ,
78
78
) -> Self {
79
79
let args = SessionStateArgs {
80
80
num_messages,
@@ -113,7 +113,7 @@ impl<C: Ciphersuite> SessionState<C> {
113
113
/// Handle commitments sent by a participant.
114
114
fn handle_commitments (
115
115
& mut self ,
116
- pubkey : Vec < u8 > ,
116
+ pubkey : PublicKey ,
117
117
commitments : Vec < SigningCommitments < C > > ,
118
118
) -> Result < ( ) , Box < dyn Error > > {
119
119
if let SessionState :: WaitingForCommitments {
@@ -164,7 +164,7 @@ impl<C: Ciphersuite> SessionState<C> {
164
164
) -> Result <
165
165
(
166
166
Vec < BTreeMap < Identifier < C > , SigningCommitments < C > > > ,
167
- HashMap < Vec < u8 > , Identifier < C > > ,
167
+ HashMap < PublicKey , Identifier < C > > ,
168
168
) ,
169
169
Box < dyn Error > ,
170
170
> {
@@ -197,7 +197,7 @@ impl<C: Ciphersuite> SessionState<C> {
197
197
/// Handle signature share sent by a participant.
198
198
fn handle_signature_share (
199
199
& mut self ,
200
- pubkey : Vec < u8 > ,
200
+ pubkey : PublicKey ,
201
201
signature_shares : Vec < SignatureShare < C > > ,
202
202
) -> Result < ( ) , Box < dyn Error > > {
203
203
if let SessionState :: WaitingForSignatureShares {
@@ -265,11 +265,11 @@ pub struct HTTPComms<C: Ciphersuite> {
265
265
access_token : Option < String > ,
266
266
args : ProcessedArgs < C > ,
267
267
state : SessionState < C > ,
268
- pubkeys : HashMap < Vec < u8 > , Identifier < C > > ,
268
+ pubkeys : HashMap < PublicKey , Identifier < C > > ,
269
269
// The "send" Noise objects by pubkey of recipients.
270
- send_noise : Option < HashMap < Vec < u8 > , Noise > > ,
270
+ send_noise : Option < HashMap < PublicKey , Noise > > ,
271
271
// The "receive" Noise objects by pubkey of senders.
272
- recv_noise : Option < HashMap < Vec < u8 > , Noise > > ,
272
+ recv_noise : Option < HashMap < PublicKey , Noise > > ,
273
273
_phantom : PhantomData < C > ,
274
274
}
275
275
@@ -295,7 +295,7 @@ impl<C: Ciphersuite> HTTPComms<C> {
295
295
}
296
296
297
297
// Encrypts a message for a given recipient.
298
- fn encrypt ( & mut self , recipient : & Vec < u8 > , msg : Vec < u8 > ) -> Result < Vec < u8 > , Box < dyn Error > > {
298
+ fn encrypt ( & mut self , recipient : & PublicKey , msg : Vec < u8 > ) -> Result < Vec < u8 > , Box < dyn Error > > {
299
299
let noise_map = self
300
300
. send_noise
301
301
. as_mut ( )
@@ -390,7 +390,7 @@ impl<C: Ciphersuite + 'static> Comms<C> for HTTPComms<C> {
390
390
. post ( format ! ( "{}/create_new_session" , self . host_port) )
391
391
. bearer_auth ( self . access_token . as_ref ( ) . expect ( "was just set" ) )
392
392
. json ( & frostd:: CreateNewSessionArgs {
393
- pubkeys : self . args . signers . keys ( ) . cloned ( ) . map ( PublicKey ) . collect ( ) ,
393
+ pubkeys : self . args . signers . keys ( ) . cloned ( ) . collect ( ) ,
394
394
message_count : 1 ,
395
395
} )
396
396
. send ( )
@@ -423,7 +423,7 @@ impl<C: Ciphersuite + 'static> Comms<C> for HTTPComms<C> {
423
423
let send_noise = Noise :: new (
424
424
builder
425
425
. local_private_key ( comm_privkey)
426
- . remote_public_key ( comm_participant_pubkey)
426
+ . remote_public_key ( & comm_participant_pubkey. 0 )
427
427
. build_initiator ( ) ?,
428
428
) ;
429
429
let builder = snow:: Builder :: new (
@@ -434,7 +434,7 @@ impl<C: Ciphersuite + 'static> Comms<C> for HTTPComms<C> {
434
434
let recv_noise = Noise :: new (
435
435
builder
436
436
. local_private_key ( comm_privkey)
437
- . remote_public_key ( comm_participant_pubkey)
437
+ . remote_public_key ( & comm_participant_pubkey. 0 )
438
438
. build_responder ( ) ?,
439
439
) ;
440
440
send_noise_map. insert ( comm_participant_pubkey. clone ( ) , send_noise) ;
@@ -506,7 +506,7 @@ impl<C: Ciphersuite + 'static> Comms<C> for HTTPComms<C> {
506
506
)
507
507
. json ( & frostd:: SendArgs {
508
508
session_id : self . session_id . unwrap ( ) ,
509
- recipients : vec ! [ frostd :: PublicKey ( recipient. clone( ) ) ] ,
509
+ recipients : vec ! [ recipient. clone( ) ] ,
510
510
msg,
511
511
} )
512
512
. send ( )
0 commit comments