1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonRelaxDepsHook,
6 setuptools-scm,
7 # install requirements
8 fido2,
9 keyring,
10 cryptography,
11 # test requirements
12 pytestCheckHook,
13}:
14
15let
16 fido2_0 = fido2.overridePythonAttrs (oldAttrs: rec {
17 version = "0.9.3";
18 format = "setuptools";
19 src = fetchPypi {
20 inherit (oldAttrs) pname;
21 inherit version;
22 hash = "sha256-tF6JphCc/Lfxu1E3dqotZAjpXEgi+DolORi5RAg0Zuw=";
23 };
24 });
25in
26buildPythonPackage rec {
27 pname = "ctap-keyring-device";
28 version = "1.0.6";
29 format = "setuptools";
30
31 src = fetchPypi {
32 inherit version pname;
33 sha256 = "sha256-pEJkuz0wxKt2PkowmLE2YC+HPYa2ZiENK7FAW14Ec/Y=";
34 };
35
36 # removing optional dependency needing pyobjc
37 postPatch = ''
38 substituteInPlace pytest.ini \
39 --replace "--flake8 --black --cov" ""
40 '';
41
42 nativeBuildInputs = [
43 pythonRelaxDepsHook
44 setuptools-scm
45 ];
46
47 pythonRemoveDeps = [
48 # This is a darwin requirement missing pyobjc
49 "pyobjc-framework-LocalAuthentication"
50 ];
51
52 propagatedBuildInputs = [
53 keyring
54 fido2_0
55 cryptography
56 ];
57
58 pythonImportsCheck = [ "ctap_keyring_device" ];
59
60 checkInputs = [ pytestCheckHook ];
61
62 disabledTests = [
63 # Disabled tests that needs pyobjc or windows
64 "touch_id_ctap_user_verifier"
65 "windows_hello_ctap_user_verifier"
66 ];
67
68 meta = with lib; {
69 description = "CTAP (client-to-authenticator-protocol) device backed by python's keyring library";
70 homepage = "https://github.com/dany74q/ctap-keyring-device";
71 license = licenses.mit;
72 maintainers = with maintainers; [ jbgosselin ];
73 };
74}