Beispiel #1
0
        private void GetFirstUSBDevice()
        {
            List <string> fidoDevices = HIDAuthenticatorConnector.GetAllFIDODevicePaths();

            if (fidoDevices.Count == 0)
            {
                //If there are no devices then we have no need for a connector
                con = null;
                return;
            }

            //If we already have a connector linked to this device then no further action is required
            if (fidoDevices.Contains(con?.GetDevicePath()))
            {
                return;
            }

            //Configure a new connector using the first returned device
            if (!(con is null))
            {
                con.KeepAlive -= OnKeepAlive;
            }

            con            = new HIDAuthenticatorConnector(fidoDevices[0]);
            con.KeepAlive += OnKeepAlive;
        }