naeural-client 2.7.42__py3-none-any.whl → 3.0.0__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.7.42"
1
+ __VER__ = "3.0.0"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  with open("pyproject.toml", "rt") as fd:
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env python3
2
+ import os
3
+ import binascii
4
+ import base64
5
+
6
+ def generate_swarm_key():
7
+ """
8
+ Generate a 32-byte random key and format it as a valid IPFS swarm key.
9
+ """
10
+ # 32 bytes of cryptographically secure random data
11
+ random_bytes = os.urandom(32)
12
+ # Hex-encode them
13
+ hex_str = binascii.hexlify(random_bytes).decode('utf-8')
14
+
15
+ # Construct the file content
16
+ swarm_key_data = (
17
+ "/key/swarm/psk/1.0.0/\n"
18
+ "/base16/\n"
19
+ f"{hex_str}\n"
20
+ )
21
+
22
+ # Base64-encode the key
23
+ swarm_key_data = base64.b64encode(swarm_key_data.encode('utf-8')).decode('utf-8')
24
+
25
+ return swarm_key_data
26
+
27
+
28
+ if __name__ == "__main__":
29
+ key_str = generate_swarm_key()
30
+ print("Generated swarm_key_base64.txt content:")
31
+ print(key_str)
32
+ # Optionally save to a file
33
+ with open("swarm_key_base64.txt", "w") as f:
34
+ f.write(key_str)
35
+ print("Swarm key written to swarm_key_base64.txt")
@@ -0,0 +1,13 @@
1
+ [Unit]
2
+ Description=IPFS daemon
3
+ After=network.target
4
+
5
+ [Service]
6
+ # Set the user who owns ~/.ipfs (assuming "ipfsuser" owns ~/.ipfs)
7
+ User=root
8
+ ExecStart=/usr/local/bin/ipfs daemon
9
+ Restart=always
10
+ KillSignal=SIGINT
11
+
12
+ [Install]
13
+ WantedBy=multi-user.target
@@ -0,0 +1,6 @@
1
+
2
+ cp ipfs.service /etc/systemd/system/ipfs.service
3
+ sudo systemctl daemon-reload
4
+ sudo systemctl enable ipfs
5
+ sudo systemctl start ipfs
6
+ ./show.sh
@@ -0,0 +1 @@
1
+ systemctl restart ipfs
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ ipfs bootstrap rm --all
3
+ ipfs daemon
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ wget https://dist.ipfs.tech/kubo/v0.33.1/kubo_v0.33.1_linux-amd64.tar.gz && \
3
+ tar -xvzf kubo_v0.33.1_linux-amd64.tar.gz && \
4
+ cd kubo && \
5
+ bash install.sh
6
+ ipfs init
7
+ ipfs config --json Swarm.EnableRelayHop true
8
+ cd ..
9
+ ./write_key.sh
10
+
@@ -0,0 +1,3 @@
1
+ ipfs log level all debug
2
+ # shows the log of the ipfs.service systemd service
3
+ journalctl -u ipfs.service -f -n 1000 -a
@@ -0,0 +1,3 @@
1
+ # load the base64 encoded swarm key into the SWARM_KEY_CONTENT_BASE64 env var
2
+ cat swarm_key_base64.txt | base64 -d > /root/.ipfs/swarm.key
3
+ cat /root/.ipfs/swarm.key
@@ -1,6 +1,53 @@
1
1
  """
2
2
  Ratio1 base IPFS utility functions.
3
3
 
4
+
5
+ NOTE:
6
+ - Following the bootstrapping of this module, it takes a few minutes for the relay
7
+ to be connected and the IPFS daemon to be fully operational so sometimes, after
8
+ the start of the engine, the first few `get` operations may fail.
9
+
10
+
11
+ Installation:
12
+
13
+ 1. On the dev node or seed node run ifps_keygen and generate `swarm_key_base64.txt` then
14
+ save this key to the environment variable `EE_SWARM_KEY_CONTENT_BASE64` on the seed
15
+ oracles as well as in a file.
16
+
17
+ 2. On seed node create `ipfs_setup`, copy the files from the `ipfs_setup` including the
18
+ key file.
19
+
20
+ 3. Run `setup.sh` on the seed node or:
21
+
22
+ ```bash
23
+ #!/bin/bash
24
+ wget https://dist.ipfs.tech/kubo/v0.32.1/kubo_v0.32.1_linux-amd64.tar.gz && \
25
+ tar -xvzf kubo_v0.32.1_linux-amd64.tar.gz && \
26
+ cd kubo && \
27
+ bash install.sh
28
+ ipfs init
29
+ ipfs config --json Swarm.EnableRelayHop true
30
+
31
+ ./write_key.sh
32
+ ```
33
+ The `write_key.sh` script should contain the following:
34
+
35
+ ```bash
36
+ cat swarm_key_base64.txt | base64 -d > /root/.ipfs/swarm.key
37
+ cat /root/.ipfs/swarm.key
38
+ ```
39
+
40
+ 4. Continue on the seed node and run either manually (NOT recommended) or via a systemd
41
+ the ifps daemon using `./launch_service.sh` that basically does:
42
+
43
+ ```bash
44
+ cp ipfs.service /etc/systemd/system/ipfs.service
45
+ sudo systemctl daemon-reload
46
+ sudo systemctl enable ipfs
47
+ sudo systemctl start ipfs
48
+ ./show.sh
49
+ ```
50
+
4
51
  """
5
52
  import subprocess
6
53
  import json
@@ -13,7 +60,7 @@ import uuid
13
60
 
14
61
  from threading import Lock
15
62
 
16
- __VER__ = "0.2.1"
63
+ __VER__ = "0.2.2"
17
64
 
18
65
 
19
66
  class IPFSCt:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naeural_client
3
- Version: 2.7.42
3
+ Version: 3.0.0
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=YimqgDbjLuywsf8zCWE0EaUXH4MBUrqLxt0TDV558hQ,632
2
- naeural_client/_ver.py,sha256=Q93aXw2mji9yRTgEWkuF0JwuicbvBiHlVU3oFdsJmUs,331
2
+ naeural_client/_ver.py,sha256=MqerdK9jgr7au4o00knSFo3zGjY-2Lg5pJXY___ZpQA,330
3
3
  naeural_client/base_decentra_object.py,sha256=C4iwZTkhKNBS4VHlJs5DfElRYLo4Q9l1V1DNVSk1fyQ,4412
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
@@ -61,7 +61,15 @@ naeural_client/io_formatter/default/a_dummy.py,sha256=qr9eUizQ-NN5jdXVzkaZKMaf9K
61
61
  naeural_client/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz5lgrQWo7td5Ri1A,3052
62
62
  naeural_client/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
63
63
  naeural_client/ipfs/__init__.py,sha256=vXEDLUNUO6lOTMGa8iQ9Zf7ajIQq9GZuvYraAHt3meE,38
64
- naeural_client/ipfs/r1fs.py,sha256=vqqSDulF1AlqrepCS8byGAv3JwNppMwbdS1KmuTvKw8,17213
64
+ naeural_client/ipfs/ifps_keygen,sha256=PcoYuo4c89_C9FWrKq9K_28ruhKqnxNn1s3nLHiF1tc,879
65
+ naeural_client/ipfs/r1fs.py,sha256=IKJZG3jiodvXT6tfRWKQtg4oALQ9H9OhW85q1JGnd58,18653
66
+ naeural_client/ipfs/ipfs_setup/ipfs.service,sha256=isTJQsktPy4i1yaDA9AC1OKdlTYvsCCRRAVX-EmGqAs,248
67
+ naeural_client/ipfs/ipfs_setup/launch_service.sh,sha256=GWhZyNqtohLxJg8Q_c8YnNZduu1ddXDU-IFRRMaEyiY,141
68
+ naeural_client/ipfs/ipfs_setup/restart.sh,sha256=9xHMgkUoAMI25jeaoDVFbCa_LjojYm3ubljW58RatKE,22
69
+ naeural_client/ipfs/ipfs_setup/run.sh,sha256=CXfUtGiQRzawb-n9nLCWl1lbTcDqMNRqMLXwPovBsPM,48
70
+ naeural_client/ipfs/ipfs_setup/setup.sh,sha256=1yIIDjk0jU1nInQypKFF-8wqjVVyuk-UzREzpL7GjVY,249
71
+ naeural_client/ipfs/ipfs_setup/show.sh,sha256=3EXyZppTNDrla0dH21m73s2lDNJXBAMn_DurYb30WfU,117
72
+ naeural_client/ipfs/ipfs_setup/write_key.sh,sha256=wLESi33j4UoSkXmYUUnI0kd9Sro6BMwtQp29UXxNVk4,164
65
73
  naeural_client/logging/__init__.py,sha256=b79X45VC6c37u32flKB2GAK9f-RR0ocwP0JDCy0t7QQ,33
66
74
  naeural_client/logging/base_logger.py,sha256=qqqMX30Vmh5Dz8YYaeL_ainQPTP5FsX1Y4QMbsIG5Rg,69599
67
75
  naeural_client/logging/small_logger.py,sha256=m12hCb_H4XifJYYfgCAOUDkcXm-h4pSODnFf277OFVI,2937
@@ -88,8 +96,8 @@ naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_L
88
96
  naeural_client/utils/config.py,sha256=lAbWe3UMi40BOdsAIZIb-fYtb4LwG3MIYg0EOA1ITr8,10340
89
97
  naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
90
98
  naeural_client/utils/oracle_sync/oracle_tester.py,sha256=X-923ccjkr6_kzbbiuAAcWSIhMtBDOH2VURjTh55apQ,27235
91
- naeural_client-2.7.42.dist-info/METADATA,sha256=_MgS-DeFCJsXJlhrvjUxxo2bzlFgs494DCfztb8JrOM,12354
92
- naeural_client-2.7.42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- naeural_client-2.7.42.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
94
- naeural_client-2.7.42.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
95
- naeural_client-2.7.42.dist-info/RECORD,,
99
+ naeural_client-3.0.0.dist-info/METADATA,sha256=tFFs2d77B_LkChWon4_SsC6V5AQIMAatH4gmJVHA_3c,12353
100
+ naeural_client-3.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
+ naeural_client-3.0.0.dist-info/entry_points.txt,sha256=CTua17GUrRa4aXeafezGC9TiWKGKQzwTjQmB2jyj22g,91
102
+ naeural_client-3.0.0.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
103
+ naeural_client-3.0.0.dist-info/RECORD,,