### Asynchronous Fingerprint Enrollment with Callback Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Performs asynchronous fingerprint capture during enrollment and notifies completion via events. Ensure WinBiometric.EnrollCaptured event is subscribed before starting. ```csharp using WinBiometricDotNet; using System; using System.Threading; ManualResetEvent enrollEvent = new ManualResetEvent(false); // Subscribe to enrollment capture events WinBiometric.EnrollCaptured += (sender, args) => { CaptureEnrollResult result = args.CaptureEnrollResult; if (result.RejectDetail != 0) { Console.WriteLine($"Capture rejected: {result.RejectDetail}"); } else if (result.IsRequiredMoreData) { Console.WriteLine("Sample captured. More samples needed."); } else { Console.WriteLine("Enrollment capture complete!"); enrollEvent.Set(); } }; Session session = WinBiometric.OpenSession(); WinBiometric.AcquireFocus(); try { var unit = WinBiometric.EnumBiometricUnits().First(); WinBiometric.BeginEnroll(session, FingerPosition.RightThumb, unit.UnitId); Console.WriteLine("Place finger on sensor..."); // Start async capture WinBiometric.CaptureEnrollWithCallback(session); // Wait for completion (with timeout) if (enrollEvent.WaitOne(TimeSpan.FromSeconds(30))) { BiometricIdentity identity = WinBiometric.CommitEnroll(session); Console.WriteLine("Enrollment committed successfully."); } else { Console.WriteLine("Enrollment timed out."); WinBiometric.DiscardEnroll(session); } } finally { WinBiometric.ReleaseFocus(); WinBiometric.CloseSession(session); } ``` -------------------------------- ### Complete Fingerprint Enrollment Sequence Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Performs a full fingerprint enrollment: initializes enrollment, captures samples, and commits the template. Requires WinBiometricDotNet and System namespaces. Ensure focus is acquired before starting and released after completion or error. ```csharp using WinBiometricDotNet; using System; Session session = WinBiometric.OpenSession(); try { // Get available biometric units var units = WinBiometric.EnumBiometricUnits().ToList(); if (!units.Any()) { Console.WriteLine("No biometric units found."); return; } uint unitId = units.First().UnitId; FingerPosition fingerPosition = FingerPosition.RightIndex; Console.WriteLine($"Starting enrollment for {fingerPosition} on unit {unitId}"); // Acquire focus (required for enrollment) WinBiometric.AcquireFocus(); try { // Begin enrollment sequence WinBiometric.BeginEnroll(session, fingerPosition, unitId); // Capture fingerprint samples until enrollment is complete bool enrollmentComplete = false; int sampleCount = 0; while (!enrollmentComplete) { Console.WriteLine($"Place your {fingerPosition} finger on the sensor (sample {++sampleCount})..."); CaptureEnrollResult result = WinBiometric.CaptureEnroll(session); if (result.RejectDetail != 0) { Console.WriteLine($"Sample rejected: {result.RejectDetail}"); continue; } enrollmentComplete = !result.IsRequiredMoreData; if (result.IsRequiredMoreData) { Console.WriteLine("Sample accepted. More samples needed."); } } // Commit the enrollment BiometricIdentity identity = WinBiometric.CommitEnroll(session); Console.WriteLine("Enrollment successful!"); Console.WriteLine($"Identity Type: {identity.Type}"); if (identity.Sid != null) { Console.WriteLine($"Account SID: {identity.Sid.Value}"); } } catch (WinBiometricException ex) { Console.WriteLine($"Enrollment failed: {ex.Message}"); WinBiometric.DiscardEnroll(session); } finally { WinBiometric.ReleaseFocus(); } } finally { WinBiometric.CloseSession(session); } ``` -------------------------------- ### Enumerate Biometric Service Providers Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Lists installed biometric service providers (BSPs) that handle biometric operations. Requires WinBiometricDotNet namespace. ```csharp using WinBiometricDotNet; IEnumerable providers = WinBiometric.EnumServiceProviders(); foreach (BiometricServiceProvider provider in providers) { Console.WriteLine($"Provider: {provider.Description}"); Console.WriteLine($"Vendor: {provider.Vendor}"); Console.WriteLine($"Version: {provider.Version.MajorVersion}.{provider.Version.MinorVersion}"); Console.WriteLine($"Biometric Factor: {provider.BiometricFactor}"); } ``` -------------------------------- ### Get Windows Biometric Framework Configuration Settings Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Retrieves whether the Windows Biometric Framework is enabled, if biometric logon is active, and if domain biometric logon is configured. It also indicates the source of these settings (e.g., local policy, group policy). ```csharp using WinBiometricDotNet; using System; // Check if Windows Biometric Framework is enabled WinBiometric.GetEnabledSetting(out bool wbfEnabled, out SettingSourceType enabledSource); Console.WriteLine($"WBF Enabled: {wbfEnabled} (Source: {enabledSource})"); // Check if biometric logon is enabled WinBiometric.GetLogonSetting(out bool logonEnabled, out SettingSourceType logonSource); Console.WriteLine($"Biometric Logon: {logonEnabled} (Source: {logonSource})"); // Check if domain biometric logon is enabled WinBiometric.GetDomainLogonSetting(out bool domainEnabled, out SettingSourceType domainSource); Console.WriteLine($"Domain Biometric Logon: {domainEnabled} (Source: {domainSource})"); // Setting sources can be: // - SettingSourceType.Invalid (not configured) // - SettingSourceType.Default (system default) // - SettingSourceType.Local (local policy) // - SettingSourceType.Gpo (group policy) ``` -------------------------------- ### WinBiometric.EnumServiceProviders Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Enumerates installed biometric service providers (BSPs) that handle biometric operations. This function returns a collection of BiometricServiceProvider objects, each providing information about a BSP. ```APIDOC ## WinBiometric.EnumServiceProviders ### Description Enumerates installed biometric service providers (BSPs) that handle biometric operations. ### Method GET (conceptual, as this is a library function) ### Endpoint N/A (Library function) ### Parameters None ### Request Example ```csharp using WinBiometricDotNet; IEnumerable providers = WinBiometric.EnumServiceProviders(); foreach (BiometricServiceProvider provider in providers) { Console.WriteLine($"Provider: {provider.Description}"); Console.WriteLine($"Vendor: {provider.Vendor}"); Console.WriteLine($"Version: {provider.Version.MajorVersion}.{provider.Version.MinorVersion}"); Console.WriteLine($"Biometric Factor: {provider.BiometricFactor}"); } ``` ### Response #### Success Response (Collection of BiometricServiceProvider) - **Description** (string) - A description of the biometric service provider. - **Vendor** (string) - The vendor of the biometric service provider. - **Version** (object) - The version of the biometric service provider. - **MajorVersion** (ushort) - The major version number. - **MinorVersion** (ushort) - The minor version number. - **BiometricFactor** (uint) - The type of biometric factor supported by the provider. #### Response Example (Output from the C# code example) ``` -------------------------------- ### Get Enrolled Biometric Factors for a User Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Retrieves the types of biometric factors (e.g., fingerprint, facial recognition, iris) that a user has enrolled on the system. Requires opening a session and acquiring focus. ```csharp using WinBiometricDotNet; using System; Session session = WinBiometric.OpenSession(); try { WinBiometric.AcquireFocus(); IdentifyResult result = WinBiometric.Identify(session); WinBiometric.ReleaseFocus(); BiometricTypes enrolledFactors = WinBiometric.GetEnrolledFactors(result.Identity); Console.WriteLine($"Enrolled biometric factors for user:"); if (enrolledFactors.HasFlag(BiometricTypes.Fingerprint)) Console.WriteLine(" - Fingerprint"); if (enrolledFactors.HasFlag(BiometricTypes.FacialFeatures)) Console.WriteLine(" - Facial Recognition"); if (enrolledFactors.HasFlag(BiometricTypes.Iris)) Console.WriteLine(" - Iris"); if (enrolledFactors == BiometricTypes.NoAvailable) Console.WriteLine(" No biometrics enrolled."); } finally { WinBiometric.CloseSession(session); } ``` -------------------------------- ### WinBiometric.GetEnrolledFactors Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Gets information about which biometric types a user has enrolled on the system. ```APIDOC ## WinBiometric.GetEnrolledFactors ### Description Gets information about which biometric types a user has enrolled on the system. ### Method `GetEnrolledFactors` ### Endpoint N/A (This is a library function, not a web endpoint) ### Parameters - `identity` (BiometricIdentity): The identity of the user for whom to retrieve enrolled factors. ### Return Value - `BiometricTypes`: A bitmask indicating the enrolled biometric types (Fingerprint, FacialFeatures, Iris, NoAvailable). ### Example Usage (C#) ```csharp using WinBiometricDotNet; using System; Session session = WinBiometric.OpenSession(); try { WinBiometric.AcquireFocus(); IdentifyResult result = WinBiometric.Identify(session); WinBiometric.ReleaseFocus(); BiometricTypes enrolledFactors = WinBiometric.GetEnrolledFactors(result.Identity); Console.WriteLine($"Enrolled biometric factors for user:"); if (enrolledFactors.HasFlag(BiometricTypes.Fingerprint)) Console.WriteLine(" - Fingerprint"); if (enrolledFactors.HasFlag(BiometricTypes.FacialFeatures)) Console.WriteLine(" - Facial Recognition"); if (enrolledFactors.HasFlag(BiometricTypes.Iris)) Console.WriteLine(" - Iris"); if (enrolledFactors == BiometricTypes.NoAvailable) Console.WriteLine(" No biometrics enrolled."); } finally { WinBiometric.CloseSession(session); } ``` ``` -------------------------------- ### Open Asynchronous Biometric Session with Callbacks Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Opens an asynchronous session that delivers results via callbacks. Subscribe to AsyncCompleted events before opening the session. ```csharp using WinBiometricDotNet; // Subscribe to async completion events before opening session WinBiometric.AsyncCompleted += (sender, args) => { Console.WriteLine($"Async operation completed: {args.OperationType}"); }; // Open async session with user data context IntPtr userData = IntPtr.Zero; Session asyncSession = WinBiometric.OpenSession(userData); try { Console.WriteLine($"Async session opened. Handle: {asyncSession.Handle}"); Console.WriteLine($"Is Asynchronous: {asyncSession.IsAsynchronous}"); // Wait for pending operations to complete WinBiometric.Wait(asyncSession); } finally { WinBiometric.CloseSession(asyncSession); } ``` -------------------------------- ### User Logon with Biometric Identification Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Performs fast user switching by identifying the last user with the biometric sensor and then attempting to log them in. Requires opening a session, acquiring focus, and handling potential exceptions. ```csharp using WinBiometricDotNet; using System; Session session = WinBiometric.OpenSession(); try { WinBiometric.AcquireFocus(); Console.WriteLine("Place finger on sensor to identify and switch user..."); // First identify the user IdentifyResult result = WinBiometric.Identify(session); Console.WriteLine($"User identified: {result.Identity.Sid?.Value}"); Console.WriteLine("Attempting fast user switch..."); // Attempt to switch to the identified user bool switched = WinBiometric.LogonIdentifiedUser(session); if (switched) { Console.WriteLine("Fast user switch initiated."); } else { Console.WriteLine("Already logged in as this user."); } } catch (WinBiometricException ex) { Console.WriteLine($"Logon failed: {ex.Message}"); } finally { WinBiometric.ReleaseFocus(); WinBiometric.CloseSession(session); } ``` -------------------------------- ### WinBiometric.CaptureSampleWithCallback Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Captures biometric samples asynchronously with event-based notification. ```APIDOC ## WinBiometric.CaptureSampleWithCallback ### Description Captures biometric samples asynchronously with event-based notification. ### Method POST (Implied, as it's an asynchronous capture operation) ### Endpoint /winbiometric/capture/async ### Parameters #### Query Parameters - **session** (Session) - Required - The active biometric session. - **purpose** (Purpose) - Required - The purpose of the capture (e.g., Purpose.NoPurposeAvailable). - **flags** (DataFlags) - Required - Flags to specify data format (e.g., DataFlags.Raw). ### Request Example ```csharp Session session = WinBiometric.OpenSession(); WinBiometric.CaptureSampleWithCallback(session, Purpose.NoPurposeAvailable, DataFlags.Raw); ``` ### Response #### Success Response (200) This method initiates an asynchronous operation. Results are delivered via the `SampleCaptured` event. #### Response Example (No direct response body for the initial call; events provide results) ### Event Handling - **SampleCaptured** (event) - Triggered when a biometric sample is captured. - **args** (CaptureSampleEventArgs) - Event arguments containing the capture result. - **CaptureSampleResult** (object) - Contains the captured sample data and related information (same structure as `WinBiometric.CaptureSample`). ``` -------------------------------- ### Capture Raw Fingerprint Sample with WinBiometric Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Captures raw fingerprint image data from a biometric sensor. Ensure the WinBiometric library is imported and a session is open. The captured image is saved to a file named 'fingerprint_sample.raw'. ```csharp using WinBiometricDotNet; using System; using System.IO; Session session = WinBiometric.OpenSession(); try { WinBiometric.AcquireFocus(); Console.WriteLine("Place finger on sensor to capture sample..."); CaptureSampleResult result = WinBiometric.CaptureSample( session, Purpose.NoPurposeAvailable, DataFlags.Raw ); Console.WriteLine($ ``` -------------------------------- ### WinBiometric Configuration Settings Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Retrieves Windows Biometric Framework configuration settings including whether the framework is enabled, if biometric logon is active, and if domain biometric logon is configured. ```APIDOC ## WinBiometric.GetEnabledSetting / GetLogonSetting / GetDomainLogonSetting ### Description Retrieves Windows Biometric Framework configuration settings. ### Methods - `GetEnabledSetting`: Checks if the Windows Biometric Framework is enabled. - `GetLogonSetting`: Checks if biometric logon is enabled for the current user. - `GetDomainLogonSetting`: Checks if biometric logon is enabled for domain users. ### Parameters None for these methods, they output boolean values and source types. ### Return Values - `wbfEnabled` (bool): True if the WBF is enabled, false otherwise. - `logonEnabled` (bool): True if biometric logon is enabled, false otherwise. - `domainEnabled` (bool): True if domain biometric logon is enabled, false otherwise. - `enabledSource`, `logonSource`, `domainSource` (SettingSourceType): Indicates the source of the setting (Invalid, Default, Local, Gpo). ### Setting Sources - `SettingSourceType.Invalid`: Not configured. - `SettingSourceType.Default`: System default. - `SettingSourceType.Local`: Local policy. - `SettingSourceType.Gpo`: Group policy. ### Example Usage (C#) ```csharp using WinBiometricDotNet; using System; // Check if Windows Biometric Framework is enabled WinBiometric.GetEnabledSetting(out bool wbfEnabled, out SettingSourceType enabledSource); Console.WriteLine($"WBF Enabled: {wbfEnabled} (Source: {enabledSource})"); // Check if biometric logon is enabled WinBiometric.GetLogonSetting(out bool logonEnabled, out SettingSourceType logonSource); Console.WriteLine($"Biometric Logon: {logonEnabled} (Source: {logonSource})"); // Check if domain biometric logon is enabled WinBiometric.GetDomainLogonSetting(out bool domainEnabled, out SettingSourceType domainSource); Console.WriteLine($"Domain Biometric Logon: {domainEnabled} (Source: {domainSource})"); ``` ``` -------------------------------- ### Asynchronous Fingerprint Sample Capture with WinBiometric Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Captures biometric samples asynchronously using event-based notifications. A ManualResetEvent is used to signal completion. The capture operation has a timeout of 15 seconds. ```csharp using WinBiometricDotNet; using System; using System.Threading; ManualResetEvent captureComplete = new ManualResetEvent(false); WinBiometric.SampleCaptured += (sender, args) => { CaptureSampleResult result = args.CaptureSampleResult; Console.WriteLine($"Sample captured asynchronously"); Console.WriteLine($"Unit ID: {result.UnitId}"); Console.WriteLine($"Size: {result.SampleSize} bytes"); if (result.Sample != null) { Console.WriteLine($"Image: {result.Sample.Width}x{result.Sample.Height}"); } captureComplete.Set(); }; Session session = WinBiometric.OpenSession(); WinBiometric.AcquireFocus(); try { Console.WriteLine("Starting async capture. Place finger on sensor..."); WinBiometric.CaptureSampleWithCallback(session, Purpose.NoPurposeAvailable, DataFlags.Raw); if (!captureComplete.WaitOne(TimeSpan.FromSeconds(15))) { Console.WriteLine("Capture timed out."); WinBiometric.Cancel(session); } } finally { WinBiometric.ReleaseFocus(); WinBiometric.CloseSession(session); } ``` -------------------------------- ### Fingerprint Verification (1:1) Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Performs 1:1 verification to confirm a captured fingerprint matches an enrolled finger. Requires focus acquisition and an open session. ```csharp using WinBiometricDotNet; using System; Session session = WinBiometric.OpenSession(); try { WinBiometric.AcquireFocus(); Console.WriteLine("Place your right index finger on the sensor for verification..."); VerifyResult result = WinBiometric.Verify(session, FingerPosition.RightIndex); Console.WriteLine($"Verification Result:"); Console.WriteLine($" Match: {result.IsMatch}"); Console.WriteLine($" Unit ID: {result.UnitId}"); Console.WriteLine($" Operation Status: 0x{result.OperationStatus:X8}"); if (result.RejectDetail != 0) { Console.WriteLine($" Reject Detail: {result.RejectDetail}"); } if (result.IsMatch) { Console.WriteLine("Identity verified successfully!"); } else { Console.WriteLine("Verification failed - fingerprint does not match."); } } catch (WinBiometricException ex) { Console.WriteLine($"Verification error: {ex.Message}"); } finally { WinBiometric.ReleaseFocus(); WinBiometric.CloseSession(session); } ``` -------------------------------- ### WinBiometric.CaptureEnrollWithCallback Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Performs asynchronous fingerprint capture during enrollment with event-based completion notification. ```APIDOC ## WinBiometric.CaptureEnrollWithCallback ### Description Performs asynchronous fingerprint capture during enrollment with event-based completion notification. ### Method POST (Implied, as it initiates an asynchronous operation) ### Endpoint Not applicable (This is a library function, not a REST endpoint) ### Parameters None directly passed to this method, relies on event handlers and prior session/unit setup. ### Request Example ```csharp // Example usage within a larger enrollment process WinBiometric.CaptureEnrollWithCallback(session); ``` ### Response This method is callback-based. Results are handled via the `WinBiometric.EnrollCaptured` event. #### Success Response (Event Data) - **CaptureEnrollResult** (object) - Contains details about the captured sample, including rejection information and whether more data is required. #### Response Example (Event Data) ```json { "RejectDetail": 0, // 0 indicates no rejection "IsRequiredMoreData": true // or false if enrollment is complete } ``` ``` -------------------------------- ### WinBiometric.CreateDatabase / RemoveDatabase Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Demonstrates how to create and remove custom biometric template databases for private application use. ```APIDOC ## WinBiometric.CreateDatabase / RemoveDatabase ### Description Creates and removes custom biometric template databases for private application use. ### Method POST (for CreateDatabase), DELETE (for RemoveDatabase) ### Endpoint `/api/biometric/database` (conceptual, actual implementation is via library calls) ### Parameters #### Path Parameters None #### Query Parameters - **unit** (BiometricUnit) - Required - The biometric unit to associate the database with. #### Request Body None for CreateDatabase. For RemoveDatabase, the database ID is passed as a parameter. ### Request Example ```csharp using WinBiometricDotNet; using System; var units = WinBiometric.EnumBiometricUnits().ToList(); if (!units.Any()) { return; } BiometricUnit unit = units.First(); // Create a new private database Guid databaseId = WinBiometric.CreateDatabase(unit); Console.WriteLine($"Database created with ID: {databaseId}"); // Remove the database when no longer needed WinBiometric.RemoveDatabase(unit, databaseId); Console.WriteLine("Database removed."); ``` ### Response #### Success Response (200) - **databaseId** (Guid) - The unique identifier of the newly created database. #### Response Example ```json { "databaseId": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ``` -------------------------------- ### Perform Async Verification with Callback Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Use VerifyWithCallback for asynchronous 1:1 fingerprint verification. It notifies results via the Verified event. Ensure the session is properly managed and focus is acquired/released. ```csharp using WinBiometricDotNet; using System; using System.Threading; ManualResetEvent verifyComplete = new ManualResetEvent(false); bool verificationResult = false; WinBiometric.Verified += (sender, args) => { VerifyResult result = args.VerifyResult; verificationResult = result.IsMatch; Console.WriteLine($"Async verification complete: {(result.IsMatch ? "MATCH" : "NO MATCH")}"); if (result.RejectDetail != 0) { Console.WriteLine($"Reject reason: {result.RejectDetail}"); } verifyComplete.Set(); }; Session session = WinBiometric.OpenSession(); WinBiometric.AcquireFocus(); try { Console.WriteLine("Starting async verification. Place finger on sensor..."); WinBiometric.VerifyWithCallback(session, FingerPosition.RightIndex); // Wait for async result if (verifyComplete.WaitOne(TimeSpan.FromSeconds(15))) { Console.WriteLine($"Final result: {(verificationResult ? "Authenticated" : "Not Authenticated")}"); } else { Console.WriteLine("Verification timed out."); WinBiometric.Cancel(session); } } finally { WinBiometric.ReleaseFocus(); WinBiometric.CloseSession(session); } ``` -------------------------------- ### Enumerate Biometric Databases Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Lists all registered biometric template databases on the system. Requires WinBiometricDotNet namespace. ```csharp using WinBiometricDotNet; IEnumerable databases = WinBiometric.EnumBiometricDatabases(); foreach (BiometricDatabase db in databases) { Console.WriteLine($"Database ID: {db.DatabaseId}"); Console.WriteLine($"Data Format: {db.DataFormat}"); Console.WriteLine($"File Path: {db.FilePath}"); Console.WriteLine($"Attributes: {db.Attributes}"); Console.WriteLine(); } ``` -------------------------------- ### WinBiometricDotNet API Functions Source: https://github.com/takuya-takeuchi/winbiometricdotnet/blob/master/README.md This section lists all supported API functions within the WinBiometricDotNet library, indicating their support status across Windows 7, 8, and 10. ```APIDOC ## WinBiometricDotNet API Functions ### Description This table outlines the available functions in the WinBiometricDotNet library and their compatibility with Windows 7, 8, and 10. ### Function Support Table | Function | Support | Win 7 | Win 8 | Win 10 | Note | |---------------------------------|:-------:|:-----:|:-----:|:------:|---------------| | WinBioAcquireFocus | ✓ | ✓ | ✓ | ✓ | | | WinBioAsyncEnumBiometricUnits | ✓ | | ✓ | ✓ | | | WinBioAsyncEnumDatabases | ✓ | | ✓ | ✓ | | | WinBioAsyncEnumServiceProviders | ✓ | | ✓ | ✓ | | | WinBioAsyncMonitorFrameworkChanges| ✓ | | ✓ | ✓ | | | WinBioAsyncOpenFramework | ✓ | | ✓ | ✓ | | | WinBioAsyncOpenSession | ✓ | | ✓ | ✓ | | | WinBioCancel | ✓ | ✓ | ✓ | ✓ | | | WinBioCaptureSample | ✓ | ✓ | ✓ | ✓ | | | WinBioCaptureSampleWithCallback | ✓ | ✓ | ✓ | ✓ | | | WinBioCloseFramework | ✓ | | ✓ | ✓ | | | WinBioCloseSession | ✓ | ✓ | ✓ | ✓ | | | WinBioControlUnit | ✓ | ✓ | ✓ | ✓ | | | WinBioControlUnitPrivileged | ✓ | ✓ | ✓ | ✓ | | | WinBioDeleteTemplate | ✓ | ✓ | ✓ | ✓ | | | WinBioEnrollBegin | ✓ | ✓ | ✓ | ✓ | | | WinBioEnrollCapture | ✓ | ✓ | ✓ | ✓ | | | WinBioEnrollCaptureWithCallback | ✓ | ✓ | ✓ | ✓ | | | WinBioEnrollCommit | ✓ | ✓ | ✓ | ✓ | | | WinBioEnrollDiscard | ✓ | ✓ | ✓ | ✓ | | | WinBioEnrollSelect | ✓ | | | ✓ | | | WinBioEnumBiometricUnits | ✓ | ✓ | ✓ | ✓ | | | WinBioEnumDatabases | ✓ | ✓ | ✓ | ✓ | | | WinBioEnumEnrollments | ✓ | ✓ | ✓ | ✓ | | | WinBioEnumServiceProviders | ✓ | ✓ | ✓ | ✓ | | | WinBioFree | ✓ | ✓ | ✓ | ✓ | Internal use only | | WinBioGetCredentialState | ✓ | ✓ | ✓ | ✓ | | | WinBioGetDomainLogonSetting | ✓ | ✓ | ✓ | ✓ | | | WinBioGetEnabledSetting | ✓ | ✓ | ✓ | ✓ | | | WinBioGetEnrolledFactors | ✓ | | | ✓ | | | WinBioGetLogonSetting | ✓ | ✓ | ✓ | ✓ | | | WinBioGetProperty | ✓ | ✓ | ✓ | ✓ | | | WinBioIdentify | ✓ | ✓ | ✓ | ✓ | | | WinBioIdentifyWithCallback | ✓ | ✓ | ✓ | ✓ | | | WinBioLocateSensor | ✓ | ✓ | ✓ | ✓ | | | WinBioLocateSensorWithCallback | ✓ | ✓ | ✓ | ✓ | | | WinBioLockUnit | ✓ | ✓ | ✓ | ✓ | | | WinBioLogonIdentifiedUser | ✓ | ✓ | ✓ | ✓ | | | WinBioMonitorPresence | ✓ | | | ✓ | | | WinBioOpenSession | ✓ | ✓ | ✓ | ✓ | | | WinBioRegisterEventMonitor | ✓ | ✓ | ✓ | ✓ | | | WinBioReleaseFocus | ✓ | ✓ | ✓ | ✓ | | | WinBioRemoveAllCredentials | ✓ | ✓ | ✓ | ✓ | | | WinBioRemoveAllDomainCredentials| ✓ | ✓ | ✓ | ✓ | | | WinBioRemoveCredential | ✓ | ✓ | ✓ | ✓ | | | WinBioSetCredential | ✓ | ✓ | ✓ | ✓ | | | WinBioSetProperty | ✓ | | | ✓ | | | WinBioUnlockUnit | ✓ | ✓ | ✓ | ✓ | | | WinBioUnregisterEventMonitor | ✓ | ✓ | ✓ | ✓ | | | WinBioVerify | ✓ | ✓ | ✓ | ✓ | | | WinBioVerifyWithCallback | ✓ | ✓ | ✓ | ✓ | | | WinBioWait | ✓ | ✓ | ✓ | ✓ | | ``` -------------------------------- ### Open Asynchronous Biometric Session with Window Messages Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Opens an asynchronous session that posts Windows messages to a target window for completion notifications. Requires a window handle and a custom message code. ```csharp using WinBiometricDotNet; using System; // For WPF or WinForms applications IntPtr windowHandle = /* your window handle */; uint customMessageCode = 0x8000; // WM_APP range Session session = WinBiometric.OpenSession(windowHandle, customMessageCode); // Handle completion messages in your window procedure // The lParam will contain a pointer to WINBIO_ASYNC_RESULT WinBiometric.CloseSession(session); ``` -------------------------------- ### Fingerprint Enrollment Sequence Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Performs a complete fingerprint enrollment sequence, including beginning enrollment, capturing samples, and committing the template to the database. This involves multiple library calls to manage the enrollment process. ```APIDOC ## Fingerprint Enrollment ### WinBiometric.BeginEnroll / CaptureEnroll / CommitEnroll ### Description Performs a complete fingerprint enrollment sequence: initializes enrollment, captures samples, and commits the template to the database. ### Method POST (conceptual, as this is a sequence of library functions) ### Endpoint N/A (Library functions) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Implicitly handled by library functions and system interactions) ### Request Example ```csharp using WinBiometricDotNet; using System; Session session = WinBiometric.OpenSession(); try { // Get available biometric units var units = WinBiometric.EnumBiometricUnits().ToList(); if (!units.Any()) { Console.WriteLine("No biometric units found."); return; } uint unitId = units.First().UnitId; FingerPosition fingerPosition = FingerPosition.RightIndex; Console.WriteLine($"Starting enrollment for {fingerPosition} on unit {unitId}"); // Acquire focus (required for enrollment) WinBiometric.AcquireFocus(); try { // Begin enrollment sequence WinBiometric.BeginEnroll(session, fingerPosition, unitId); // Capture fingerprint samples until enrollment is complete bool enrollmentComplete = false; int sampleCount = 0; while (!enrollmentComplete) { Console.WriteLine($"Place your {fingerPosition} finger on the sensor (sample {++sampleCount})..."); CaptureEnrollResult result = WinBiometric.CaptureEnroll(session); if (result.RejectDetail != 0) { Console.WriteLine($"Sample rejected: {result.RejectDetail}"); continue; } enrollmentComplete = !result.IsRequiredMoreData; if (result.IsRequiredMoreData) { Console.WriteLine("Sample accepted. More samples needed."); } } // Commit the enrollment BiometricIdentity identity = WinBiometric.CommitEnroll(session); Console.WriteLine("Enrollment successful!"); Console.WriteLine($"Identity Type: {identity.Type}"); if (identity.Sid != null) { Console.WriteLine($"Account SID: {identity.Sid.Value}"); } } catch (WinBiometricException ex) { Console.WriteLine($"Enrollment failed: {ex.Message}"); WinBiometric.DiscardEnroll(session); } finally { WinBiometric.ReleaseFocus(); } } finally { WinBiometric.CloseSession(session); } ``` ### Response #### Success Response (BiometricIdentity) - **Type** (BiometricIdentityType) - The type of the enrolled biometric identity. - **Sid** (SecurityIdentifier) - The Security Identifier (SID) of the account associated with the identity, if available. #### Response Example ```json { "Type": "Account", "Sid": "S-1-5-21-..." } ``` #### Error Handling - **WinBiometricException**: Thrown if an error occurs during the enrollment process. The exception message will provide details. ``` -------------------------------- ### Set Biometric Password Credential Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Sets a password credential for biometric logon. Requires the password to be encoded as a byte array. ```csharp using WinBiometricDotNet; using System; using System.Text; // Set credential for biometric logon byte[] passwordCredential = Encoding.Unicode.GetBytes("UserPassword"); WinBiometric.SetCredential( CredentialTypes.Password, passwordCredential, CredentialFormat.Generic ); Console.WriteLine("Credential set successfully."); // Check credential state for a user Session session = WinBiometric.OpenSession(); try { // First identify the user to get their identity WinBiometric.AcquireFocus(); IdentifyResult result = WinBiometric.Identify(session); WinBiometric.ReleaseFocus(); BiometricIdentity identity = result.Identity; CredentialState state = WinBiometric.GetCredentialState(identity, CredentialTypes.Password); Console.WriteLine($"Credential state: {state}"); } finally { WinBiometric.CloseSession(session); } ``` -------------------------------- ### Open Synchronous Biometric Session Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Opens a synchronous connection to the Windows Biometric Framework service. Ensure to close the session when done. ```csharp using WinBiometricDotNet; // Open a synchronous biometric session Session session = WinBiometric.OpenSession(); try { // Enumerate all enrolled fingerprints for the current user var units = WinBiometric.EnumBiometricUnits(); foreach (var unit in units) { Console.WriteLine($"Found biometric unit: {unit.Description}"); Console.WriteLine($" Manufacturer: {unit.Manufacturer}"); Console.WriteLine($" Model: {unit.Model}"); Console.WriteLine($" Unit ID: {unit.UnitId}"); } } finally { // Always close the session when done WinBiometric.CloseSession(session); } ``` -------------------------------- ### Open and Monitor Windows Biometric Framework Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Opens a handle to the Windows Biometric Framework for advanced asynchronous operations and monitoring. It allows subscribing to framework change events and performing asynchronous enumerations. ```csharp using WinBiometricDotNet; using System; // Subscribe to async completion events WinBiometric.AsyncCompleted += (sender, args) => { Console.WriteLine($"Framework async operation completed"); Console.WriteLine($"Operation Type: {args.OperationType}"); }; IntPtr userData = IntPtr.Zero; Framework framework = WinBiometric.OpenFramework(userData); try { Console.WriteLine($"Framework opened. Handle: {framework.Handle}"); // Perform async enumeration through framework handle WinBiometric.AsyncEnumBiometricUnits(framework, BiometricTypes.Fingerprint); WinBiometric.AsyncEnumDatabases(framework, BiometricTypes.Fingerprint); WinBiometric.AsyncEnumServiceProviders(framework, BiometricTypes.Fingerprint); // Monitor framework changes WinBiometric.AsyncMonitorFrameworkChanges(framework, ChangeTypes.UnitArrival | ChangeTypes.UnitRemoval); Console.WriteLine("Monitoring framework changes. Plug/unplug a biometric device..."); Console.ReadKey(true); } finally { WinBiometric.CloseFramework(framework); Console.WriteLine("Framework closed."); } ``` -------------------------------- ### Create and Remove Biometric Database Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Creates a new private biometric template database for application use and removes it when no longer needed. Ensure biometric units are available before attempting to create a database. ```csharp using WinBiometricDotNet; using System; var units = WinBiometric.EnumBiometricUnits().ToList(); if (!units.Any()) { Console.WriteLine("No biometric units available."); return; } BiometricUnit unit = units.First(); // Create a new private database Guid databaseId = WinBiometric.CreateDatabase(unit); Console.WriteLine($"Database created with ID: {databaseId}"); // Verify the database was created var databases = WinBiometric.EnumBiometricDatabases(); var newDb = databases.FirstOrDefault(d => d.DatabaseId == databaseId); if (newDb != null) { Console.WriteLine($"Database verified:"); Console.WriteLine($" Path: {newDb.FilePath}"); Console.WriteLine($" Format: {newDb.DataFormat}"); } // Remove the database when no longer needed WinBiometric.RemoveDatabase(unit, databaseId); Console.WriteLine("Database removed."); ``` -------------------------------- ### WinBiometric.CaptureSample Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Captures raw biometric sample data (fingerprint image) without performing verification or identification. ```APIDOC ## WinBiometric.CaptureSample ### Description Captures raw biometric sample data (fingerprint image) without performing verification or identification. ### Method POST (Implied, as it's a capture operation) ### Endpoint /winbiometric/capture ### Parameters #### Query Parameters - **session** (Session) - Required - The active biometric session. - **purpose** (Purpose) - Required - The purpose of the capture (e.g., Purpose.NoPurposeAvailable). - **flags** (DataFlags) - Required - Flags to specify data format (e.g., DataFlags.Raw). ### Request Example ```csharp Session session = WinBiometric.OpenSession(); WinBiometric.CaptureSample(session, Purpose.NoPurposeAvailable, DataFlags.Raw); ``` ### Response #### Success Response (200) - **CaptureSampleResult** (object) - Contains the captured sample data and related information. - **UnitId** (uint) - The ID of the biometric unit used for capture. - **SampleSize** (uint) - The size of the captured sample in bytes. - **Sample** (CaptureSample) - The captured biometric sample data. - **Width** (int) - Image width in pixels. - **Height** (int) - Image height in pixels. - **HorizontalImageResolution** (int) - Horizontal resolution in DPI. - **VerticalImageResolution** (int) - Vertical resolution in DPI. - **HorizontalScanResolution** (int) - Horizontal scan resolution. - **VerticalScanResolution** (int) - Vertical scan resolution. - **Image** (byte[]) - Raw image data. - **RejectDetail** (uint) - Information about capture issues, if any. #### Response Example ```json { "UnitId": 1, "SampleSize": 10240, "Sample": { "Width": 256, "Height": 320, "HorizontalImageResolution": 500, "VerticalImageResolution": 500, "HorizontalScanResolution": 500, "VerticalScanResolution": 500, "Image": "...base64_encoded_image_data..." }, "RejectDetail": 0 } ``` ``` -------------------------------- ### WinBiometric.Verify Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Performs 1:1 verification to confirm that a captured fingerprint matches the specified enrolled finger of the current user. ```APIDOC ## WinBiometric.Verify ### Description Performs 1:1 verification to confirm that a captured fingerprint matches the specified enrolled finger of the current user. ### Method POST (Implied, as it initiates a verification process) ### Endpoint Not applicable (This is a library function, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **session** (Session) - The current biometric session object. - **fingerPosition** (FingerPosition) - The enrolled finger position to verify against. ### Request Example ```csharp // Example usage for fingerprint verification Console.WriteLine("Place your right index finger on the sensor for verification..."); VerifyResult result = WinBiometric.Verify(session, FingerPosition.RightIndex); ``` ### Response #### Success Response (200) - **VerifyResult** (object) - An object containing the verification outcome. - **IsMatch** (bool) - True if the fingerprint matches the enrolled template, false otherwise. - **UnitId** (uint) - The ID of the biometric unit used for verification. - **OperationStatus** (uint) - The status code of the operation. - **RejectDetail** (uint) - Details if the capture was rejected (0 if not rejected). #### Response Example ```json { "IsMatch": true, "UnitId": 1, "OperationStatus": 0, "RejectDetail": 0 } ``` ``` -------------------------------- ### Session Management Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt APIs for opening and closing biometric sessions. ```APIDOC ## WinBiometric.OpenSession ### Description Opens a synchronous connection to the Windows Biometric Framework service and returns a Session handle for subsequent biometric operations. ### Method `WinBiometric.OpenSession()` ### Endpoint N/A (Library function) ### Request Example ```csharp using WinBiometricDotNet; // Open a synchronous biometric session Session session = WinBiometric.OpenSession(); ``` ### Response #### Success Response (Session Handle) - **session** (Session) - A handle to the opened biometric session. ### Response Example ```csharp Session session = WinBiometric.OpenSession(); ``` ## WinBiometric.OpenSession with Async Callbacks ### Description Opens an asynchronous session that delivers results via callbacks, suitable for non-blocking UI applications. ### Method `WinBiometric.OpenSession(IntPtr userData)` ### Endpoint N/A (Library function) ### Parameters #### Request Body - **userData** (IntPtr) - Optional user data context for callbacks. ### Request Example ```csharp using WinBiometricDotNet; // Subscribe to async completion events before opening session WinBiometric.AsyncCompleted += (sender, args) => { Console.WriteLine($"Async operation completed: {args.OperationType}"); }; // Open async session with user data context IntPtr userData = IntPtr.Zero; Session asyncSession = WinBiometric.OpenSession(userData); ``` ### Response #### Success Response (Session Handle) - **asyncSession** (Session) - A handle to the opened asynchronous biometric session. ### Response Example ```csharp IntPtr userData = IntPtr.Zero; Session asyncSession = WinBiometric.OpenSession(userData); ``` ## WinBiometric.OpenSession with Window Messages ### Description Opens an asynchronous session that posts Windows messages to a target window for completion notifications. ### Method `WinBiometric.OpenSession(IntPtr windowHandle, uint customMessageCode)` ### Endpoint N/A (Library function) ### Parameters #### Request Body - **windowHandle** (IntPtr) - The handle of the target window to receive messages. - **customMessageCode** (uint) - A custom message code to identify biometric completion notifications. ### Request Example ```csharp using WinBiometricDotNet; using System; // For WPF or WinForms applications IntPtr windowHandle = /* your window handle */; uint customMessageCode = 0x8000; // WM_APP range Session session = WinBiometric.OpenSession(windowHandle, customMessageCode); ``` ### Response #### Success Response (Session Handle) - **session** (Session) - A handle to the opened asynchronous biometric session. ### Response Example ```csharp IntPtr windowHandle = /* your window handle */; uint customMessageCode = 0x8000; Session session = WinBiometric.OpenSession(windowHandle, customMessageCode); ``` ## WinBiometric.CloseSession ### Description Closes an active biometric session, releasing associated resources. ### Method `WinBiometric.CloseSession(Session session)` ### Endpoint N/A (Library function) ### Parameters #### Request Body - **session** (Session) - The session handle to close. ### Request Example ```csharp // Assuming 'session' is an active Session object WinBiometric.CloseSession(session); ``` ### Response #### Success Response (Void) This method does not return a value upon successful execution. ### Response Example ```csharp WinBiometric.CloseSession(session); ``` ``` -------------------------------- ### WinBiometric.SetCredential / GetCredentialState Source: https://context7.com/takuya-takeuchi/winbiometricdotnet/llms.txt Manages biometric logon credentials for Windows authentication. ```APIDOC ## POST /WinBiometric/SetCredential ### Description Sets biometric logon credentials for Windows authentication. ### Method POST ### Endpoint /WinBiometric/SetCredential ### Parameters #### Request Body - **credentialType** (CredentialTypes) - Required - The type of credential to set (e.g., Password). - **credentialData** (byte[]) - Required - The byte array representing the credential data (e.g., password hash). - **credentialFormat** (CredentialFormat) - Required - The format of the credential data. ### Request Example ```csharp // Example usage within C# code: byte[] passwordCredential = Encoding.Unicode.GetBytes("UserPassword"); WinBiometric.SetCredential(CredentialTypes.Password, passwordCredential, CredentialFormat.Generic); Console.WriteLine("Credential set successfully."); ``` ## GET /WinBiometric/GetCredentialState ### Description Retrieves the state of biometric logon credentials for a given user identity. ### Method GET ### Endpoint /WinBiometric/GetCredentialState ### Parameters #### Query Parameters - **identity** (BiometricIdentity) - Required - The biometric identity of the user. - **credentialType** (CredentialTypes) - Required - The type of credential to check. ### Response #### Success Response (200) - **state** (CredentialState) - The current state of the credential. #### Response Example ```json { "state": "Available" } ``` ### Error Handling - **OperationFailedException**: Thrown if retrieving the credential state fails. ``` -------------------------------- ### Known Issue with AsyncOpenSession and AsyncOpenFramework Source: https://github.com/takuya-takeuchi/winbiometricdotnet/blob/master/README.md This section details a known issue related to the AsyncOpenSession and AsyncOpenFramework functions when using WINBIO_ASYNC_NOTIFY_CALLBACK. ```APIDOC ## Known Issue ### Description When using the `AsyncOpenSession` and `AsyncOpenFramework` functions with the `WINBIO_ASYNC_NOTIFY_CALLBACK` flag, an exception may be thrown. ### Details - **Function:** `WinBioAsyncOpenSession`, `WinBioAsyncOpenFramework` - **Condition:** Specifying `WINBIO_ASYNC_NOTIFY_CALLBACK` - **Result:** Throws an Exception ```