naeural-client 2.3.2__py3-none-any.whl → 2.3.4__py3-none-any.whl
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.
- naeural_client/_ver.py +1 -1
- naeural_client/bc/base.py +29 -4
- naeural_client/bc/ec.py +26 -0
- naeural_client/const/payload.py +3 -0
- {naeural_client-2.3.2.dist-info → naeural_client-2.3.4.dist-info}/METADATA +1 -1
- {naeural_client-2.3.2.dist-info → naeural_client-2.3.4.dist-info}/RECORD +9 -9
- {naeural_client-2.3.2.dist-info → naeural_client-2.3.4.dist-info}/WHEEL +0 -0
- {naeural_client-2.3.2.dist-info → naeural_client-2.3.4.dist-info}/entry_points.txt +0 -0
- {naeural_client-2.3.2.dist-info → naeural_client-2.3.4.dist-info}/licenses/LICENSE +0 -0
naeural_client/_ver.py
CHANGED
naeural_client/bc/base.py
CHANGED
@@ -14,12 +14,24 @@ from cryptography.hazmat.primitives import serialization
|
|
14
14
|
|
15
15
|
from ..utils.config import get_user_folder
|
16
16
|
|
17
|
-
|
18
|
-
class BCct:
|
17
|
+
class BCctbase:
|
19
18
|
SIGN = 'EE_SIGN'
|
20
19
|
SENDER = 'EE_SENDER'
|
21
20
|
HASH = 'EE_HASH'
|
22
21
|
|
22
|
+
ETH_SIGN = 'EE_ETH_SIGN'
|
23
|
+
ETH_SENDER= 'EE_ETH_SENDER'
|
24
|
+
|
25
|
+
# TODO: generate automaticall the NON_DATA_FIELDS
|
26
|
+
|
27
|
+
|
28
|
+
class BCct:
|
29
|
+
SIGN = BCctbase.SIGN
|
30
|
+
SENDER = BCctbase.SENDER
|
31
|
+
HASH = BCctbase.HASH
|
32
|
+
ETH_SIGN = BCctbase.ETH_SIGN
|
33
|
+
ETH_SENDER = BCctbase.ETH_SENDER
|
34
|
+
|
23
35
|
ADDR_PREFIX_OLD = "aixp_"
|
24
36
|
ADDR_PREFIX = "0xai_"
|
25
37
|
|
@@ -56,7 +68,7 @@ class VerifyMessage(_DotDict):
|
|
56
68
|
self.sender = None
|
57
69
|
|
58
70
|
|
59
|
-
NON_DATA_FIELDS = [
|
71
|
+
NON_DATA_FIELDS = [val for key, val in BCctbase.__dict__.items() if key[0] != '_']
|
60
72
|
|
61
73
|
def replace_nan_inf(data, inplace=False):
|
62
74
|
assert isinstance(data, (dict, list)), "Only dictionaries and lists are supported"
|
@@ -889,7 +901,7 @@ class BaseBlockEngine:
|
|
889
901
|
return result
|
890
902
|
|
891
903
|
|
892
|
-
def sign(self, dct_data: dict, add_data=True, use_digest=True, replace_nan=True) -> str:
|
904
|
+
def sign(self, dct_data: dict, add_data=True, use_digest=True, replace_nan=True, eth_sign=False) -> str:
|
893
905
|
"""
|
894
906
|
Generates the signature for a dict object.
|
895
907
|
Does not add the signature to the dict object
|
@@ -908,6 +920,9 @@ class BaseBlockEngine:
|
|
908
920
|
|
909
921
|
replace_nan: bool, optional
|
910
922
|
will replace `np.nan` and `np.inf` with `None` before signing.
|
923
|
+
|
924
|
+
eth_sign: bool, optional
|
925
|
+
will also sign the data with the Ethereum account. Default `False`
|
911
926
|
|
912
927
|
Returns
|
913
928
|
-------
|
@@ -926,6 +941,7 @@ class BaseBlockEngine:
|
|
926
941
|
return_all=True,
|
927
942
|
replace_nan=replace_nan,
|
928
943
|
)
|
944
|
+
text_data = bdata.decode()
|
929
945
|
if use_digest:
|
930
946
|
bdata = bin_hexdigest # to-sign data is the hash
|
931
947
|
# finally sign either full or just hash
|
@@ -934,6 +950,15 @@ class BaseBlockEngine:
|
|
934
950
|
# not populate dict
|
935
951
|
dct_data[BCct.SIGN] = result
|
936
952
|
dct_data[BCct.SENDER] = self.address
|
953
|
+
dct_data[BCct.ETH_SENDER] = self.eth_address
|
954
|
+
### add eth signature
|
955
|
+
dct_data[BCct.ETH_SIGN] = "0xBEEF"
|
956
|
+
if eth_sign:
|
957
|
+
eth_sign_info = self.eth_sign_text(text_data, signature_only=False)
|
958
|
+
# can be replaced with dct_data[BCct.ETH_SIGN] = self.eth_sign_text(bdata.decode(), signature_only=True)
|
959
|
+
eth_sign = eth_sign_info.get('signature')
|
960
|
+
dct_data[BCct.ETH_SIGN] = eth_sign
|
961
|
+
### end eth signature
|
937
962
|
if use_digest:
|
938
963
|
dct_data[BCct.HASH] = hexdigest
|
939
964
|
return result
|
naeural_client/bc/ec.py
CHANGED
@@ -494,6 +494,32 @@ class BaseBCEllipticCurveEngine(BaseBlockEngine):
|
|
494
494
|
"sender" : self.eth_address,
|
495
495
|
}
|
496
496
|
|
497
|
+
def eth_sign_text(self, message, signature_only=True):
|
498
|
+
"""
|
499
|
+
Signs a text message using the private key.
|
500
|
+
|
501
|
+
Parameters
|
502
|
+
----------
|
503
|
+
message : str
|
504
|
+
The message to sign.
|
505
|
+
|
506
|
+
signature_only : bool, optional
|
507
|
+
Whether to return only the signature. The default is True
|
508
|
+
|
509
|
+
Returns
|
510
|
+
-------
|
511
|
+
str
|
512
|
+
The signature of the message.
|
513
|
+
"""
|
514
|
+
types = ["string"]
|
515
|
+
values = [message]
|
516
|
+
result = self.eth_sign_message(types, values)
|
517
|
+
if signature_only:
|
518
|
+
return result["signature"]
|
519
|
+
return result
|
520
|
+
|
521
|
+
|
522
|
+
|
497
523
|
def eth_sign_node_epochs(self, node, epochs, epochs_vals, signature_only=True):
|
498
524
|
"""
|
499
525
|
Signs the node availability
|
naeural_client/const/payload.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 2.3.
|
3
|
+
Version: 2.3.4
|
4
4
|
Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
|
5
5
|
Project-URL: Homepage, https://github.com/NaeuralEdgeProtocol/naeural_client
|
6
6
|
Project-URL: Bug Tracker, https://github.com/NaeuralEdgeProtocol/naeural_client/issues
|
@@ -1,5 +1,5 @@
|
|
1
1
|
naeural_client/__init__.py,sha256=UKEDGS0wFYyxwmhEAKJGecO2vYbIfRYUP4SQgnK10IE,578
|
2
|
-
naeural_client/_ver.py,sha256=
|
2
|
+
naeural_client/_ver.py,sha256=EE_Hpghjfxe-FA22WDYoMnX6ZuyO4YHhdaUOyPGsyhk,330
|
3
3
|
naeural_client/base_decentra_object.py,sha256=wXjl65gWxxkhV6Tq48wFfNGITvdYdkKPT-wLurGB5vc,4287
|
4
4
|
naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
|
5
5
|
naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
|
@@ -13,9 +13,9 @@ naeural_client/base/transaction.py,sha256=bfs6td5M0fINgPQNxhrl_AUjb1YiilLDQ-Cd_o
|
|
13
13
|
naeural_client/base/payload/__init__.py,sha256=y8fBI8tG2ObNfaXFWjyWZXwu878FRYj_I8GIbHT4GKE,29
|
14
14
|
naeural_client/base/payload/payload.py,sha256=v50D7mBBD2WwWzvpbRGMSr-X6vv5ie21IY1aDxTqe1c,2275
|
15
15
|
naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
|
16
|
-
naeural_client/bc/base.py,sha256=
|
16
|
+
naeural_client/bc/base.py,sha256=omIzAth18As5x-bwz16hLUQ-9q6lexkIufVOE6d0yKQ,30445
|
17
17
|
naeural_client/bc/chain.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
naeural_client/bc/ec.py,sha256=
|
18
|
+
naeural_client/bc/ec.py,sha256=9yhMq3HEICQRLD9MO3YYlWrSIA9Dled4GAh4DVNs3h0,14593
|
19
19
|
naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
21
21
|
naeural_client/cli/README.md,sha256=WPdI_EjzAbUW1aPyj1sSR8rLydcJKZtoiaEtklQrjHo,74
|
@@ -37,7 +37,7 @@ naeural_client/const/environment.py,sha256=iytmTDgbOjvORPwHQmc0K0r-xJx7dnnzNnqAJ
|
|
37
37
|
naeural_client/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
|
38
38
|
naeural_client/const/heartbeat.py,sha256=jGHmKfeHTFOXJaKUT3o_ocnQyF-EpcLeunW-ifkYKfU,2534
|
39
39
|
naeural_client/const/misc.py,sha256=Y6x00YDtY1_nAk4OvikCLlfp8ggn11WQYTBGYzFlJPk,211
|
40
|
-
naeural_client/const/payload.py,sha256=
|
40
|
+
naeural_client/const/payload.py,sha256=vxTM2qilqHpfjLATfUX_Oi-hjJxyL3tirnvitYw_ejY,5828
|
41
41
|
naeural_client/default/__init__.py,sha256=ozU6CMMuWl0LhG8Ae3LrZ65a6tLrptfscVYGf83zjxM,46
|
42
42
|
naeural_client/default/instance/__init__.py,sha256=Itb4l6_DR6CCw8KAxyQKlCmALyzDasNHIfM9VB-Umak,548
|
43
43
|
naeural_client/default/instance/chain_dist_custom_job_01_plugin.py,sha256=QtHi3uXKsVs9eyMgbnvBVbMylErhV1Du4X2-7zDL7Y0,1915
|
@@ -80,8 +80,8 @@ naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uw
|
|
80
80
|
naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
|
81
81
|
naeural_client/utils/config.py,sha256=t_VzyBnRHJa-Kt71HUu9gXxeDOri1Aqf_-gjO04gAYs,3681
|
82
82
|
naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
83
|
-
naeural_client-2.3.
|
84
|
-
naeural_client-2.3.
|
85
|
-
naeural_client-2.3.
|
86
|
-
naeural_client-2.3.
|
87
|
-
naeural_client-2.3.
|
83
|
+
naeural_client-2.3.4.dist-info/METADATA,sha256=AHA60_fIknMuhyeJYCjrCnOFeMoMOB300LTLgnLA8HE,14449
|
84
|
+
naeural_client-2.3.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
85
|
+
naeural_client-2.3.4.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
|
86
|
+
naeural_client-2.3.4.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
87
|
+
naeural_client-2.3.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|