1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 asn1tools,
7 coincurve,
8 eth-hash,
9 eth-typing,
10 eth-utils,
11 factory-boy,
12 hypothesis,
13 isPyPy,
14 pyasn1,
15 pytestCheckHook,
16 pythonOlder,
17}:
18
19buildPythonPackage rec {
20 pname = "eth-keys";
21 version = "0.5.0";
22 pyproject = true;
23 disabled = pythonOlder "3.8";
24
25 src = fetchFromGitHub {
26 owner = "ethereum";
27 repo = "eth-keys";
28 rev = "v${version}";
29 hash = "sha256-vyyaLCG2uIHXX0t93DmFq8/u0rZL+nsBsH2gfgjziyo=";
30 };
31
32 build-system = [ setuptools ];
33
34 propagatedBuildInputs = [
35 eth-typing
36 eth-utils
37 ];
38
39 nativeCheckInputs =
40 [
41 asn1tools
42 factory-boy
43 hypothesis
44 pyasn1
45 pytestCheckHook
46 ]
47 ++ passthru.optional-dependencies.coincurve
48 ++ lib.optional (!isPyPy) eth-hash.optional-dependencies.pysha3
49 ++ lib.optional isPyPy eth-hash.optional-dependencies.pycryptodome;
50
51 disabledTests = [
52 # tests are broken
53 "test_compress_decompress_inversion"
54 "test_public_key_generation_is_equal"
55 "test_signing_is_equal"
56 "test_native_to_coincurve_recover"
57 "test_public_key_compression_is_equal"
58 "test_public_key_decompression_is_equal"
59 "test_signatures_with_high_s"
60 # timing sensitive
61 "test_encode_decode_pairings"
62 ];
63
64 pythonImportsCheck = [ "eth_keys" ];
65
66 passthru.optional-dependencies = {
67 coincurve = [ coincurve ];
68 };
69
70 meta = with lib; {
71 description = "Common API for Ethereum key operations";
72 homepage = "https://github.com/ethereum/eth-keys";
73 license = licenses.mit;
74 maintainers = with maintainers; [ ];
75 };
76}