@@ -13,8 +13,8 @@ use crate::ctap2::commands::get_next_assertion::GetNextAssertion;
1313use crate :: ctap2:: commands:: make_credentials:: UserVerification ;
1414use crate :: ctap2:: server:: {
1515 AuthenticationExtensionsClientInputs , AuthenticationExtensionsClientOutputs ,
16- PublicKeyCredentialDescriptor , PublicKeyCredentialUserEntity , RelyingParty , RpIdHash ,
17- UserVerificationRequirement ,
16+ AuthenticatorAttachment , PublicKeyCredentialDescriptor , PublicKeyCredentialUserEntity ,
17+ RelyingParty , RpIdHash , UserVerificationRequirement ,
1818} ;
1919use crate :: ctap2:: utils:: { read_be_u32, read_byte} ;
2020use crate :: errors:: AuthenticatorError ;
@@ -191,7 +191,13 @@ impl GetAssertion {
191191 }
192192 }
193193
194- pub fn finalize_result < Dev : FidoDevice > ( & self , _dev : & Dev , result : & mut GetAssertionResult ) {
194+ pub fn finalize_result < Dev : FidoDevice > ( & self , dev : & Dev , result : & mut GetAssertionResult ) {
195+ result. attachment = match dev. get_authenticator_info ( ) {
196+ Some ( info) if info. options . platform_device => AuthenticatorAttachment :: Platform ,
197+ Some ( _) => AuthenticatorAttachment :: CrossPlatform ,
198+ None => AuthenticatorAttachment :: Unknown ,
199+ } ;
200+
195201 // Handle extensions whose outputs are not encoded in the authenticator data.
196202 // 1. appId
197203 if let Some ( app_id) = & self . extensions . app_id {
@@ -399,6 +405,7 @@ impl RequestCtap2 for GetAssertion {
399405 let mut results = Vec :: with_capacity ( number_of_credentials) ;
400406 results. push ( GetAssertionResult {
401407 assertion : assertion. into ( ) ,
408+ attachment : AuthenticatorAttachment :: Unknown ,
402409 extensions : Default :: default ( ) ,
403410 } ) ;
404411
@@ -408,6 +415,7 @@ impl RequestCtap2 for GetAssertion {
408415 let assertion = dev. send_cbor ( & msg) ?;
409416 results. push ( GetAssertionResult {
410417 assertion : assertion. into ( ) ,
418+ attachment : AuthenticatorAttachment :: Unknown ,
411419 extensions : Default :: default ( ) ,
412420 } ) ;
413421 }
@@ -457,6 +465,7 @@ impl From<GetAssertionResponse> for Assertion {
457465#[ derive( Debug , PartialEq , Eq ) ]
458466pub struct GetAssertionResult {
459467 pub assertion : Assertion ,
468+ pub attachment : AuthenticatorAttachment ,
460469 pub extensions : AuthenticationExtensionsClientOutputs ,
461470}
462471
@@ -493,6 +502,7 @@ impl GetAssertionResult {
493502
494503 Ok ( GetAssertionResult {
495504 assertion,
505+ attachment : AuthenticatorAttachment :: Unknown ,
496506 extensions : Default :: default ( ) ,
497507 } )
498508 }
@@ -606,8 +616,8 @@ pub mod test {
606616 do_credential_list_filtering_ctap1, do_credential_list_filtering_ctap2,
607617 } ;
608618 use crate :: ctap2:: server:: {
609- PublicKeyCredentialDescriptor , PublicKeyCredentialUserEntity , RelyingParty , RpIdHash ,
610- Transport ,
619+ AuthenticatorAttachment , PublicKeyCredentialDescriptor , PublicKeyCredentialUserEntity ,
620+ RelyingParty , RpIdHash , Transport ,
611621 } ;
612622 use crate :: transport:: device_selector:: Device ;
613623 use crate :: transport:: hid:: HIDDevice ;
@@ -768,6 +778,7 @@ pub mod test {
768778
769779 let expected = vec ! [ GetAssertionResult {
770780 assertion: expected_assertion,
781+ attachment: AuthenticatorAttachment :: Unknown ,
771782 extensions: Default :: default ( ) ,
772783 } ] ;
773784 let response = device. send_cbor ( & assertion) . unwrap ( ) ;
@@ -900,6 +911,7 @@ pub mod test {
900911
901912 let expected = vec ! [ GetAssertionResult {
902913 assertion: expected_assertion,
914+ attachment: AuthenticatorAttachment :: Unknown ,
903915 extensions: Default :: default ( ) ,
904916 } ] ;
905917 assert_eq ! ( response, expected) ;
@@ -1041,6 +1053,7 @@ pub mod test {
10411053
10421054 let expected = vec ! [ GetAssertionResult {
10431055 assertion: expected_assertion,
1056+ attachment: AuthenticatorAttachment :: Unknown ,
10441057 extensions: Default :: default ( ) ,
10451058 } ] ;
10461059 assert_eq ! ( response, expected) ;
0 commit comments