@@ -300,7 +300,7 @@ impl MakeCredentials {
300300 }
301301 }
302302
303- pub fn finalize_result ( & self , result : & mut MakeCredentialsResult ) {
303+ pub fn finalize_result < Dev : FidoDevice > ( & self , _dev : & Dev , result : & mut MakeCredentialsResult ) {
304304 // Handle extensions whose outputs are not encoded in the authenticator data.
305305 // 1. credProps
306306 // "set clientExtensionResults["credProps"]["rk"] to the value of the
@@ -451,8 +451,9 @@ impl RequestCtap1 for MakeCredentials {
451451 Ok ( ( apdu, ( ) ) )
452452 }
453453
454- fn handle_response_ctap1 (
454+ fn handle_response_ctap1 < Dev : FidoDevice > (
455455 & self ,
456+ dev : & mut Dev ,
456457 status : Result < ( ) , ApduErrorStatus > ,
457458 input : & [ u8 ] ,
458459 _add_info : & ( ) ,
@@ -466,7 +467,7 @@ impl RequestCtap1 for MakeCredentials {
466467
467468 let mut output = MakeCredentialsResult :: from_ctap1 ( input, & self . rp . hash ( ) )
468469 . map_err ( |e| Retryable :: Error ( HIDError :: Command ( e) ) ) ?;
469- self . finalize_result ( & mut output) ;
470+ self . finalize_result ( dev , & mut output) ;
470471 Ok ( output)
471472 }
472473
@@ -475,7 +476,7 @@ impl RequestCtap1 for MakeCredentials {
475476 dev : & mut Dev ,
476477 ) -> Result < Self :: Output , HIDError > {
477478 let mut output = dev. make_credentials ( self ) ?;
478- self . finalize_result ( & mut output) ;
479+ self . finalize_result ( dev , & mut output) ;
479480 Ok ( output)
480481 }
481482}
@@ -493,7 +494,7 @@ impl RequestCtap2 for MakeCredentials {
493494
494495 fn handle_response_ctap2 < Dev : FidoDevice > (
495496 & self ,
496- _dev : & mut Dev ,
497+ dev : & mut Dev ,
497498 input : & [ u8 ] ,
498499 ) -> Result < Self :: Output , HIDError > {
499500 if input. is_empty ( ) {
@@ -512,7 +513,7 @@ impl RequestCtap2 for MakeCredentials {
512513 if status. is_ok ( ) {
513514 let mut output: MakeCredentialsResult =
514515 from_slice ( & input[ 1 ..] ) . map_err ( CommandError :: Deserializing ) ?;
515- self . finalize_result ( & mut output) ;
516+ self . finalize_result ( dev , & mut output) ;
516517 Ok ( output)
517518 } else {
518519 let data: Value = from_slice ( & input[ 1 ..] ) . map_err ( CommandError :: Deserializing ) ?;
@@ -528,7 +529,7 @@ impl RequestCtap2 for MakeCredentials {
528529 dev : & mut Dev ,
529530 ) -> Result < Self :: Output , HIDError > {
530531 let mut output = dev. make_credentials ( self ) ?;
531- self . finalize_result ( & mut output) ;
532+ self . finalize_result ( dev , & mut output) ;
532533 Ok ( output)
533534 }
534535}
@@ -688,8 +689,14 @@ pub mod test {
688689 req_serialized, MAKE_CREDENTIALS_SAMPLE_REQUEST_CTAP1 ,
689690 "\n Got: {req_serialized:X?}\n Expected: {MAKE_CREDENTIALS_SAMPLE_REQUEST_CTAP1:X?}"
690691 ) ;
692+ let mut device = Device :: new ( "commands/make_credentials" ) . unwrap ( ) ; // not really used
691693 let make_cred_result = req
692- . handle_response_ctap1 ( Ok ( ( ) ) , & MAKE_CREDENTIALS_SAMPLE_RESPONSE_CTAP1 , & ( ) )
694+ . handle_response_ctap1 (
695+ & mut device,
696+ Ok ( ( ) ) ,
697+ & MAKE_CREDENTIALS_SAMPLE_RESPONSE_CTAP1 ,
698+ & ( ) ,
699+ )
693700 . expect ( "Failed to handle CTAP1 response" ) ;
694701
695702 let att_obj = AttestationObject {
0 commit comments