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