@@ -11,8 +11,9 @@ use libwebauthn::proto::ctap2::{
1111} ;
1212use libwebauthn:: proto:: CtapError ;
1313use libwebauthn:: transport:: hid:: channel:: HidChannel ;
14+ use libwebauthn:: transport:: hid:: HidError ;
1415use libwebauthn:: transport:: { Channel , ChannelSettings , Device } ;
15- use libwebauthn:: webauthn:: { Error , WebAuthn } ;
16+ use libwebauthn:: webauthn:: { WebAuthn , WebAuthnError } ;
1617use libwebauthn:: UvUpdate ;
1718use libwebauthn_tests:: virt:: get_virtual_device;
1819use rand:: { thread_rng, Rng } ;
@@ -36,7 +37,7 @@ async fn make_credential_call(
3637 channel : & mut HidChannel < ' _ > ,
3738 user_id : & [ u8 ] ,
3839 exclude_list : Option < Vec < Ctap2PublicKeyCredentialDescriptor > > ,
39- ) -> Result < ( Ctap2PublicKeyCredentialDescriptor , [ u8 ; 32 ] ) , Error > {
40+ ) -> Result < ( Ctap2PublicKeyCredentialDescriptor , [ u8 ; 32 ] ) , WebAuthnError < HidError > > {
4041 make_credential_call_with_rp ( channel, user_id, exclude_list, "example.org" ) . await
4142}
4243
@@ -45,7 +46,7 @@ async fn make_credential_call_with_rp(
4546 user_id : & [ u8 ] ,
4647 exclude_list : Option < Vec < Ctap2PublicKeyCredentialDescriptor > > ,
4748 rp_id : & str ,
48- ) -> Result < ( Ctap2PublicKeyCredentialDescriptor , [ u8 ; 32 ] ) , Error > {
49+ ) -> Result < ( Ctap2PublicKeyCredentialDescriptor , [ u8 ; 32 ] ) , WebAuthnError < HidError > > {
4950 let challenge: [ u8 ; 32 ] = thread_rng ( ) . gen ( ) ;
5051 let make_credentials_request = MakeCredentialRequest {
5152 origin : rp_id. to_owned ( ) ,
@@ -70,7 +71,7 @@ async fn make_credential_call_with_rp(
7071async fn get_assertion_call (
7172 channel : & mut HidChannel < ' _ > ,
7273 allow_list : Vec < Ctap2PublicKeyCredentialDescriptor > ,
73- ) -> Result < GetAssertionResponse , Error > {
74+ ) -> Result < GetAssertionResponse , WebAuthnError < HidError > > {
7475 let challenge: [ u8 ; 32 ] = thread_rng ( ) . gen ( ) ;
7576 let get_assertion = GetAssertionRequest {
7677 origin : "example.org" . to_owned ( ) ,
@@ -175,7 +176,7 @@ async fn preflight_mixed_exclude_list() {
175176 let res = make_credential_call ( & mut channel, & user_id, Some ( exclude_list) ) . await ;
176177 assert ! ( matches!(
177178 res,
178- Err ( Error :: Ctap ( CtapError :: CredentialExcluded ) )
179+ Err ( WebAuthnError :: Ctap ( CtapError :: CredentialExcluded ) )
179180 ) ) ;
180181
181182 expected_uv_updates (
@@ -207,7 +208,10 @@ async fn preflight_no_allow_list() {
207208
208209 let allow_list = Vec :: new ( ) ;
209210 let res = get_assertion_call ( & mut channel, allow_list) . await ;
210- assert ! ( matches!( res, Err ( Error :: Ctap ( CtapError :: NoCredentials ) ) ) ) ;
211+ assert ! ( matches!(
212+ res,
213+ Err ( WebAuthnError :: Ctap ( CtapError :: NoCredentials ) )
214+ ) ) ;
211215
212216 expected_uv_updates (
213217 state_recv,
@@ -239,7 +243,10 @@ async fn preflight_nonsense_allow_list() {
239243 assert ! ( filtered_list. is_empty( ) ) ;
240244
241245 let res = get_assertion_call ( & mut channel, allow_list) . await ;
242- assert ! ( matches!( res, Err ( Error :: Ctap ( CtapError :: NoCredentials ) ) ) ) ;
246+ assert ! ( matches!(
247+ res,
248+ Err ( WebAuthnError :: Ctap ( CtapError :: NoCredentials ) )
249+ ) ) ;
243250
244251 expected_uv_updates (
245252 state_recv,
0 commit comments