@@ -2,10 +2,13 @@ use std::collections::HashMap;
22
33use serde_bytes:: ByteBuf ;
44use serde_indexed:: DeserializeIndexed ;
5+ #[ cfg( test) ]
6+ use serde_indexed:: SerializeIndexed ;
57use tracing:: debug;
68
79use super :: { Ctap2CredentialType , Ctap2UserVerificationOperation } ;
810
11+ #[ cfg_attr( test, derive( SerializeIndexed ) ) ]
912#[ derive( Debug , Clone , DeserializeIndexed , Default ) ]
1013pub struct Ctap2GetInfoResponse {
1114 /// versions (0x01)
@@ -227,7 +230,7 @@ impl Ctap2GetInfoResponse {
227230 // clientPIN exists, but is not enabled, aka PIN is not yet set on the device
228231 // We can use it for establishing a shared secret, but not for creating a pinUvAuthToken
229232 if self . option_exists ( "clientPin" ) && !self . option_enabled ( "clientPin" ) {
230- return Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret ) ;
233+ return Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret ) ;
231234 }
232235
233236 // clientPin is not enabled (not supported or Pin not set) and
@@ -238,7 +241,7 @@ impl Ctap2GetInfoResponse {
238241 && self . option_exists ( "uv" )
239242 && self . option_enabled ( "pinUvAuthToken" )
240243 {
241- return Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret ) ;
244+ return Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret ) ;
242245 }
243246
244247 // If we do have a PIN, check if we need to use legacy getPinToken or new getPinUvAuthToken..-command
@@ -355,11 +358,11 @@ mod test {
355358 assert ! ( info. can_establish_shared_secret( ) ) ;
356359 assert_eq ! (
357360 info. uv_operation( false ) ,
358- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
361+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
359362 ) ;
360363 assert_eq ! (
361364 info. uv_operation( true ) ,
362- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
365+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
363366 ) ;
364367 }
365368
@@ -410,7 +413,7 @@ mod test {
410413 ) ;
411414 assert_eq ! (
412415 info. uv_operation( true ) ,
413- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
416+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
414417 ) ;
415418 }
416419
@@ -425,11 +428,11 @@ mod test {
425428 assert ! ( info. can_establish_shared_secret( ) ) ;
426429 assert_eq ! (
427430 info. uv_operation( false ) ,
428- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
431+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
429432 ) ;
430433 assert_eq ! (
431434 info. uv_operation( true ) ,
432- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
435+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
433436 ) ;
434437 }
435438
@@ -463,7 +466,7 @@ mod test {
463466 ) ;
464467 assert_eq ! (
465468 info. uv_operation( true ) ,
466- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
469+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
467470 ) ;
468471 }
469472
@@ -495,11 +498,11 @@ mod test {
495498 assert ! ( info. can_establish_shared_secret( ) ) ;
496499 assert_eq ! (
497500 info. uv_operation( false ) ,
498- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
501+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
499502 ) ;
500503 assert_eq ! (
501504 info. uv_operation( true ) ,
502- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
505+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
503506 ) ;
504507 }
505508
@@ -513,11 +516,11 @@ mod test {
513516 assert ! ( info. can_establish_shared_secret( ) ) ;
514517 assert_eq ! (
515518 info. uv_operation( false ) ,
516- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
519+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
517520 ) ;
518521 assert_eq ! (
519522 info. uv_operation( true ) ,
520- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
523+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
521524 ) ;
522525 }
523526
@@ -547,7 +550,7 @@ mod test {
547550 ) ;
548551 assert_eq ! (
549552 info. uv_operation( true ) ,
550- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
553+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
551554 ) ;
552555 }
553556
@@ -564,11 +567,11 @@ mod test {
564567 assert ! ( info. can_establish_shared_secret( ) ) ;
565568 assert_eq ! (
566569 info. uv_operation( false ) ,
567- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
570+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
568571 ) ;
569572 assert_eq ! (
570573 info. uv_operation( true ) ,
571- Some ( Ctap2UserVerificationOperation :: ClientPinOnlyForSharedSecret )
574+ Some ( Ctap2UserVerificationOperation :: OnlyForSharedSecret )
572575 ) ;
573576 }
574577}
0 commit comments