diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs index 8c1c78406f4..fe550984b26 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs @@ -7,16 +7,6 @@ use crate::types::*; use crate::utils::{self as util, delay_load}; use crate::com_provider::ExperimentalWebAuthnPluginOperationResponse; -// Authenticator Options from WebAuthn header -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct EXPERIMENTAL_WEBAUTHN_CTAPCBOR_AUTHENTICATOR_OPTIONS { - pub dwVersion: u32, - pub lUp: i32, // User presence: +1=TRUE, 0=Not defined, -1=FALSE - pub lUv: i32, // User verification: +1=TRUE, 0=Not defined, -1=FALSE - pub lRequireResidentKey: i32, // Resident key: +1=TRUE, 0=Not defined, -1=FALSE -} - // Windows API types for WebAuthn (from webauthn.h.sample) #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -30,7 +20,7 @@ pub struct EXPERIMENTAL_WEBAUTHN_CTAPCBOR_GET_ASSERTION_REQUEST { pub CredentialList: WEBAUTHN_CREDENTIAL_LIST, pub cbCborExtensionsMap: u32, pub pbCborExtensionsMap: *const u8, - pub pAuthenticatorOptions: *const EXPERIMENTAL_WEBAUTHN_CTAPCBOR_AUTHENTICATOR_OPTIONS, + pub pAuthenticatorOptions: *const crate::webauthn::ExperimentalWebAuthnCtapCborAuthenticatorOptions, // Add other fields as needed... } diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs index 8ff9812bab4..aac6486be3a 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs @@ -215,7 +215,7 @@ impl EXPERIMENTAL_IPluginAuthenticator_Impl for PluginAuthenticatorComObject_Imp // Extract user verification requirement from authenticator options let user_verification = if !decoded_request.pAuthenticatorOptions.is_null() { let auth_options = &*decoded_request.pAuthenticatorOptions; - match auth_options.lUv { + match auth_options.user_verification { 1 => Some(UserVerificationRequirement::Required), -1 => Some(UserVerificationRequirement::Discouraged), 0 | _ => Some(UserVerificationRequirement::Preferred), // Default or undefined @@ -352,7 +352,7 @@ impl EXPERIMENTAL_IPluginAuthenticator_Impl for PluginAuthenticatorComObject_Imp // Extract user verification requirement from authenticator options let user_verification = if !decoded_request.pAuthenticatorOptions.is_null() { let auth_options = &*decoded_request.pAuthenticatorOptions; - match auth_options.lUv { + match auth_options.user_verification { 1 => Some(UserVerificationRequirement::Required), -1 => Some(UserVerificationRequirement::Discouraged), 0 | _ => Some(UserVerificationRequirement::Preferred), // Default or undefined diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs index ac955a54812..10c15f4a01d 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs @@ -51,16 +51,6 @@ pub struct WEBAUTHN_CREDENTIAL_LIST { pub pCredentials: *const u8, // Placeholder } -// Authenticator Options from WebAuthn header -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct EXPERIMENTAL_WEBAUTHN_CTAPCBOR_AUTHENTICATOR_OPTIONS { - pub dwVersion: u32, - pub lUp: i32, // User presence: +1=TRUE, 0=Not defined, -1=FALSE - pub lUv: i32, // User verification: +1=TRUE, 0=Not defined, -1=FALSE - pub lRequireResidentKey: i32, // Resident key: +1=TRUE, 0=Not defined, -1=FALSE -} - // Make Credential Request structure (from sample header) #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -76,7 +66,7 @@ pub struct EXPERIMENTAL_WEBAUTHN_CTAPCBOR_MAKE_CREDENTIAL_REQUEST { pub CredentialList: WEBAUTHN_CREDENTIAL_LIST, pub cbCborExtensionsMap: u32, pub pbCborExtensionsMap: *const u8, - pub pAuthenticatorOptions: *const EXPERIMENTAL_WEBAUTHN_CTAPCBOR_AUTHENTICATOR_OPTIONS, + pub pAuthenticatorOptions: *const crate::webauthn::ExperimentalWebAuthnCtapCborAuthenticatorOptions, // Add other fields as needed... } diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs index 5a9c06e382f..65f94fccea6 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs @@ -15,6 +15,17 @@ use windows_core::*; use crate::util::*; use crate::com_buffer::ComBuffer; +/// Windows WebAuthn Authenticator Options structure +/// Header File Name: _EXPERIMENTAL_WEBAUTHN_CTAPCBOR_AUTHENTICATOR_OPTIONS +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ExperimentalWebAuthnCtapCborAuthenticatorOptions { + pub version: u32, // DWORD dwVersion + pub user_presence: i32, // LONG lUp: +1=TRUE, 0=Not defined, -1=FALSE + pub user_verification: i32, // LONG lUv: +1=TRUE, 0=Not defined, -1=FALSE + pub require_resident_key: i32, // LONG lRequireResidentKey: +1=TRUE, 0=Not defined, -1=FALSE +} + /// Used when adding a Windows plugin authenticator. /// Header File Name: _EXPERIMENTAL_WEBAUTHN_PLUGIN_ADD_AUTHENTICATOR_OPTIONS /// Header File Usage: EXPERIMENTAL_WebAuthNPluginAddAuthenticator()