t-encrypt 0.0.2.dev1__tar.gz → 0.0.2.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: t-encrypt
3
- Version: 0.0.2.dev1
3
+ Version: 0.0.2.dev3
4
4
  Summary: Python bindings for SKALE Threshold Encryption
5
5
  Author: SKALE Network
6
6
  Classifier: Programming Language :: Python :: 3
@@ -47,7 +47,7 @@ class BinaryDistribution(Distribution):
47
47
 
48
48
  setup(
49
49
  name='t-encrypt',
50
- version='0.0.2.dev1',
50
+ version='0.0.2.dev3',
51
51
  description='Python bindings for SKALE Threshold Encryption',
52
52
  author='SKALE Network',
53
53
  packages=find_packages(),
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Simple functional test for the installed t_encrypt package.
4
+
5
+ Exercises the real consumer boundary (Python -> ctypes -> libencrypt.so)
6
+
7
+ encrypt_message / encrypt_message_dual_key require a valid BLS common
8
+ public key hex string.
9
+ """
10
+
11
+ from t_encrypt import encrypt_message, encrypt_message_dual_key, encrypt_message_mockup
12
+
13
+ SAMPLE_TX_HEX = "deadbeef"
14
+
15
+ # Fixed BLS common public key used for encryption tests. Generated once via
16
+ # the `generate_bls_keys` tool - there's no need to regenerate it on every
17
+ # run since only t_encrypt's encryption logic is under test here.
18
+ DEFAULT_PUBLIC_KEY = (
19
+ "092e706a6cd636f555261b5fe3d52072b00d8ccb94357f1766620bbf5ceee78"
20
+ "a1e7f735264da6df4a067441a07de7b8af125888060bf6918f32a7ad7155491"
21
+ "e60812921d666125f7432a04510c667efbec95456fb66390b1b01b4271385a9"
22
+ "99601c485b3f92bf2a305ac0dbe58bf21dc5a6b74ca5411bc8df9e5cc9a41ee"
23
+ "bba7"
24
+ )
25
+
26
+
27
+ def is_hex(value: str) -> bool:
28
+ return bool(value) and all(c in "0123456789abcdefABCDEF" for c in value)
29
+
30
+
31
+ def test_encrypt_message_mockup():
32
+ result = encrypt_message_mockup(SAMPLE_TX_HEX)
33
+ assert is_hex(result), f"encrypt_message_mockup returned non-hex: {result!r}"
34
+ print("encrypt_message_mockup: OK")
35
+
36
+
37
+ def test_encrypt_message():
38
+ result = encrypt_message(SAMPLE_TX_HEX, DEFAULT_PUBLIC_KEY)
39
+ assert is_hex(result), f"encrypt_message returned non-hex: {result!r}"
40
+ print("encrypt_message: OK")
41
+
42
+
43
+ def test_encrypt_message_dual_key():
44
+ result = encrypt_message_dual_key(SAMPLE_TX_HEX, DEFAULT_PUBLIC_KEY, DEFAULT_PUBLIC_KEY)
45
+ assert is_hex(result), f"encrypt_message_dual_key returned non-hex: {result!r}"
46
+ print("encrypt_message_dual_key: OK")
47
+
48
+
49
+ def main():
50
+ test_encrypt_message_mockup()
51
+ test_encrypt_message()
52
+ test_encrypt_message_dual_key()
53
+
54
+
55
+ if __name__ == "__main__":
56
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: t-encrypt
3
- Version: 0.0.2.dev1
3
+ Version: 0.0.2.dev3
4
4
  Summary: Python bindings for SKALE Threshold Encryption
5
5
  Author: SKALE Network
6
6
  Classifier: Programming Language :: Python :: 3
@@ -4,6 +4,7 @@ setup_t_encrypt.py
4
4
  t_encrypt/__init__.py
5
5
  t_encrypt/core.py
6
6
  t_encrypt/exceptions.py
7
+ t_encrypt/test_t_encrypt.py
7
8
  t_encrypt.egg-info/PKG-INFO
8
9
  t_encrypt.egg-info/SOURCES.txt
9
10
  t_encrypt.egg-info/dependency_links.txt
File without changes
File without changes