@@ -125,10 +125,12 @@ where
125125 let get_info_response = self . ctap2_get_info ( ) . await ?;
126126 let mut ctap2_request =
127127 Ctap2MakeCredentialRequest :: from_webauthn_request ( op, & get_info_response) ?;
128- if let Some ( exclude_list) = & op. exclude {
129- let filtered_exclude_list =
130- ctap2_preflight ( self , exclude_list, & op. hash , & op. relying_party . id ) . await ;
131- ctap2_request. exclude = Some ( filtered_exclude_list) ;
128+ if Self :: supports_preflight ( ) {
129+ if let Some ( exclude_list) = & op. exclude {
130+ let filtered_exclude_list =
131+ ctap2_preflight ( self , exclude_list, & op. hash , & op. relying_party . id ) . await ;
132+ ctap2_request. exclude = Some ( filtered_exclude_list) ;
133+ }
132134 }
133135 let response = loop {
134136 let uv_auth_used =
@@ -183,21 +185,24 @@ where
183185 let get_info_response = self . ctap2_get_info ( ) . await ?;
184186 let mut ctap2_request =
185187 Ctap2GetAssertionRequest :: from_webauthn_request ( op, & get_info_response) ?;
186- let filtered_allow_list =
187- ctap2_preflight ( self , & op. allow , & op. hash , & op. relying_party_id ) . await ;
188- if filtered_allow_list. is_empty ( ) && !op. allow . is_empty ( ) {
189- // We filtered out everything in preflight, meaning none of the allowed
190- // credentials are present on this device. So we error out here
191- // But the spec requires some form of user interaction, so we run a
192- // dummy request, ignore the result and error out.
193- warn ! ( "Preflight removed all credentials from the allow-list. Sending dummy request and erroring out." ) ;
194- let dummy_request = Ctap2MakeCredentialRequest :: dummy ( ) ;
195- self . send_state_update ( UxUpdate :: PresenceRequired ) . await ;
196- let _ = self . ctap2_make_credential ( & dummy_request, op. timeout ) . await ;
197- return Err ( Error :: Ctap ( CtapError :: NoCredentials ) ) ;
188+
189+ if Self :: supports_preflight ( ) {
190+ let filtered_allow_list =
191+ ctap2_preflight ( self , & op. allow , & op. hash , & op. relying_party_id ) . await ;
192+ if filtered_allow_list. is_empty ( ) && !op. allow . is_empty ( ) {
193+ // We filtered out everything in preflight, meaning none of the allowed
194+ // credentials are present on this device. So we error out here
195+ // But the spec requires some form of user interaction, so we run a
196+ // dummy request, ignore the result and error out.
197+ warn ! ( "Preflight removed all credentials from the allow-list. Sending dummy request and erroring out." ) ;
198+ let dummy_request = Ctap2MakeCredentialRequest :: dummy ( ) ;
199+ self . send_state_update ( UxUpdate :: PresenceRequired ) . await ;
200+ let _ = self . ctap2_make_credential ( & dummy_request, op. timeout ) . await ;
201+ return Err ( Error :: Ctap ( CtapError :: NoCredentials ) ) ;
202+ }
203+ ctap2_request. allow = filtered_allow_list;
198204 }
199205
200- ctap2_request. allow = filtered_allow_list;
201206 let response = loop {
202207 let uv_auth_used =
203208 user_verification ( self , op. user_verification , & mut ctap2_request, op. timeout )
0 commit comments