Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-nitrokey for openSUSE:Factory checked in at 2025-02-18 19:12:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-nitrokey (Old) and /work/SRC/openSUSE:Factory/.python-nitrokey.new.8181 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-nitrokey" Tue Feb 18 19:12:52 2025 rev:2 rq:1246655 version:0.2.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-nitrokey/python-nitrokey.changes 2024-11-11 13:44:52.778691877 +0100 +++ /work/SRC/openSUSE:Factory/.python-nitrokey.new.8181/python-nitrokey.changes 2025-02-18 19:13:50.412378758 +0100 @@ -1,0 +2,10 @@ +Tue Feb 18 10:18:49 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to 0.2.4 + * The list methods of `NK3` and `NKPK` now only open the + respective device, based on the USB vendor and product ID. + * Use trusted publishing for PyPI. + * Add support for `poetry-core` v2. +- Use Python 3.11 on SLE-15 by default + +------------------------------------------------------------------- Old: ---- nitrokey-0.2.3.tar.gz New: ---- nitrokey-0.2.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-nitrokey.spec ++++++ --- /var/tmp/diff_new_pack.KCx2th/_old 2025-02-18 19:13:51.152409734 +0100 +++ /var/tmp/diff_new_pack.KCx2th/_new 2025-02-18 19:13:51.152409734 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-nitrokey # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,8 +16,9 @@ # +%{?sle15_python_module_pythons} Name: python-nitrokey -Version: 0.2.3 +Version: 0.2.4 Release: 0 Summary: Nitrokey Python SDK License: Apache-2.0 ++++++ nitrokey-0.2.3.tar.gz -> nitrokey-0.2.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nitrokey-0.2.3/PKG-INFO new/nitrokey-0.2.4/PKG-INFO --- old/nitrokey-0.2.3/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/nitrokey-0.2.4/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nitrokey -Version: 0.2.3 +Version: 0.2.4 Summary: Nitrokey Python SDK Home-page: https://github.com/Nitrokey/nitrokey-sdk-py License: Apache-2.0 or MIT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nitrokey-0.2.3/pyproject.toml new/nitrokey-0.2.4/pyproject.toml --- old/nitrokey-0.2.3/pyproject.toml 2024-11-02 16:10:16.000000000 +0100 +++ new/nitrokey-0.2.4/pyproject.toml 2025-01-22 14:04:23.000000000 +0100 @@ -1,10 +1,10 @@ [build-system] -requires = ["poetry-core >=1,<2"] +requires = ["poetry-core >=1,<3"] build-backend = "poetry.core.masonry.api" [tool.poetry] name = "nitrokey" -version = "0.2.3" +version = "0.2.4" description = "Nitrokey Python SDK" authors = ["Nitrokey <p...@nitrokey.com>"] license = "Apache-2.0 or MIT" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nitrokey-0.2.3/src/nitrokey/nk3/_device.py new/nitrokey-0.2.4/src/nitrokey/nk3/_device.py --- old/nitrokey-0.2.3/src/nitrokey/nk3/_device.py 2024-11-02 16:10:16.000000000 +0100 +++ new/nitrokey-0.2.4/src/nitrokey/nk3/_device.py 2025-01-22 14:04:23.000000000 +0100 @@ -5,8 +5,11 @@ # http://opensource.org/licenses/MIT>, at your option. This file may not be # copied, modified, or distributed except according to those terms. -from fido2.hid import CtapHidDevice +from typing import List +from fido2.hid import CtapHidDevice, list_descriptors, open_device + +from nitrokey import _VID_NITROKEY from nitrokey.trussed import Fido2Certs, TrussedDevice, Version FIDO2_CERTS = [ @@ -46,3 +49,20 @@ @classmethod def from_device(cls, device: CtapHidDevice) -> "NK3": return cls(device) + + @classmethod + def list(cls) -> List["NK3"]: + from . import _PID_NK3_DEVICE + + descriptors = [ + desc + for desc in list_descriptors() # type: ignore + if desc.vid == _VID_NITROKEY and desc.pid == _PID_NK3_DEVICE + ] + + devices = [] + + # iterate on all descriptors found and open the device + for desc in descriptors: + devices.append(cls.from_device(open_device(desc.path))) + return devices diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nitrokey-0.2.3/src/nitrokey/nkpk.py new/nitrokey-0.2.4/src/nitrokey/nkpk.py --- old/nitrokey-0.2.3/src/nitrokey/nkpk.py 2024-11-02 16:10:16.000000000 +0100 +++ new/nitrokey-0.2.4/src/nitrokey/nkpk.py 2025-01-22 14:04:23.000000000 +0100 @@ -7,7 +7,7 @@ from typing import List, Optional, Sequence, Union -from fido2.hid import CtapHidDevice +from fido2.hid import CtapHidDevice, list_descriptors, open_device from nitrokey import _VID_NITROKEY from nitrokey.trussed import Fido2Certs, TrussedDevice, Version @@ -60,6 +60,21 @@ def from_device(cls, device: CtapHidDevice) -> "NKPK": return cls(device) + @classmethod + def list(cls) -> List["NKPK"]: + descriptors = [ + desc + for desc in list_descriptors() # type: ignore + if desc.vid == _VID_NITROKEY and desc.pid == _PID_NKPK_DEVICE + ] + + devices = [] + + # iterate on all descriptors found and open the device + for desc in descriptors: + devices.append(cls.from_device(open_device(desc.path))) + return devices + class NKPKBootloader(TrussedBootloaderNrf52): @property diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nitrokey-0.2.3/src/nitrokey/trussed/_device.py new/nitrokey-0.2.4/src/nitrokey/trussed/_device.py --- old/nitrokey-0.2.3/src/nitrokey/trussed/_device.py 2024-11-02 16:10:16.000000000 +0100 +++ new/nitrokey-0.2.4/src/nitrokey/trussed/_device.py 2025-01-22 14:04:23.000000000 +0100 @@ -11,7 +11,7 @@ import sys from abc import abstractmethod from enum import Enum -from typing import Optional, Sequence, TypeVar, Union +from typing import List, Optional, Sequence, TypeVar, Union from fido2.hid import CtapHidDevice, open_device @@ -110,15 +110,8 @@ return None @classmethod - def list(cls: type[T]) -> list[T]: - devices = [] - for device in CtapHidDevice.list_devices(): - try: - devices.append(cls.from_device(device)) - except ValueError: - # not the correct device type, skip - pass - return devices + @abstractmethod + def list(cls: type[T]) -> List[T]: ... def _device_path_to_str(path: Union[bytes, str]) -> str: