naeural-client 2.4.1__py3-none-any.whl → 2.4.2__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 CHANGED
@@ -1,4 +1,4 @@
1
- __VER__ = "2.4.1"
1
+ __VER__ = "2.4.2"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
naeural_client/bc/ec.py CHANGED
@@ -328,47 +328,6 @@ class BaseBCEllipticCurveEngine(BaseBlockEngine):
328
328
  #end if
329
329
  return base64.b64encode(encrypted_data).decode() # Encode to base64
330
330
 
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
331
 
373
332
 
374
333
  def _decrypt(
@@ -611,7 +570,59 @@ class BaseBCEllipticCurveEngine(BaseBlockEngine):
611
570
  if debug:
612
571
  self.P(f"Error decrypting multi scenario: {exc}", color='r')
613
572
  return None
614
-
573
+
574
+
575
+ def encrypt(
576
+ self,
577
+ plaintext: str,
578
+ receiver_address: any,
579
+ info: str = BCct.DEFAULT_INFO,
580
+ debug: bool = False,
581
+ **kwargs
582
+ ):
583
+ """
584
+ Encrypts plaintext using the sender's private key and receiver's public key,
585
+ then base64 encodes the output.
586
+
587
+ Parameters
588
+ ----------
589
+ plaintext : str
590
+ The plaintext to encrypt.
591
+
592
+ receiver_address : str or list[str]
593
+ The receiver's address or list of multiple receivers addresses.
594
+
595
+
596
+ Obsolete:
597
+ compressed : bool, optional
598
+ Whether to compress the plaintext before encryption. The default is True.
599
+
600
+ embed_compressed : bool, optional
601
+ Whether to embed the compressed flag in the encrypted data. The default is True.
602
+
603
+ Returns
604
+ -------
605
+ str
606
+ The base64 encoded nonce and ciphertext.
607
+ """
608
+ assert isinstance(receiver_address, (str, list)), "receiver_address must be a string or a list of strings."
609
+ if isinstance(receiver_address, list):
610
+ return self.encrypt_for_multi(
611
+ plaintext=plaintext,
612
+ receiver_addresses=receiver_address,
613
+ info=info,
614
+ debug=debug
615
+ )
616
+ return self._encrypt(
617
+ plaintext=plaintext,
618
+ receiver_address=receiver_address,
619
+ compressed=True,
620
+ embed_compressed=True,
621
+ info=info,
622
+ debug=debug,
623
+ )
624
+
625
+
615
626
  def decrypt(
616
627
  self,
617
628
  encrypted_data_b64: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: naeural_client
3
- Version: 2.4.1
3
+ Version: 2.4.2
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=vLBf3RjTm__sEAVkTDUbkGT6RBmiGW6B3RJS2uasNH4,330
2
+ naeural_client/_ver.py,sha256=RkYRtRhomBD-BUGemiEVbPXSs0mxD4Z2DVDMd4bqvIE,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=L0KWdlsaR7lD--LtnwyBGbpiKHperxq1JLFYcNnFB50,22456
18
+ naeural_client/bc/ec.py,sha256=XaAlDtr94kXqeYypufBd40fpRF_SkIkRK71lrhk-DKY,22831
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.1.dist-info/METADATA,sha256=l0fFZtw9fjoqqc-IsuyoV2N3WHtA7LzJlTQB7TmbwW0,14449
84
- naeural_client-2.4.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
85
- naeural_client-2.4.1.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
86
- naeural_client-2.4.1.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
87
- naeural_client-2.4.1.dist-info/RECORD,,
83
+ naeural_client-2.4.2.dist-info/METADATA,sha256=CAv6bYFhmyWs1_AHn5O22ddzheTZ5RUtUhpJbMcYAIM,14449
84
+ naeural_client-2.4.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
85
+ naeural_client-2.4.2.dist-info/entry_points.txt,sha256=PNdyotDaQBAslZREx5luVyj0kqpQnwNACwkFNTPIHU4,55
86
+ naeural_client-2.4.2.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
87
+ naeural_client-2.4.2.dist-info/RECORD,,