Yubico / python-fido2

Provides library functionality for FIDO 2.0, including communication with a device over USB.
BSD 2-Clause "Simplified" License
432 stars 109 forks source link

[BUG] when running on windows < 1903, import `fido2.client` results in an error #86

Closed ITProKyle closed 4 years ago

ITProKyle commented 4 years ago

As mentioned, this is running on Windows 1809. Upon importing fido2.client, the below error is raised.

  File "c:\users\containeradministrator\.virtualenvs\data-nggunt9q\lib\site-packages\fido2\client.py", line 44, in <module>
    from .win_api import (
  File "c:\users\containeradministrator\.virtualenvs\data-nggunt9q\lib\site-packages\fido2\win_api.py", line 531, in <module>
    WEBAUTHN_API_VERSION = WEBAUTHN.WebAuthNGetApiVersionNumber()
  File "c:\python38\Lib\ctypes\__init__.py", line 386, in __getattr__
    func = self.__getitem__(name)
  File "c:\python38\Lib\ctypes\__init__.py", line 391, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'WebAuthNGetApiVersionNumber' not found

I propose either handing the error in the library so that other aspects can be used on older versions of windows or raise a more meaningful error to be handled app side.

dainnilsson commented 4 years ago

What version of python-fido2 is this? The line numbers don't seem to match up with the latest release (0.8.1).

ITProKyle commented 4 years ago

Right - I'm a prerelease of the Windows feature at the moment (have not had a chance to swap over to the full release yet). That would explain the line numbers being off yet the code code in question is the same between the two.

Here is the commit I am currently consuming that produced those line numbers: https://github.com/Yubico/python-fido2/tree/d755f822e33111bc4ce38b2f2b934cb3e87200f3

dainnilsson commented 4 years ago

Alright. I would suggest trying the latest released version instead, I don't believe that one should exhibit the behavior you're seeing.

dainnilsson commented 4 years ago

Closing due to inactivity, please reopen if this is still an issue.