naeural-client 2.4.1__py3-none-any.whl → 2.4.3__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/ec.py +63 -48
- {naeural_client-2.4.1.dist-info → naeural_client-2.4.3.dist-info}/METADATA +3 -2
- {naeural_client-2.4.1.dist-info → naeural_client-2.4.3.dist-info}/RECORD +7 -7
- {naeural_client-2.4.1.dist-info → naeural_client-2.4.3.dist-info}/WHEEL +1 -1
- {naeural_client-2.4.1.dist-info → naeural_client-2.4.3.dist-info}/entry_points.txt +0 -0
- {naeural_client-2.4.1.dist-info → naeural_client-2.4.3.dist-info}/licenses/LICENSE +0 -0
naeural_client/_ver.py
CHANGED
naeural_client/bc/ec.py
CHANGED
@@ -233,12 +233,16 @@ class BaseBCEllipticCurveEngine(BaseBlockEngine):
|
|
233
233
|
the pk object.
|
234
234
|
|
235
235
|
"""
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
236
|
+
try:
|
237
|
+
simple_address = self._remove_prefix(address)
|
238
|
+
bpublic_key = self._text_to_binary(simple_address)
|
239
|
+
public_key = ec.EllipticCurvePublicKey.from_encoded_point(
|
240
|
+
curve=ec.SECP256K1(),
|
241
|
+
data=bpublic_key
|
242
|
+
)
|
243
|
+
except Exception as exp:
|
244
|
+
self.P(f"Error converting address <{address}>to pk: {exp}", color='r')
|
245
|
+
raise exp
|
242
246
|
return public_key
|
243
247
|
|
244
248
|
|
@@ -328,47 +332,6 @@ class BaseBCEllipticCurveEngine(BaseBlockEngine):
|
|
328
332
|
#end if
|
329
333
|
return base64.b64encode(encrypted_data).decode() # Encode to base64
|
330
334
|
|
331
|
-
|
332
|
-
def encrypt(
|
333
|
-
self,
|
334
|
-
plaintext: str,
|
335
|
-
receiver_address: str,
|
336
|
-
info: str = BCct.DEFAULT_INFO,
|
337
|
-
debug: bool = False,
|
338
|
-
**kwargs
|
339
|
-
):
|
340
|
-
"""
|
341
|
-
Encrypts plaintext using the sender's private key and receiver's public key,
|
342
|
-
then base64 encodes the output.
|
343
|
-
|
344
|
-
Parameters
|
345
|
-
----------
|
346
|
-
receiver_address : str
|
347
|
-
The receiver's address
|
348
|
-
|
349
|
-
plaintext : str
|
350
|
-
The plaintext to encrypt.
|
351
|
-
|
352
|
-
Obsolete:
|
353
|
-
compressed : bool, optional
|
354
|
-
Whether to compress the plaintext before encryption. The default is True.
|
355
|
-
|
356
|
-
embed_compressed : bool, optional
|
357
|
-
Whether to embed the compressed flag in the encrypted data. The default is True.
|
358
|
-
|
359
|
-
Returns
|
360
|
-
-------
|
361
|
-
str
|
362
|
-
The base64 encoded nonce and ciphertext.
|
363
|
-
"""
|
364
|
-
return self._encrypt(
|
365
|
-
plaintext=plaintext,
|
366
|
-
receiver_address=receiver_address,
|
367
|
-
compressed=True,
|
368
|
-
embed_compressed=True,
|
369
|
-
info=info,
|
370
|
-
debug=debug,
|
371
|
-
)
|
372
335
|
|
373
336
|
|
374
337
|
def _decrypt(
|
@@ -611,7 +574,59 @@ class BaseBCEllipticCurveEngine(BaseBlockEngine):
|
|
611
574
|
if debug:
|
612
575
|
self.P(f"Error decrypting multi scenario: {exc}", color='r')
|
613
576
|
return None
|
614
|
-
|
577
|
+
|
578
|
+
|
579
|
+
def encrypt(
|
580
|
+
self,
|
581
|
+
plaintext: str,
|
582
|
+
receiver_address: any,
|
583
|
+
info: str = BCct.DEFAULT_INFO,
|
584
|
+
debug: bool = False,
|
585
|
+
**kwargs
|
586
|
+
):
|
587
|
+
"""
|
588
|
+
Encrypts plaintext using the sender's private key and receiver's public key,
|
589
|
+
then base64 encodes the output.
|
590
|
+
|
591
|
+
Parameters
|
592
|
+
----------
|
593
|
+
plaintext : str
|
594
|
+
The plaintext to encrypt.
|
595
|
+
|
596
|
+
receiver_address : str or list[str]
|
597
|
+
The receiver's address or list of multiple receivers addresses.
|
598
|
+
|
599
|
+
|
600
|
+
Obsolete:
|
601
|
+
compressed : bool, optional
|
602
|
+
Whether to compress the plaintext before encryption. The default is True.
|
603
|
+
|
604
|
+
embed_compressed : bool, optional
|
605
|
+
Whether to embed the compressed flag in the encrypted data. The default is True.
|
606
|
+
|
607
|
+
Returns
|
608
|
+
-------
|
609
|
+
str
|
610
|
+
The base64 encoded nonce and ciphertext.
|
611
|
+
"""
|
612
|
+
assert isinstance(receiver_address, (str, list)), "receiver_address must be a string or a list of strings."
|
613
|
+
if isinstance(receiver_address, list):
|
614
|
+
return self.encrypt_for_multi(
|
615
|
+
plaintext=plaintext,
|
616
|
+
receiver_addresses=receiver_address,
|
617
|
+
info=info,
|
618
|
+
debug=debug
|
619
|
+
)
|
620
|
+
return self._encrypt(
|
621
|
+
plaintext=plaintext,
|
622
|
+
receiver_address=receiver_address,
|
623
|
+
compressed=True,
|
624
|
+
embed_compressed=True,
|
625
|
+
info=info,
|
626
|
+
debug=debug,
|
627
|
+
)
|
628
|
+
|
629
|
+
|
615
630
|
def decrypt(
|
616
631
|
self,
|
617
632
|
encrypted_data_b64: str,
|
@@ -1,10 +1,11 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 2.4.
|
3
|
+
Version: 2.4.3
|
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
|
7
7
|
Author-email: Andrei Ionut Damian <andrei.damian@me.com>, Cristan Bleotiu <cristibleotiu@gmail.com>, Stefan Saraev <saraevstefan@gmail.com>
|
8
|
+
License-File: LICENSE
|
8
9
|
Classifier: License :: OSI Approved :: MIT License
|
9
10
|
Classifier: Operating System :: OS Independent
|
10
11
|
Classifier: Programming Language :: Python :: 3
|
@@ -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=MpzR_cSF0_I4RO9GF7IPkGfnxrL5sCmKqm5MMjUwiBg,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
|
@@ -15,7 +15,7 @@ naeural_client/base/payload/payload.py,sha256=v50D7mBBD2WwWzvpbRGMSr-X6vv5ie21IY
|
|
15
15
|
naeural_client/bc/__init__.py,sha256=FQj23D1PrY06NUOARiKQi4cdj0-VxnoYgYDEht8lpr8,158
|
16
16
|
naeural_client/bc/base.py,sha256=i8xv19VBhWXcN4IRpphQS9YYmoM_6rWvPiCzBxV3KZY,30840
|
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=mWjodWCRgC3omVXOA9jtNdtPVNn2kMKV3Dcjt9oFUCQ,22974
|
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
|
@@ -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.4.
|
84
|
-
naeural_client-2.4.
|
85
|
-
naeural_client-2.4.
|
86
|
-
naeural_client-2.4.
|
87
|
-
naeural_client-2.4.
|
83
|
+
naeural_client-2.4.3.dist-info/METADATA,sha256=MOvZQAnvWcIb9FfUCrNBA4ZbRAhvgdSl_17aZSuKIsE,14471
|
84
|
+
naeural_client-2.4.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
85
|
+
naeural_client-2.4.3.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
|
86
|
+
naeural_client-2.4.3.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
87
|
+
naeural_client-2.4.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|