From 65cb4bf4b23fdaa70c8dfe8ce2c78bd37816ab9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85berg?= Date: Thu, 14 Aug 2025 21:03:15 +0200 Subject: [PATCH] Add GetLockStatus --- .../src/com_provider.rs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) 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 cb48a7397b9..9c33bc689f4 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 @@ -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> { 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,