ethernity-cloud-sdk-py 0.2.0__tar.gz → 0.2.2__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.
Files changed (111) hide show
  1. {ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py.egg-info → ethernity_cloud_sdk_py-0.2.2}/PKG-INFO +19 -9
  2. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/README.md +18 -8
  3. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/__pycache__/build.cpython-311.pyc +0 -0
  4. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/__pycache__/config.cpython-311.pyc +0 -0
  5. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/__pycache__/init.cpython-311.pyc +0 -0
  6. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/__pycache__/private_key.cpython-311.pyc +0 -0
  7. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/__pycache__/publish.cpython-311.pyc +0 -0
  8. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/__pycache__/spinner.cpython-311.pyc +0 -0
  9. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/build.py +28 -15
  10. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/config.py +65 -0
  11. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/init.py +38 -101
  12. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/private_key.py +120 -0
  13. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/publish.py +293 -0
  14. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/build.cpython-311.pyc +0 -0
  15. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/ipfs_client.cpython-311.pyc +0 -0
  16. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/publish.cpython-311.pyc +0 -0
  17. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/runner.cpython-311.pyc +0 -0
  18. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/Dockerfile +51 -0
  19. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/Dockerfile.base +17 -0
  20. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/Dockerfile.base.tpl +17 -0
  21. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/Dockerfile.tpl +51 -0
  22. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/scripts/binary-fs-build.sh +3 -3
  23. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/etny_exec.py +102 -0
  24. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/securelock.py.tmpl +5 -5
  25. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/build.py +375 -0
  26. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/ipfs_client.py +184 -0
  27. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/publish.py +543 -0
  28. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/run/PUBLIC_KEY.txt +10 -0
  29. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/run/__pycache__/image_registry.cpython-311.pyc +0 -0
  30. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/run/__pycache__/public_key_service.cpython-311.pyc +0 -0
  31. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/run/cert.pem +32 -0
  32. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/docker-compose-final.yml +2 -2
  33. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/docker-compose-final.yml.tmpl +3 -3
  34. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/docker-compose.yml +2 -2
  35. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/docker-compose.yml.tmpl +3 -3
  36. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/etny-securelock-test.yaml +6 -6
  37. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/run/image_registry.py +322 -0
  38. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/image_registry_runner.py +2 -2
  39. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/run/key.pem +52 -0
  40. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/predecessor.json +1 -1
  41. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/pynithy/run/public_key_service.py +115 -0
  42. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/commands/spinner.py +69 -0
  43. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/templates/src/ethernity_task.py +43 -34
  44. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/templates/src/serverless/Dockerfile.serverless +7 -0
  45. ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py/templates/src/serverless/requirements.txt +5 -0
  46. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2/ethernity_cloud_sdk_py.egg-info}/PKG-INFO +19 -9
  47. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py.egg-info/SOURCES.txt +13 -4
  48. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/setup.py +1 -1
  49. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/__pycache__/build.cpython-311.pyc +0 -0
  50. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/__pycache__/init.cpython-311.pyc +0 -0
  51. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/__pycache__/publish.cpython-311.pyc +0 -0
  52. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/publish.py +0 -413
  53. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/build.cpython-311.pyc +0 -0
  54. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/ipfs_client.cpython-311.pyc +0 -0
  55. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/runner.cpython-311.pyc +0 -0
  56. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/build/scripts/binary-fs-build.sh +0 -28
  57. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/Dockerfile +0 -80
  58. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/Dockerfile.tmpl +0 -80
  59. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/etny_exec.py +0 -154
  60. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/build.py +0 -286
  61. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/ipfs_client.py +0 -257
  62. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/PUBLIC_KEY.txt +0 -10
  63. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/__pycache__/image_registry.cpython-311.pyc +0 -0
  64. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/__pycache__/public_key_service.cpython-311.pyc +0 -0
  65. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/cert.pem +0 -32
  66. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/certificate.securelock.crt +0 -10
  67. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/image_registry.py +0 -433
  68. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/key.pem +0 -52
  69. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/run/public_key_service.py +0 -97
  70. ethernity_cloud_sdk_py-0.2.0/ethernity_cloud_sdk_py/commands/pynithy/runner.py +0 -654
  71. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/LICENSE +0 -0
  72. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/MANIFEST.in +0 -0
  73. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/__init__.py +0 -0
  74. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/cli.py +0 -0
  75. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/__init__.py +0 -0
  76. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/__pycache__/__init__.cpython-311.pyc +0 -0
  77. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/__init__.py +0 -0
  78. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/__pycache__/__init__.cpython-311.pyc +0 -0
  79. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/cert1-ca1-clean.crt +0 -0
  80. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/cert1-ca1-clean.key +0 -0
  81. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/enclave_pub_cert.pem +0 -0
  82. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/input.txt +0 -0
  83. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/payload.py +0 -0
  84. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/public-cert-clean.pem +0 -0
  85. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/result.txt +0 -0
  86. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/app/transaction.txt +0 -0
  87. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/etny_crypto.py +0 -0
  88. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/image_registry.abi +0 -0
  89. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/key_generation.py +0 -0
  90. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/models.py +0 -0
  91. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/pox.abi +0 -0
  92. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/build/securelock/src/swift_stream_service.py +0 -0
  93. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/IPFS_DOCKER_COMPOSE_HASH.ipfs +0 -0
  94. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/IPFS_HASH.ipfs +0 -0
  95. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/__init__.py +0 -0
  96. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/__pycache__/__init__.cpython-311.pyc +0 -0
  97. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/certificate.trustedzone.crt +0 -0
  98. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/docker-compose-swift-stream.yml.tmpl +0 -0
  99. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/etny-pynity-test.yaml.tpl +0 -0
  100. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/etny-securelock-test.yaml.tpl +0 -0
  101. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/etny-trustedzone-test.yaml.tpl +0 -0
  102. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/commands/pynithy/run/image_registry.abi +0 -0
  103. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/templates/src/serverless/__init__.py +0 -0
  104. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py/templates/src/serverless/backend.py +0 -0
  105. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py.egg-info/dependency_links.txt +0 -0
  106. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py.egg-info/entry_points.txt +0 -0
  107. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py.egg-info/requires.txt +0 -0
  108. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/ethernity_cloud_sdk_py.egg-info/top_level.txt +0 -0
  109. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/setup.cfg +0 -0
  110. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/tests/__init__.py +0 -0
  111. {ethernity_cloud_sdk_py-0.2.0 → ethernity_cloud_sdk_py-0.2.2}/tests/test_example.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ethernity-cloud-sdk-py
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Ethernity Cloud SDK Python
5
5
  Home-page: https://github.com/ethernity-cloud/ethernity-cloud-sdk-py
6
6
  Author: Ethernity Cloud Team
@@ -31,6 +31,7 @@ This project provides a set of tools and scripts to work with the Ethernity Clou
31
31
 
32
32
  ## Table of Contents
33
33
 
34
+ - [Pre-requisites](#pre-requisites)
34
35
  - [Installation](#installation)
35
36
  - [Usage](#usage)
36
37
  - [Scripts](#scripts)
@@ -38,6 +39,22 @@ This project provides a set of tools and scripts to work with the Ethernity Clou
38
39
  - [Contributing](#contributing)
39
40
  - [License](#license)
40
41
 
42
+ ## Pre-requisites
43
+ Linux:
44
+ - build-essentials
45
+ - Python 3.10+
46
+ - docker
47
+ - docker-compose
48
+
49
+ Windows:
50
+ - Microsoft Visual Studio Community 2022+ (https://visualstudio.microsoft.com/)
51
+ - MSVC++ 14.3+ build tools
52
+ - C++ CMake tools for Windows
53
+ - Windows SDK (for current running version)
54
+ - Reboot required
55
+ - Python 3.13
56
+ - Docker Desktop
57
+
41
58
  ## Installation
42
59
 
43
60
  To install the package and its dependencies, run:
@@ -55,13 +72,6 @@ pip install ethernity-cloud-sdk-py
55
72
 
56
73
  After installation, you can use the provided scripts to build, publish, and initialize your project.
57
74
 
58
- ## Pre-requisites
59
- The sdk requires the following to be installed on your system:
60
- - python 3.10+
61
- - docker (daemon running in the background for build and publish scripts)
62
- - docker-compose (for the build and publish scripts)
63
-
64
-
65
75
  ## Operating System compatibility
66
76
  The sdk has been tested on the following operating systems:
67
77
  - Windows 10
@@ -145,7 +155,7 @@ def execute_task() -> None:
145
155
  code,
146
156
  "0xd58f5C1834279ABD601df85b3E4b2323aDD4E75e",
147
157
  resources,
148
- os.getenv("ENCLAVE_NAME_TRUSTEDZONE", ""),
158
+ os.getenv("TRUSTED_ZONE_IMAGE", ""),
149
159
  )
150
160
 
151
161
 
@@ -13,6 +13,7 @@ This project provides a set of tools and scripts to work with the Ethernity Clou
13
13
 
14
14
  ## Table of Contents
15
15
 
16
+ - [Pre-requisites](#pre-requisites)
16
17
  - [Installation](#installation)
17
18
  - [Usage](#usage)
18
19
  - [Scripts](#scripts)
@@ -20,6 +21,22 @@ This project provides a set of tools and scripts to work with the Ethernity Clou
20
21
  - [Contributing](#contributing)
21
22
  - [License](#license)
22
23
 
24
+ ## Pre-requisites
25
+ Linux:
26
+ - build-essentials
27
+ - Python 3.10+
28
+ - docker
29
+ - docker-compose
30
+
31
+ Windows:
32
+ - Microsoft Visual Studio Community 2022+ (https://visualstudio.microsoft.com/)
33
+ - MSVC++ 14.3+ build tools
34
+ - C++ CMake tools for Windows
35
+ - Windows SDK (for current running version)
36
+ - Reboot required
37
+ - Python 3.13
38
+ - Docker Desktop
39
+
23
40
  ## Installation
24
41
 
25
42
  To install the package and its dependencies, run:
@@ -37,13 +54,6 @@ pip install ethernity-cloud-sdk-py
37
54
 
38
55
  After installation, you can use the provided scripts to build, publish, and initialize your project.
39
56
 
40
- ## Pre-requisites
41
- The sdk requires the following to be installed on your system:
42
- - python 3.10+
43
- - docker (daemon running in the background for build and publish scripts)
44
- - docker-compose (for the build and publish scripts)
45
-
46
-
47
57
  ## Operating System compatibility
48
58
  The sdk has been tested on the following operating systems:
49
59
  - Windows 10
@@ -127,7 +137,7 @@ def execute_task() -> None:
127
137
  code,
128
138
  "0xd58f5C1834279ABD601df85b3E4b2323aDD4E75e",
129
139
  resources,
130
- os.getenv("ENCLAVE_NAME_TRUSTEDZONE", ""),
140
+ os.getenv("TRUSTED_ZONE_IMAGE", ""),
131
141
  )
132
142
 
133
143
 
@@ -1,22 +1,35 @@
1
1
  import os
2
2
  import sys
3
3
  import subprocess
4
+
4
5
  from pathlib import Path
5
- from dotenv import load_dotenv
6
+ from ethernity_cloud_sdk_py.commands.config import Config, config
7
+
8
+ config = Config(Path(".config.json").resolve())
9
+ config.load()
10
+
11
+
12
+ #print("Configuration loaded:", config.config)
6
13
 
7
14
 
8
15
  def main():
9
16
  # Load environment variables from .env file
10
- current_dir = os.getcwd()
11
- dotenv_path = os.path.join(current_dir, ".env")
12
- print(f"Looking for .env file at: {dotenv_path}")
13
- load_dotenv(dotenv_path=dotenv_path)
14
- service_type = os.getenv("SERVICE_TYPE")
15
- print(f"Service type: {service_type}")
17
+ version = config.read("VERSION")
18
+ project_name = config.read("PROJECT_NAME")
19
+ version += 1
20
+ #print("Incrementing version to", version)
21
+
22
+ config.write("VERSION", version)
23
+ config.write("IPFS_HASH", "")
24
+ service_type = config.read("SERVICE_TYPE")
25
+ print(f"""\u276f\u276f Initializing build process
26
+ Project name: {project_name}
27
+ Version: {version}""")
28
+
16
29
  if service_type == "Nodenithy":
17
- print("Adding prerequisites for Nodenithy...")
30
+ #print("Adding prerequisites for Nodenithy...")
18
31
  script_path = Path(__file__).resolve().parent / "nodenithy" / "build.py"
19
- print(f"Running script: {script_path}")
32
+ #print(f"Running script: {script_path}")
20
33
  try:
21
34
  subprocess.run(["python", str(script_path)], check=True)
22
35
  print(
@@ -24,13 +37,13 @@ def main():
24
37
  )
25
38
  except subprocess.CalledProcessError:
26
39
  print("Error running the build script.")
27
- sys.exit(1)
40
+ exit(1)
28
41
  elif service_type == "Pynithy":
29
- print("Adding prerequisites for Pynithy...")
42
+ #print("Adding prerequisites for Pynithy...")
30
43
  import ethernity_cloud_sdk_py.commands.pynithy.build as buildScript
31
44
 
32
45
  # script_path = Path(__file__).resolve().parent / "pynithy" / "build.py"
33
- print(f"Running script: buildScript")
46
+ #print(f"Running script: buildScript")
34
47
  # try:
35
48
  # subprocess.run(["python", str(script_path)], check=True)
36
49
  # print(
@@ -38,7 +51,7 @@ def main():
38
51
  # )
39
52
  # except subprocess.CalledProcessError:
40
53
  # print("Error running the build script.")
41
- # sys.exit(1)
54
+ # exit(1)
42
55
  try:
43
56
  buildScript.main()
44
57
  print(
@@ -50,10 +63,10 @@ Build process was successful! You can now proceed to publish by running:
50
63
  )
51
64
  except Exception as e:
52
65
  print(f"Error running the build script: {e}")
53
- sys.exit(1)
66
+ exit(1)
54
67
  else:
55
68
  print("Something went wrong")
56
- sys.exit(1)
69
+ exit(1)
57
70
 
58
71
 
59
72
  if __name__ == "__main__":
@@ -0,0 +1,65 @@
1
+ import json
2
+
3
+ class Config:
4
+ def __init__(self, file_path):
5
+ """
6
+ Initialize the Config class with the path to the configuration file.
7
+
8
+ Args:
9
+ file_path (str): Path to the JSON configuration file.
10
+ """
11
+ self.file_path = file_path
12
+ self.config = {}
13
+
14
+ def load(self):
15
+ """
16
+ Load the JSON configuration file into the class's dictionary.
17
+
18
+ Returns:
19
+ dict: The loaded configuration dictionary.
20
+ """
21
+ try:
22
+ with open(self.file_path, 'r') as f:
23
+ self.config = json.load(f)
24
+ if not isinstance(self.config, dict):
25
+ raise ValueError("JSON file must contain a dictionary.")
26
+ except FileNotFoundError:
27
+ print(f"File not found: {self.file_path}. Initializing with an empty configuration.")
28
+ self.config = {}
29
+ except json.JSONDecodeError as e:
30
+ print(f"Error decoding JSON file: {e}. Initializing with an empty configuration.")
31
+ self.config = {}
32
+ return self.config
33
+
34
+ def read(self, variable):
35
+ """
36
+ Read the value of a specific variable from the configuration.
37
+
38
+ Args:
39
+ variable (str): The variable key to retrieve.
40
+
41
+ Returns:
42
+ Any: The value associated with the variable, or None if not found.
43
+ """
44
+ return self.config.get(variable, None)
45
+
46
+ def write(self, variable, value):
47
+ """
48
+ Write or update a variable in the configuration and save it to the file.
49
+
50
+ Args:
51
+ variable (str): The variable key to write or update.
52
+ value (Any): The value to set for the variable.
53
+
54
+ Returns:
55
+ dict: The updated configuration dictionary.
56
+ """
57
+ self.config[variable] = value
58
+ try:
59
+ with open(self.file_path, 'w') as f:
60
+ json.dump(self.config, f, indent=4)
61
+ except Exception as e:
62
+ print(f"Error writing to file: {e}")
63
+ return self.config
64
+
65
+ config = None
@@ -4,7 +4,11 @@ import shutil
4
4
  import subprocess
5
5
  import re
6
6
  from pathlib import Path
7
- from dotenv import load_dotenv, set_key
7
+ from ethernity_cloud_sdk_py.commands.config import Config, config
8
+
9
+ config = Config(Path(".config.json").resolve())
10
+ config.load()
11
+
8
12
 
9
13
  # For accessing package resources
10
14
  try:
@@ -13,29 +17,19 @@ except ImportError:
13
17
  # For Python versions < 3.7
14
18
  from importlib_resources import path as resources_path # type: ignore
15
19
 
20
+ config = None
16
21
 
17
- def write_env(key, value, env_file=".env"):
18
- """
19
- Write or update key-value pairs in a .env file in the current working directory.
22
+ def initialize_config(file_path):
20
23
  """
21
- env_path = os.path.join(os.getcwd(), env_file)
22
- if not os.path.exists(env_path):
23
- with open(env_path, "w") as f:
24
- f.write(f"{key}={value}\n")
25
- else:
26
- replaced = False
27
- with open(env_path, "r") as f:
28
- lines = f.readlines()
29
- with open(env_path, "w") as f:
30
- for line in lines:
31
- if line.startswith(f"{key}="):
32
- f.write(f"{key}={value}\n")
33
- replaced = True
34
- else:
35
- f.write(line)
36
- if not replaced:
37
- f.write(f"{key}={value}\n")
24
+ Initialize the global config variable with the specified file path.
38
25
 
26
+ Args:
27
+ file_path (str): Path to the configuration file.
28
+ """
29
+ global config
30
+ config = Config(file_path)
31
+ config.load()
32
+ #print("Configuration loaded:", config.config)
39
33
 
40
34
  def get_project_name():
41
35
  """
@@ -132,30 +126,9 @@ def main():
132
126
  )
133
127
  import ethernity_cloud_sdk_py.commands.pynithy.run.image_registry as image_registry
134
128
 
135
- # Execute the external script (image_registry.py)
136
- # script_path = (
137
- # Path(__file__).resolve().parent / "pynithy" / "run" / "image_registry.py"
138
- # )
139
129
  print(f"Running script image_registry...")
140
130
  print(os.getcwd())
141
- # if not script_path.exists():
142
- # print(f"Error: Script {script_path} not found.")
143
- # sys.exit(1)
144
-
145
- # try:
146
- # subprocess.run(
147
- # [
148
- # "python",
149
- # str(script_path),
150
- # blockchain_network.replace(" ", "_"),
151
- # project_name.replace(" ", "-"),
152
- # "v3",
153
- # ],
154
- # check=True,
155
- # )
156
- # except subprocess.CalledProcessError as e:
157
- # print(f"Error executing script {script_path}")
158
- # sys.exit(1)
131
+
159
132
  image_registry.main(
160
133
  blockchain_network.replace(" ", "_"),
161
134
  project_name.replace(" ", "-"),
@@ -203,67 +176,35 @@ def main():
203
176
  shutil.copytree(
204
177
  src_path, os.path.join(os.getcwd(), "src"), dirs_exist_ok=True
205
178
  )
206
- # Simulate copying files
207
- # script_dir = os.path.dirname(os.path.abspath(__file__))
208
-
209
- # source_src = os.path.join(script_dir, "src")
210
- # target_src = "src/"
211
- # # source_public = os.path.join(script_dir, "public")
212
- # # target_public = "public/"
213
-
214
- # shutil.copytree(source_src, target_src, dirs_exist_ok=True)
215
- # shutil.copytree(source_public, target_public, dirs_exist_ok=True)
216
- # print("Installing required packages...")
217
- # # Simulate npm install
218
- # try:
219
- # subprocess.run(
220
- # [
221
- # "npm",
222
- # "install",
223
- # "@ethernity-cloud/runner@0.0.26",
224
- # "@testing-library/jest-dom@5.17.0",
225
- # "@testing-library/react@13.4.0",
226
- # "@testing-library/user-event@13.5.0",
227
- # "react@18.3.1",
228
- # "react-dom@18.3.1",
229
- # "react-scripts@5.0.1",
230
- # "web-vitals@2.1.4",
231
- # "web3@4.9.0",
232
- # "dotenv@16.4.5",
233
- # ],
234
- # check=True,
235
- # )
236
- # except subprocess.CalledProcessError as e:
237
- # print("Error installing npm packages.")
238
- # sys.exit(1)
179
+
239
180
  else:
240
181
  print(
241
182
  "Define backend functions in src/serverless to be available for cli interaction."
242
183
  )
243
184
 
244
- write_env("PROJECT_NAME", project_name.replace(" ", "_"))
245
- write_env("SERVICE_TYPE", service_type)
185
+ config.write("PROJECT_NAME", project_name.replace(" ", "_"))
186
+ config.write("SERVICE_TYPE", service_type)
246
187
  if service_type == "Custom":
247
- write_env("BASE_IMAGE_TAG", base_image_tag or "")
248
- write_env("DOCKER_REPO_URL", docker_repo_url)
249
- write_env("DOCKER_LOGIN", docker_login)
250
- write_env("DOCKER_PASSWORD", docker_password)
188
+ config.write("BASE_IMAGE_TAG", base_image_tag or "")
189
+ config.write("DOCKER_REPO_URL", docker_repo_url)
190
+ config.write("DOCKER_LOGIN", docker_login)
191
+ config.write("DOCKER_PASSWORD", docker_password)
251
192
  elif service_type == "Nodenithy":
252
- write_env("BASE_IMAGE_TAG", "")
253
- write_env("DOCKER_REPO_URL", "")
254
- write_env("DOCKER_LOGIN", "")
255
- write_env("DOCKER_PASSWORD", "")
193
+ config.write("BASE_IMAGE_TAG", "")
194
+ config.write("DOCKER_REPO_URL", "")
195
+ config.write("DOCKER_LOGIN", "")
196
+ config.write("DOCKER_PASSWORD", "")
256
197
  elif service_type == "Pynithy":
257
- write_env("BASE_IMAGE_TAG", "")
258
- write_env("DOCKER_REPO_URL", "")
259
- write_env("DOCKER_LOGIN", "")
260
- write_env("DOCKER_PASSWORD", "")
261
- write_env("BLOCKCHAIN_NETWORK", blockchain_network.replace(" ", "_"))
262
- write_env("IPFS_ENDPOINT", custom_url)
263
- write_env("IPFS_TOKEN", ipfs_token or "")
264
- write_env("VERSION", "v1")
265
-
266
- write_env(
198
+ config.write("BASE_IMAGE_TAG", "")
199
+ config.write("DOCKER_REPO_URL", "")
200
+ config.write("DOCKER_LOGIN", "")
201
+ config.write("DOCKER_PASSWORD", "")
202
+ config.write("BLOCKCHAIN_NETWORK", blockchain_network.replace(" ", "_"))
203
+ config.write("IPFS_ENDPOINT", custom_url)
204
+ config.write("IPFS_TOKEN", ipfs_token or "")
205
+ config.write("VERSION", "v1")
206
+
207
+ config.write(
267
208
  "TRUSTED_ZONE_IMAGE",
268
209
  f"{'ecld' if 'polygon' in blockchain_network.lower() else 'etny'}-{service_type.lower()}-{'testnet' if 'testnet' in blockchain_network.lower() else ''}",
269
210
  )
@@ -280,8 +221,4 @@ To start the build process run:
280
221
 
281
222
  ecld-build
282
223
  """
283
- )
284
-
285
-
286
- if __name__ == "__main__":
287
- main()
224
+ )
@@ -0,0 +1,120 @@
1
+ from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
2
+ from cryptography.hazmat.backends import default_backend
3
+ from cryptography.hazmat.primitives import hashes
4
+ from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
5
+ from cryptography.hazmat.primitives import padding
6
+ from web3 import Web3
7
+ from eth_account import Account
8
+ import os
9
+ import base64
10
+
11
+ from pathlib import Path
12
+ from ethernity_cloud_sdk_py.commands.config import Config, config
13
+
14
+ config = Config(Path(".config.json").resolve())
15
+ config.load()
16
+
17
+
18
+ # Constants for key derivation
19
+ SALT_LENGTH = 16 # Length of the salt
20
+ ITERATIONS = 100000 # PBKDF2 iterations
21
+ KEY_LENGTH = 32 # AES 256-bit key
22
+
23
+ class PrivateKeyManager:
24
+ def __init__(self, password: str):
25
+ """Initialize with a password for key derivation."""
26
+ self.password = password
27
+
28
+ def derive_key(self, salt: bytes) -> bytes:
29
+ """Derive a key from the password using PBKDF2."""
30
+ kdf = PBKDF2HMAC(
31
+ algorithm=hashes.SHA256(),
32
+ length=KEY_LENGTH,
33
+ salt=salt,
34
+ iterations=ITERATIONS,
35
+ backend=default_backend()
36
+ )
37
+ return kdf.derive(self.password.encode())
38
+
39
+ def encrypt_private_key(self, private_key: str) -> str:
40
+ """Encrypt the private key using the password."""
41
+ salt = os.urandom(SALT_LENGTH) # Generate a random salt
42
+ key = self.derive_key(salt)
43
+
44
+ # Create AES cipher
45
+ iv = os.urandom(16) # AES block size is 16 bytes
46
+ cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=default_backend())
47
+ encryptor = cipher.encryptor()
48
+
49
+ # Pad the private key to be a multiple of the block size
50
+ padder = padding.PKCS7(algorithms.AES.block_size).padder()
51
+ padded_data = padder.update(private_key.encode()) + padder.finalize()
52
+
53
+ # Encrypt the private key
54
+ encrypted_private_key = encryptor.update(padded_data) + encryptor.finalize()
55
+
56
+ # Return the encrypted key and salt (base64-encoded for storage)
57
+ return base64.b64encode(salt + iv + encrypted_private_key).decode()
58
+
59
+ def decrypt_private_key(self, encrypted_private_key: str) -> str:
60
+ """Decrypt the private key using the password."""
61
+ # Decode the base64-encoded data
62
+ data = base64.b64decode(encrypted_private_key)
63
+
64
+ # Extract the salt, IV, and the encrypted private key from the data
65
+ salt = data[:SALT_LENGTH]
66
+ iv = data[SALT_LENGTH:SALT_LENGTH + 16]
67
+ encrypted_data = data[SALT_LENGTH + 16:]
68
+
69
+ # Derive the key from the password and salt
70
+ key = self.derive_key(salt)
71
+
72
+ # Create AES cipher
73
+ cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=default_backend())
74
+ decryptor = cipher.decryptor()
75
+
76
+ # Decrypt the private key
77
+ decrypted_data = decryptor.update(encrypted_data) + decryptor.finalize()
78
+
79
+ # Unpad the decrypted data
80
+ unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
81
+ private_key = unpadder.update(decrypted_data) + unpadder.finalize()
82
+
83
+ return private_key.decode()
84
+
85
+ def extract_address_from_private_key(self, private_key: str) -> str:
86
+ """
87
+ Extract the Ethereum address from a given private key.
88
+
89
+ Args:
90
+ private_key (str): The Ethereum private key in hexadecimal format (without the "0x" prefix).
91
+
92
+ Returns:
93
+ str: The Ethereum address derived from the private key.
94
+ """
95
+ #w3 = Web3(Web3.HTTPProvider(config.read("NETWORK_RPC")))
96
+
97
+
98
+ # Ensure the private key is in the correct format
99
+ if not private_key.startswith('0x'):
100
+ private_key = '0x' + private_key
101
+
102
+ # Use the private key to get the account and address
103
+ account = Account().from_key(private_key)
104
+
105
+ return account.address
106
+
107
+ # Example usage
108
+ #password = "mySecurePassword123"
109
+ #private_key = "77d6DDD127fe3a2bb79df2a02f0f408339"
110
+
111
+ # Create an instance of PrivateKeyManager
112
+ #key_manager = PrivateKeyManager(password)
113
+
114
+ # Encrypt the private key
115
+ #encrypted_key = key_manager.encrypt_private_key(private_key)
116
+ #print(f"Encrypted Private Key: {encrypted_key}")
117
+
118
+ # Decrypt the private key (this will prompt for the password)
119
+ #decrypted_key = key_manager.decrypt_private_key(encrypted_key)
120
+ #print(f"Decrypted Private Key: {decrypted_key}")