mirror of
https://github.com/bitwarden/browser
synced 2026-03-01 02:51:24 +00:00
Cleaned up user verification code
This commit is contained in:
@@ -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...
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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...
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user