1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-02 17:53:41 +00:00

Add GetLockStatus

This commit is contained in:
Anders Åberg
2025-08-14 21:03:15 +02:00
parent 6d12ed13cc
commit 65cb4bf4b2

View File

@@ -7,6 +7,14 @@ use crate::make_credential::experimental_plugin_make_credential;
use crate::util::debug_log;
use crate::webauthn::WEBAUTHN_CREDENTIAL_LIST;
/// Plugin lock status enum as defined in the IDL
#[repr(u32)]
#[derive(Debug, Copy, Clone)]
pub enum PluginLockStatus {
PluginLocked = 0,
PluginUnlocked = 1,
}
/// Used when creating and asserting credentials.
/// Header File Name: _EXPERIMENTAL_WEBAUTHN_PLUGIN_OPERATION_REQUEST
/// Header File Usage: EXPERIMENTAL_PluginMakeCredential()
@@ -22,6 +30,7 @@ pub struct ExperimentalWebAuthnPluginOperationRequest {
pub encoded_request_pointer: *mut u8,
}
/// Used as a response when creating and asserting credentials.
/// Header File Name: _EXPERIMENTAL_WEBAUTHN_PLUGIN_OPERATION_RESPONSE
/// Header File Usage: EXPERIMENTAL_PluginMakeCredential()
@@ -60,8 +69,13 @@ pub unsafe trait EXPERIMENTAL_IPluginAuthenticator: windows_core::IUnknown {
&self,
request: *const ExperimentalWebAuthnPluginCancelOperationRequest,
) -> HRESULT;
fn EXPERIMENTAL_GetLockStatus(
&self,
lock_status: *mut PluginLockStatus,
) -> HRESULT;
}
pub unsafe fn parse_credential_list(credential_list: &WEBAUTHN_CREDENTIAL_LIST) -> Vec<Vec<u8>> {
let mut allowed_credentials = Vec::new();
@@ -145,8 +159,22 @@ impl EXPERIMENTAL_IPluginAuthenticator_Impl for PluginAuthenticatorComObject_Imp
debug_log("EXPERIMENTAL_PluginCancelOperation() called");
HRESULT(0)
}
unsafe fn EXPERIMENTAL_GetLockStatus(
&self,
lock_status: *mut PluginLockStatus,
) -> HRESULT {
debug_log("EXPERIMENTAL_GetLockStatus() called");
if lock_status.is_null() {
return HRESULT(-2147024809); // E_INVALIDARG
}
// For now, always return unlocked
*lock_status = PluginLockStatus::PluginUnlocked;
HRESULT(0)
}
}
impl IClassFactory_Impl for Factory_Impl {
fn CreateInstance(
&self,