Class YubiKeyDeviceListener
This class provides events for YubiKeyDevice arrival and removal.
public class YubiKeyDeviceListener
- Inheritance
-
objectYubiKeyDeviceListener
Properties
Instance
An instance of a YubiKeyDeviceListener.
public static YubiKeyDeviceListener Instance { get; }
Property Value
Methods
Dispose()
Calls Dispose(true).
public void Dispose()
Dispose(bool)
Disposes the objects.
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
~YubiKeyDeviceListener()
protected ~YubiKeyDeviceListener()
StopListening()
Disposes and closes the singleton instance of YubiKeyDeviceListener.
public static void StopListening()
Remarks
Enumerating YubiKeys is actually done via a cache. As such, this cache must be maintained and kept up-to-date. This is done by starting several listeners that run in the background. These listen for the relevant OS device arrival and removal events.
Normally, these background listeners will run starting with the first enumeration call to the SDK and remain active until the process shuts down. But there are cases where you may not want the overhead of these listeners running all the time. While they do their best to not consume excessive resources, they can sometimes generate log noise, exceptions, etc.
This method allows you to stop these background listeners and reclaim resources, as possible. This will not invalidate any existing IYubiKeyDevice instances, however you will not receive any additional events regarding that device. Any subsequent calls to FindAll(), FindByTransport(Transport), or Instance will restart the listeners.
Events
Arrived
Subscribe to receive an event whenever a YubiKey is added to the computer.
public event EventHandler<YubiKeyDeviceEventArgs>? Arrived
Event Type
- EventHandler<YubiKeyDeviceEventArgs>
Removed
Subscribe to receive an event whenever a YubiKey is removed from the computer.
public event EventHandler<YubiKeyDeviceEventArgs>? Removed
Event Type
- EventHandler<YubiKeyDeviceEventArgs>