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.
- {t_encrypt-0.0.2.dev1/t_encrypt.egg-info → t_encrypt-0.0.2.dev3}/PKG-INFO +1 -1
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/setup_t_encrypt.py +1 -1
- t_encrypt-0.0.2.dev3/t_encrypt/test_t_encrypt.py +56 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3/t_encrypt.egg-info}/PKG-INFO +1 -1
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/t_encrypt.egg-info/SOURCES.txt +1 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/MANIFEST.in +0 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/setup.cfg +0 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/setup.py +0 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/t_encrypt/__init__.py +0 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/t_encrypt/core.py +0 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/t_encrypt/exceptions.py +0 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/t_encrypt.egg-info/dependency_links.txt +0 -0
- {t_encrypt-0.0.2.dev1 → t_encrypt-0.0.2.dev3}/t_encrypt.egg-info/top_level.txt +0 -0
|
@@ -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()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|