trustcrypto / python-onlykey

The OnlyKey Python Command-Line Utility is a command line tool targeted towards more advanced users. This can be used for configuration and testing.
https://docs.crp.to/command-line.html
48 stars 23 forks source link

Refuses to work with fido2>=1.0.0 #73

Open 62832 opened 1 year ago

62832 commented 1 year ago

I'm currently in the process of putting together a (non-pip) package for the Arch Linux user repository as per the distribution's Python package guidelines. This requires that the program being packaged runs against the latest available versions of other python packages, which in the case of the python-fido2 module is currently 1.1.1 as opposed to 0.9.3.

At present, onlykey-cli refuses to start from the package I've built due to the naming changes made in the FIDO2 module such as CTAP1 -> Ctap1.

Traceback (most recent call last):
  File "/usr/bin/onlykey-cli", line 33, in <module>
    sys.exit(load_entry_point('onlykey==1.2.10', 'console_scripts', 'onlykey-cli')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/onlykey-cli", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.11/site-packages/onlykey/cli.py", line 15, in <module>
    import solo
  File "/usr/lib/python3.11/site-packages/solo/__init__.py", line 15, in <module>
    from . import client, commands, dfu, helpers, operations
  File "/usr/lib/python3.11/site-packages/solo/client.py", line 16, in <module>
    from .devices import solo_v1
  File "/usr/lib/python3.11/site-packages/solo/devices/solo_v1.py", line 11, in <module>
    from fido2.ctap1 import CTAP1
ImportError: cannot import name 'CTAP1' from 'fido2.ctap1' (/usr/lib/python3.11/site-packages/fido2/ctap1.py)

A fix for this would be greatly appreciated for myself and for anyone else looking to use the CLI utility on Arch-based Linux distributions without the use of pip.

haplo commented 10 months ago

I have been working on packaging onlykey's Python libraries for Arch Linux unaware of @62832 work here. Am I right to assume that you gave up?

@onlykey Would you accept PRs updating the codebase to the new fido2 API?

62832 commented 10 months ago

I did give up initially since I didn't plan at that time on sending any pull requests updating to the new API, and I also wasn't sure if OnlyKey were available to accept such PRs. I'm happy to await a response, however.

onlykey commented 10 months ago

Yes we would be happy to accept a PR here. Thanks for the work on this.

@62832 @haplo