@ethernity-cloud/sdk-js 1.1.0

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 (184) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +185 -0
  3. package/build.js +22 -0
  4. package/init.js +301 -0
  5. package/nodenithy/build/las/Dockerfile +5 -0
  6. package/nodenithy/build/securelock/Dockerfile.tmpl +65 -0
  7. package/nodenithy/build/securelock/scripts/binary-fs-build.sh +28 -0
  8. package/nodenithy/build/securelock/src/.env +3 -0
  9. package/nodenithy/build/securelock/src/etny_crypto.js +201 -0
  10. package/nodenithy/build/securelock/src/etny_exec.js +65 -0
  11. package/nodenithy/build/securelock/src/image_registry_abi.js +808 -0
  12. package/nodenithy/build/securelock/src/models.js +261 -0
  13. package/nodenithy/build/securelock/src/package.json +40 -0
  14. package/nodenithy/build/securelock/src/pox_abi.js +1491 -0
  15. package/nodenithy/build/securelock/src/securelock.js.tmpl +421 -0
  16. package/nodenithy/build/securelock/src/swift_stream_service.js +147 -0
  17. package/nodenithy/build/securelock/src/task_status.js +15 -0
  18. package/nodenithy/build/securelock/src/wallet.js +29 -0
  19. package/nodenithy/build/squash/Dockerfile +7 -0
  20. package/nodenithy/build/trustedzone/Dockerfile.tmpl +57 -0
  21. package/nodenithy/build/trustedzone/scripts/binary-fs-build.sh +22 -0
  22. package/nodenithy/build/trustedzone/src/.env +3 -0
  23. package/nodenithy/build/trustedzone/src/etny_crypto.js +202 -0
  24. package/nodenithy/build/trustedzone/src/etny_exec.js +54 -0
  25. package/nodenithy/build/trustedzone/src/image_registry_abi.js +808 -0
  26. package/nodenithy/build/trustedzone/src/models.js +261 -0
  27. package/nodenithy/build/trustedzone/src/package.json +40 -0
  28. package/nodenithy/build/trustedzone/src/pox_abi.js +1491 -0
  29. package/nodenithy/build/trustedzone/src/swift_stream_service.js +147 -0
  30. package/nodenithy/build/trustedzone/src/task_status.js +15 -0
  31. package/nodenithy/build/trustedzone/src/test.js +44 -0
  32. package/nodenithy/build/trustedzone/src/trustedzone.js.tmpl +508 -0
  33. package/nodenithy/build/trustedzone/src/wallet.js +28 -0
  34. package/nodenithy/build/validator/Dockerfile +58 -0
  35. package/nodenithy/build/validator/package-lock.json +6 -0
  36. package/nodenithy/build/validator/scripts/binary-fs-build.sh +19 -0
  37. package/nodenithy/build/validator/src/.env +3 -0
  38. package/nodenithy/build/validator/src/cert.pem +5 -0
  39. package/nodenithy/build/validator/src/etny_crypto.js +204 -0
  40. package/nodenithy/build/validator/src/etny_exec.js +52 -0
  41. package/nodenithy/build/validator/src/image_registry_abi.js +808 -0
  42. package/nodenithy/build/validator/src/key.pem +6 -0
  43. package/nodenithy/build/validator/src/models.js +261 -0
  44. package/nodenithy/build/validator/src/package-lock.json +2498 -0
  45. package/nodenithy/build/validator/src/package.json +40 -0
  46. package/nodenithy/build/validator/src/pox_abi.js +1491 -0
  47. package/nodenithy/build/validator/src/swift_stream_service.js +147 -0
  48. package/nodenithy/build/validator/src/task_status.js +15 -0
  49. package/nodenithy/build/validator/src/test.js +44 -0
  50. package/nodenithy/build/validator/src/trustedzone.js +613 -0
  51. package/nodenithy/build/validator/src/validator_abi.js +834 -0
  52. package/nodenithy/build/validator/src/wallet.js +28 -0
  53. package/nodenithy/build.js +184 -0
  54. package/nodenithy/build.mjs +179 -0
  55. package/nodenithy/build.sh +161 -0
  56. package/nodenithy/ipfs.js +135 -0
  57. package/nodenithy/ipfs.mjs +551 -0
  58. package/nodenithy/public/favicon.ico +0 -0
  59. package/nodenithy/public/index.html +43 -0
  60. package/nodenithy/public/logo192.png +0 -0
  61. package/nodenithy/public/logo512.png +0 -0
  62. package/nodenithy/public/manifest.json +25 -0
  63. package/nodenithy/public/robots.txt +3 -0
  64. package/nodenithy/run/__pycache__/swift_stream_service.cpython-312.pyc +0 -0
  65. package/nodenithy/run/app/input.txt +4 -0
  66. package/nodenithy/run/app/payload.js +4 -0
  67. package/nodenithy/run/docker-compose-final.yml.tmpl +65 -0
  68. package/nodenithy/run/docker-compose-swift-stream.yml +17 -0
  69. package/nodenithy/run/docker-compose.yml.tmpl +76 -0
  70. package/nodenithy/run/etny-securelock-test.yaml.tpl +46 -0
  71. package/nodenithy/run/etny-trustedzone-test.yaml.tpl +45 -0
  72. package/nodenithy/run/git.sh +22 -0
  73. package/nodenithy/run/image_registry.abi +1 -0
  74. package/nodenithy/run/image_registry.js +372 -0
  75. package/nodenithy/run/image_registry.py +327 -0
  76. package/nodenithy/run/image_registry_runner.py +71 -0
  77. package/nodenithy/run/ipfs.sh +58 -0
  78. package/nodenithy/run/ipfs_pre.sh +75 -0
  79. package/nodenithy/run/public_key_service.js +90 -0
  80. package/nodenithy/run/public_key_service.py +107 -0
  81. package/nodenithy/run/swift_stream_service.py +212 -0
  82. package/nodenithy/run/swiftstream.py +37 -0
  83. package/nodenithy/run/swiftstream1.py +27 -0
  84. package/nodenithy/run.js +538 -0
  85. package/nodenithy/run.sh +277 -0
  86. package/nodenithy/scripts/build-ipfs-upload.sh +23 -0
  87. package/nodenithy/scripts/build.sh +40 -0
  88. package/nodenithy/scripts/ipfs-daemon.sh +7 -0
  89. package/nodenithy/scripts/run.sh +50 -0
  90. package/nodenithy/src/App.css +57 -0
  91. package/nodenithy/src/ec_helloworld_example.js +64 -0
  92. package/nodenithy/src/index.css +13 -0
  93. package/nodenithy/src/index.js +17 -0
  94. package/nodenithy/src/preStart.js +45 -0
  95. package/nodenithy/src/preStart.mjs +57 -0
  96. package/nodenithy/src/reportWebVitals.js +13 -0
  97. package/nodenithy/src/serverless/backend.js +5 -0
  98. package/package.json +48 -0
  99. package/postinstall.js +34 -0
  100. package/publish.js +126 -0
  101. package/pynithy/build/docker-compose.yml +68 -0
  102. package/pynithy/build/las/Dockerfile +11 -0
  103. package/pynithy/build/las/src/etny_entrypoint.sh +6 -0
  104. package/pynithy/build/las/src/las_entrypoint.sh +26 -0
  105. package/pynithy/build/scripts/binary-fs-build.sh +28 -0
  106. package/pynithy/build/securelock/Dockerfile.tmpl +78 -0
  107. package/pynithy/build/securelock/scripts/binary-fs-build.sh +41 -0
  108. package/pynithy/build/securelock/src/app/.env +5 -0
  109. package/pynithy/build/securelock/src/app/cert1-ca1-clean.crt +10 -0
  110. package/pynithy/build/securelock/src/app/cert1-ca1-clean.key +6 -0
  111. package/pynithy/build/securelock/src/app/enclave_pub_cert.pem +10 -0
  112. package/pynithy/build/securelock/src/app/input.txt +1 -0
  113. package/pynithy/build/securelock/src/app/payload.py +25 -0
  114. package/pynithy/build/securelock/src/app/public-cert-clean.pem +10 -0
  115. package/pynithy/build/securelock/src/app/result.txt +1 -0
  116. package/pynithy/build/securelock/src/app/transaction.txt +1 -0
  117. package/pynithy/build/securelock/src/etny_crypto.py +167 -0
  118. package/pynithy/build/securelock/src/etny_exec.py +79 -0
  119. package/pynithy/build/securelock/src/image_registry.abi +1 -0
  120. package/pynithy/build/securelock/src/key_generation.py +17 -0
  121. package/pynithy/build/securelock/src/models.py +176 -0
  122. package/pynithy/build/securelock/src/pox.abi +1489 -0
  123. package/pynithy/build/securelock/src/securelock.py.tmpl +411 -0
  124. package/pynithy/build/securelock/src/swift_stream_service.py +186 -0
  125. package/pynithy/build/trustedzone/Dockerfile.tmpl +56 -0
  126. package/pynithy/build/trustedzone/scripts/binary-fs-build.sh +32 -0
  127. package/pynithy/build/trustedzone/src/app/.env +5 -0
  128. package/pynithy/build/trustedzone/src/app/cert1-ca1-clean.crt +10 -0
  129. package/pynithy/build/trustedzone/src/app/cert1-ca1-clean.key +6 -0
  130. package/pynithy/build/trustedzone/src/app/enclave_pub_cert.pem +10 -0
  131. package/pynithy/build/trustedzone/src/app/input.txt +1 -0
  132. package/pynithy/build/trustedzone/src/app/payload.py +25 -0
  133. package/pynithy/build/trustedzone/src/app/public-cert-clean.pem +10 -0
  134. package/pynithy/build/trustedzone/src/app/result.txt +1 -0
  135. package/pynithy/build/trustedzone/src/app/securelock.crt +10 -0
  136. package/pynithy/build/trustedzone/src/app/transaction.txt +1 -0
  137. package/pynithy/build/trustedzone/src/app/trustedzone.crt +10 -0
  138. package/pynithy/build/trustedzone/src/etny_crypto.py +188 -0
  139. package/pynithy/build/trustedzone/src/etny_exec.py +56 -0
  140. package/pynithy/build/trustedzone/src/formatter.py +42 -0
  141. package/pynithy/build/trustedzone/src/image_registry.abi +1 -0
  142. package/pynithy/build/trustedzone/src/key_generation.py +17 -0
  143. package/pynithy/build/trustedzone/src/models.py +176 -0
  144. package/pynithy/build/trustedzone/src/pox.abi +1489 -0
  145. package/pynithy/build/trustedzone/src/swift_stream_service.py +186 -0
  146. package/pynithy/build/trustedzone/src/trustedzone.py.tmpl +460 -0
  147. package/pynithy/build.mjs +179 -0
  148. package/pynithy/docker-compose.yml +0 -0
  149. package/pynithy/ipfs.mjs +244 -0
  150. package/pynithy/public/favicon.ico +0 -0
  151. package/pynithy/public/index.html +43 -0
  152. package/pynithy/public/logo192.png +0 -0
  153. package/pynithy/public/logo512.png +0 -0
  154. package/pynithy/public/manifest.json +25 -0
  155. package/pynithy/public/robots.txt +3 -0
  156. package/pynithy/run/certs/cert.pem +31 -0
  157. package/pynithy/run/certs/challenge.crt +10 -0
  158. package/pynithy/run/certs/key.pem +52 -0
  159. package/pynithy/run/docker-compose-final.yml +59 -0
  160. package/pynithy/run/docker-compose-final.yml.tmpl +59 -0
  161. package/pynithy/run/docker-compose-swift-stream.yml +27 -0
  162. package/pynithy/run/docker-compose-swift-stream.yml.tmpl +27 -0
  163. package/pynithy/run/docker-compose.yml +55 -0
  164. package/pynithy/run/docker-compose.yml.tmpl +55 -0
  165. package/pynithy/run/etny-pynity-test.yaml.tpl +46 -0
  166. package/pynithy/run/etny-securelock-test.yaml.tpl +46 -0
  167. package/pynithy/run/etny-trustedzone-test.yaml.tpl +46 -0
  168. package/pynithy/run/git.sh +22 -0
  169. package/pynithy/run/image_registry.abi +1 -0
  170. package/pynithy/run/image_registry.js +372 -0
  171. package/pynithy/run/image_registry.py +139 -0
  172. package/pynithy/run/image_registry_runner.py +45 -0
  173. package/pynithy/run/ipfs.sh +89 -0
  174. package/pynithy/run/public_key_service.js +90 -0
  175. package/pynithy/run/swiftstream.py +28 -0
  176. package/pynithy/run.js +538 -0
  177. package/pynithy/src/App.css +57 -0
  178. package/pynithy/src/ec_helloworld_example.js +64 -0
  179. package/pynithy/src/index.css +13 -0
  180. package/pynithy/src/index.js +17 -0
  181. package/pynithy/src/preStart.mjs +57 -0
  182. package/pynithy/src/reportWebVitals.js +13 -0
  183. package/pynithy/src/serverless/__init__.py +0 -0
  184. package/pynithy/src/serverless/backend.py +2 -0
@@ -0,0 +1,277 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ # Source environment variables
6
+ if [ -f .env ]; then
7
+ source .env
8
+ else
9
+ echo "Error: .env file not found"
10
+ exit 1
11
+ fi
12
+
13
+ write_env() {
14
+ local key=$1
15
+ local value=$2
16
+ local env_file="$current_dir/.env"
17
+
18
+ # Check if the .env file exists
19
+ if [[ -f $env_file ]]; then
20
+ # Check if the key exists in the .env file
21
+ if grep -q "^${key}=" "$env_file"; then
22
+ # Update the existing key with the new value
23
+ sed -i '' "s/^${key}=.*/${key}=${value}/" "$env_file"
24
+ else
25
+ # Add the new key-value pair to the .env file
26
+ echo "${key}=${value}" >> "$env_file"
27
+ fi
28
+ else
29
+ # Create the .env file and add the key-value pair
30
+ echo "${key}=${value}" > "$env_file"
31
+ fi
32
+ }
33
+
34
+ current_dir=$(pwd)
35
+ echo "current_dir: $current_dir"
36
+
37
+ # Set up local registry path
38
+ export REGISTRY_PATH=${PWD}/registry
39
+
40
+
41
+ # check for sgx compatible machine
42
+ # check if image name is available in smart contract
43
+
44
+
45
+ RUNNER_TYPE="nodenithy"
46
+ echo "VERSION = ${VERSION}"
47
+
48
+ cd ${PWD}/node_modules/ethernity-cloud-sdk-js/nodenithy/run
49
+
50
+ echo "ETNY MODE: ${ETNY_MODE}"
51
+
52
+ # Determine MRENCLAVE values
53
+ export MRENCLAVE_SECURELOCK=$(docker-compose run -e SCONE_LOG=INFO -e SCONE_HASH=1 etny-securelock | grep -v Creating | grep -v Pulling | grep -v latest | grep -v Digest | tr -d '\r')
54
+ export MRENCLAVE_TRUSTEDZONE=$(docker-compose run -e SCONE_LOG=INFO -e SCONE_HASH=1 etny-trustedzone | grep -v Creating | grep -v Pulling | grep -v latest | grep -v Digest | tr -d '\r')
55
+ export MRENCLAVE_VALIDATOR=$(docker-compose run -e SCONE_LOG=INFO -e SCONE_HASH=1 etny-validator | grep -v Creating | grep -v Pulling | grep -v latest | grep -v Digest | tr -d '\r')
56
+
57
+ echo "MRENCLAVE_SECURELOCK: ${MRENCLAVE_SECURELOCK}"
58
+ echo "MRENCLAVE_TRUSTEDZONE: ${MRENCLAVE_TRUSTEDZONE}"
59
+ echo "MRENCLAVE_VALIDATOR: ${MRENCLAVE_VALIDATOR}"
60
+
61
+ write_env "MRENCLAVE_SECURELOCK" "${MRENCLAVE_SECURELOCK}"
62
+ write_env "MRENCLAVE_TRUSTEDZONE" "${MRENCLAVE_TRUSTEDZONE}"
63
+ write_env "MRENCLAVE_VALIDATOR" "${MRENCLAVE_VALIDATOR}"
64
+
65
+ export CI_COMMIT_BRANCH = ${PROJECT_NAME}
66
+ # Generate enclave names
67
+ ENCLAVE_NAME_SECURELOCK=$(echo ${ENCLAVE_NAME_SECURELOCK} | awk '{print toupper($0)}' | sed 's#/#_#g' | sed 's#-#_#g')
68
+ PREDECESSOR_NAME_SECURELOCK=$(echo PREDECESSOR_SECURELOCK_${VERSION}_${CI_COMMIT_BRANCH} | awk '{print toupper($0)}' | sed 's#/#_#g' | sed 's#-#_#g')
69
+
70
+ echo
71
+ echo "ENCLAVE_NAME_SECURELOCK: ${ENCLAVE_NAME_SECURELOCK}"
72
+ echo "PREDECESSOR_NAME_SECURELOCK: ${PREDECESSOR_NAME_SECURELOCK}"
73
+ write_env "PREDECESSOR_NAME_SECURELOCK" "${PREDECESSOR_NAME_SECURELOCK}"
74
+ echo
75
+
76
+ export ENCLAVE_NAME_SECURELOCK
77
+ # write_env "ENCLAVE_NAME_SECURELOCK" "${ENCLAVE_NAME_SECURELOCK}"
78
+
79
+ PREDECESSOR_HASH_SECURELOCK=$(eval "echo \${$PREDECESSOR_NAME_SECURELOCK}")
80
+
81
+ # Set default values only if environment variables are not set
82
+ PREDECESSOR_HASH_SECURELOCK=${PREDECESSOR_HASH_SECURELOCK:-"EMPTY"}
83
+
84
+ # Debug: Print environment variables
85
+ echo "PREDECESSOR_HASH_SECURELOCK: ${PREDECESSOR_HASH_SECURELOCK}"
86
+ echo "MRENCLAVE_SECURELOCK: ${MRENCLAVE_SECURELOCK}"
87
+ echo "ENCLAVE_NAME_SECURELOCK: ${ENCLAVE_NAME_SECURELOCK}"
88
+
89
+ # Process etny-securelock-test.yaml
90
+ if [ ! -f etny-securelock-test.yaml.tpl ]; then
91
+ echo "Error: Template file etny-securelock-test.yaml.tpl not found!"
92
+ exit 1
93
+ fi
94
+
95
+ if [ "${PREDECESSOR_HASH_SECURELOCK}" = "EMPTY" ]; then
96
+ sed -e "s|__PREDECESSOR__ |#predecessor: ${PREDECESSOR_HASH_SECURELOCK}|g" \
97
+ -e "s|__MRENCLAVE__|${MRENCLAVE_SECURELOCK}|g" \
98
+ -e "s|__ENCLAVE_NAME__|${ENCLAVE_NAME_SECURELOCK}|g" \
99
+ etny-securelock-test.yaml.tpl > etny-securelock-test.yaml
100
+ else
101
+ sed -e "s|__PREDECESSOR__|predecessor: ${PREDECESSOR_HASH_SECURELOCK}|g" \
102
+ -e "s|__MRENCLAVE__|${MRENCLAVE_SECURELOCK}|g" \
103
+ -e "s|__ENCLAVE_NAME__|${ENCLAVE_NAME_SECURELOCK}|g" \
104
+ etny-securelock-test.yaml.tpl > etny-securelock-test.yaml
105
+ fi
106
+
107
+ echo "Contents of etny-securelock-test.yaml:"
108
+ cat etny-securelock-test.yaml
109
+
110
+ echo "Checking for remaining placeholders:"
111
+ grep -n "__.*__" etny-securelock-test.yaml || echo "No placeholders found."
112
+
113
+ echo "##############################################################################################################"
114
+
115
+ ENCLAVE_NAME_TRUSTEDZONE=$(echo ${ENCLAVE_NAME_TRUSTEDZONE} | awk '{print toupper($0)}' | sed 's#/#_#g' | sed 's#-#_#g')
116
+ PREDECESSOR_NAME_TRUSTEDZONE=$(echo PREDECESSOR_TRUSTEDZONE_${VERSION}_${CI_COMMIT_BRANCH} | awk '{print toupper($0)}' | sed 's#/#_#g' | sed 's#-#_#g')
117
+
118
+ echo
119
+ echo "ENCLAVE_NAME_TRUSTEDZONE: ${ENCLAVE_NAME_TRUSTEDZONE}"
120
+ echo "PREDECESSOR_NAME_TRUSTEDZONE: ${PREDECESSOR_NAME_TRUSTEDZONE}"
121
+ echo
122
+
123
+ export ENCLAVE_NAME_TRUSTEDZONE
124
+ # write_env "ENCLAVE_NAME_TRUSTEDZONE" "${ENCLAVE_NAME_TRUSTEDZONE}"
125
+
126
+ PREDECESSOR_HASH_TRUSTEDZONE=$(eval "echo \${$PREDECESSOR_NAME_TRUSTEDZONE}")
127
+ PREDECESSOR_HASH_TRUSTEDZONE=${PREDECESSOR_HASH_TRUSTEDZONE:-"EMPTY"}
128
+
129
+ # Debug: Print environment variables
130
+ echo "PREDECESSOR_HASH_TRUSTEDZONE: ${PREDECESSOR_HASH_TRUSTEDZONE}"
131
+ echo "MRENCLAVE_TRUSTEDZONE: ${MRENCLAVE_TRUSTEDZONE}"
132
+ echo "MRENCLAVE_VALIDATOR: ${MRENCLAVE_VALIDATOR}"
133
+ echo "ENCLAVE_NAME_TRUSTEDZONE: ${ENCLAVE_NAME_TRUSTEDZONE}"
134
+
135
+ # Process etny-trustedzone-test.yaml
136
+ if [ ! -f etny-trustedzone-test.yaml.tpl ]; then
137
+ echo "Error: Template file etny-trustedzone-test.yaml.tpl not found!"
138
+ exit 1
139
+ fi
140
+
141
+ if [ "${PREDECESSOR_HASH_TRUSTEDZONE}" = "EMPTY" ]; then
142
+ sed -e "s|__PREDECESSOR__|# predecessor: ${PREDECESSOR_HASH_TRUSTEDZONE}|g" \
143
+ -e "s|__MRENCLAVE__|${MRENCLAVE_TRUSTEDZONE}|g" \
144
+ -e "s|__MRENCLAVE_VALIDATOR__|${MRENCLAVE_VALIDATOR}|g" \
145
+ -e "s|__ENCLAVE_NAME__|${ENCLAVE_NAME_TRUSTEDZONE}|g" \
146
+ etny-trustedzone-test.yaml.tpl > etny-trustedzone-test.yaml
147
+ else
148
+ sed -e "s|__PREDECESSOR__|predecessor: ${PREDECESSOR_HASH_TRUSTEDZONE}|g" \
149
+ -e "s|__MRENCLAVE__|${MRENCLAVE_TRUSTEDZONE}|g" \
150
+ -e "s|__MRENCLAVE_VALIDATOR__|${MRENCLAVE_VALIDATOR}|g" \
151
+ -e "s|__ENCLAVE_NAME__|${ENCLAVE_NAME_TRUSTEDZONE}|g" \
152
+ etny-trustedzone-test.yaml.tpl > etny-trustedzone-test.yaml
153
+ fi
154
+
155
+ echo "Contents of etny-trustedzone-test.yaml:"
156
+ cat etny-trustedzone-test.yaml
157
+
158
+ echo "Checking for remaining placeholders:"
159
+ grep -n "__.*__" etny-trustedzone-test.yaml || echo "No placeholders found."
160
+
161
+ echo "# Update docker-compose files"
162
+
163
+ # Update docker-compose files
164
+ for file in docker-compose.yml docker-compose-final.yml; do
165
+ if [ ! -f "$file" ]; then
166
+ echo "Error: $file not found!"
167
+ continue
168
+ fi
169
+
170
+ echo "Processing $file"
171
+ echo "ENCLAVE_NAME_SECURELOCK: ${ENCLAVE_NAME_SECURELOCK}"
172
+ echo "ENCLAVE_NAME_TRUSTEDZONE: ${ENCLAVE_NAME_TRUSTEDZONE}"
173
+
174
+ echo "Checking for placeholders before replacement:"
175
+ grep "__ENCLAVE_NAME_SECURELOCK__" "$file" || echo "No __ENCLAVE_NAME_SECURELOCK__ found in $file"
176
+ grep "__ENCLAVE_NAME_TRUSTEDZONE__" "$file" || echo "No __ENCLAVE_NAME_TRUSTEDZONE__ found in $file"
177
+
178
+ sed -i '' -e "s|__ENCLAVE_NAME_SECURELOCK__|${ENCLAVE_NAME_SECURELOCK}|g" \
179
+ -e "s|__ENCLAVE_NAME_TRUSTEDZONE__|${ENCLAVE_NAME_TRUSTEDZONE}|g" \
180
+ "$file"
181
+
182
+ echo "Checking for placeholders after replacement:"
183
+ grep "__ENCLAVE_NAME_SECURELOCK__" "$file" || echo "No __ENCLAVE_NAME_SECURELOCK__ found in $file"
184
+ grep "__ENCLAVE_NAME_TRUSTEDZONE__" "$file" || echo "No __ENCLAVE_NAME_TRUSTEDZONE__ found in $file"
185
+
186
+ echo "Contents of $file:"
187
+ cat "$file"
188
+ echo
189
+ done
190
+
191
+ # export binaries hashes from scontain base image (node/python)
192
+ # use them allong with the ipfs hash of the uploaded registry artefact
193
+
194
+ # Get PUBLIC_KEY for SECURELOCK
195
+ export PUBLIC_KEY_SECURELOCK_RES=$(docker-compose run etny-securelock | grep -v Creating | grep -v Pulling | grep -v latest | grep -v Digest | sed 's/.*PUBLIC_KEY:\s*//' | tr -d '\r')
196
+
197
+ echo "PUBLIC_KEY_SECURELOCK_RES: ${PUBLIC_KEY_SECURELOCK_RES}"
198
+
199
+
200
+ # Check if PUBLIC_KEY_SECURELOCK_RES is empty
201
+ if [ -z "${PUBLIC_KEY_SECURELOCK_RES}" ]; then
202
+ echo
203
+ echo
204
+ echo "It seams that your machine is not SGX compatible."
205
+ echo
206
+ echo "Do you want to continue by generating the necesary certificates using the Ethernity Cloud signing service? (yes/no)"
207
+ read -p "Select an option (default is no): " REPLY
208
+ if [[ -z "$REPLY" ]]; then
209
+ echo "No option selected. Exiting."
210
+ exit 1
211
+ elif [[ "$REPLY" == "yes" ]]; then
212
+ echo
213
+ echo "Generating certificates using the Ethernity Cloud signing service..."
214
+ echo
215
+ echo "**** Started ipfs initial pining ****"
216
+ if [ -f ipfs.sh ]; then
217
+ chmod +x ipfs_pre.sh
218
+ ./ipfs_pre.sh
219
+ else
220
+ echo "Warning: ipfs_pre.sh not found. Skipping IPFS setup."
221
+ fi
222
+ echo "**** Finished ipfs initial pining ****"
223
+ echo "ENCLAVE_NAME_SECURELOCK: ${ENCLAVE_NAME_SECURELOCK}"
224
+ echo "VERSION: ${VERSION}"
225
+ echo "BLOCKCHAIN_NETWORK: ${BLOCKCHAIN_NETWORK}"
226
+ python3 ./public_key_service.py --enclave_name "${PROJECT_NAME}" --protocol_version "${VERSION}" --network "${BLOCKCHAIN_NETWORK}" --template_version "0.1.12"
227
+ # read PUBLIC_KEY_SECURELOCK_RES from PUBLIC_KEY.txt
228
+ PUBLIC_KEY_SECURELOCK_RES=$(cat PUBLIC_KEY.txt)
229
+ else
230
+ echo "Exiting."
231
+ exit 1
232
+ fi
233
+ fi
234
+
235
+ export CERTIFICATE_CONTENT_SECURELOCK=$(echo "${PUBLIC_KEY_SECURELOCK_RES}" | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' | sed -e '/-----BEGIN CERTIFICATE-----/d' -e '/-----END CERTIFICATE-----/d')
236
+ if [ -z "${CERTIFICATE_CONTENT_SECURELOCK}" ]; then
237
+ echo "ERROR! PUBLIC_KEY_SECURELOCK not found"
238
+ exit 1
239
+ else
240
+ echo "FOUND PUBLIC_KEY_SECURELOCK"
241
+ fi
242
+
243
+
244
+
245
+ echo -e "${PUBLIC_KEY_SECURELOCK}" > certificate.securelock.crt
246
+ echo "Listing certificate PUBLIC_KEY_SECURELOCK:"
247
+ cat certificate.securelock.crt
248
+
249
+
250
+ CERTIFICATE_CONTENT_TRUSTEDZONE="MIIBczCB+6ADAgECAgkAkZLVvEgT6QgwCgYIKoZIzj0EAwMwEjEQMA4GA1UEAwwHQ0FfQ0VSVDAgFw0yNDA2MDUwODEyMjhaGA80MDk2MDEwMTAwMDAwMFowFjEUMBIGA1UEAwwLU0VSVkVSX0NFUlQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARuZILgRDczZfYdvx+GP3MMNKWX0SsUYkG3ySN/lJL0iEm/rgjoLDRT2gV8p+xfzeGPqzAjL/6/5N7JLjKdmzMCSi0umbFKIzV1UOBQMoTye8Kq9pmrZSKW/gcDeg2tDb+jFzAVMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAoGCCqGSM49BAMDA2cAMGQCMDjiF3lBtlj+AiPu7k4AiaPcluAk8V7AFrKpNwfLCsmR8iSkjKuhMSWN0+Y1htUg+wIwVSY9CI8vbUJYWvOCd7n5IjLq2G0SF8Kw9k5BmX6XucnZxHc9dFgLm+6pcpuQg3YG"
251
+ export PUBLIC_KEY_TRUSTEDZONE="-----BEGIN CERTIFICATE-----\n${CERTIFICATE_CONTENT_TRUSTEDZONE}\n-----END CERTIFICATE-----"
252
+ echo -e "${PUBLIC_KEY_TRUSTEDZONE}" > certificate.trustedzone.crt
253
+ echo "Listing certificate PUBLIC_KEY_TRUSTEDZONE:"
254
+ cat certificate.trustedzone.crt
255
+
256
+ echo "**** Started ipfs final ****"
257
+ if [ -f ipfs.sh ]; then
258
+ chmod +x ipfs.sh
259
+ ./ipfs.sh
260
+ else
261
+ echo "Warning: ipfs.sh not found. Skipping IPFS setup."
262
+ fi
263
+ echo "**** Finished ipfs final ****"
264
+
265
+ echo "Adding certificates for SECURELOCK into IMAGE REGISTRY smart contract..."
266
+ if [ -f image_registry_runner.py ]; then
267
+ brew install python3
268
+ python3 -m venv venv
269
+ source venv/bin/activate
270
+ pip3 install --no-cache --upgrade pip minio web3==5.17.0 eth_account python-dotenv requests
271
+ python3 image_registry_runner.py
272
+ deactivate
273
+ else
274
+ echo "Warning: image_registry_runner.py not found. Skipping certificate addition to IMAGE REGISTRY smart contract."
275
+ fi
276
+
277
+ echo "Script completed successfully."
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+
3
+ apk add screen
4
+
5
+ cd /
6
+ wget https://github.com/ipfs/kubo/releases/download/v0.17.0/kubo_v0.17.0_linux-386.tar.gz
7
+ tar zxvf kubo_v0.17.0_linux-386.tar.gz
8
+ mv kubo go-ipfs
9
+ cd go-ipfs
10
+ ./ipfs init
11
+
12
+ screen -dm -t ipfs-swarm watch /go-ipfs/ipfs swarm connect /ip4/31.7.188.59/tcp/4001/p2p/QmRBc1eBt4hpJQUqHqn6eA8ixQPD3LFcUDsn6coKBQtia5
13
+
14
+ screen -dm -t ipfs-daemon /ipfs-daemon.sh
15
+
16
+ sleep 10
17
+
18
+ cd /var/lib/registry
19
+ HASH=`/go-ipfs/ipfs add . -r | grep added | tail -1 | awk '{print $2}'`
20
+ /go-ipfs/ipfs pin add ${HASH}
21
+
22
+
23
+ echo "HASH is ${HASH}"
@@ -0,0 +1,40 @@
1
+ #!/bin/bash
2
+ source ./.env
3
+
4
+ echo "Building $VERSION"
5
+
6
+ cd $VERSION/build
7
+
8
+ docker login registry.scontain.com:5050 -u ${SCONTAIN_LOGIN} -p ${SCONTAIN_PASS}
9
+
10
+ docker stop $(docker ps -q)
11
+ docker rm $(docker ps -q) -f
12
+ docker rmi $(docker images -q) -f
13
+ docker system prune -f
14
+
15
+ docker pull registry:2
16
+ docker run -d --restart=always -p 5000:5000 --name registry registry:2
17
+ docker build -t etny-nodenithy:latest .
18
+ docker tag etny-nodenithy localhost:5000/etny-nodenithy
19
+ docker push localhost:5000/etny-nodenithy
20
+
21
+ cd las
22
+ docker build -t etny-las .
23
+ docker tag etny-las localhost:5000/etny-las
24
+ docker push localhost:5000/etny-las
25
+
26
+ cd ..
27
+ docker cp ../../scripts/build-ipfs-upload.sh registry:/
28
+ docker cp ../../scripts/ipfs-daemon.sh registry:/
29
+
30
+ HASH=`docker exec -it registry /build-ipfs-upload.sh | grep "HASH is" | awk '{print $3}' | tr -d '\r'`
31
+
32
+ echo Following hash was pinned: ${HASH}
33
+
34
+ git pull
35
+ cd ../..
36
+ touch hashes/${HASH}
37
+ git add hashes/*
38
+
39
+ git commit -a -m "Added hash ${HASH}"
40
+ git push
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ while [ 1 == 1 ]
4
+ do
5
+ /go-ipfs/ipfs daemon
6
+ sleep 5
7
+ done
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+
3
+ source ./.env
4
+
5
+ apt-get install -y screen
6
+ cd ${VERSION}/run
7
+
8
+
9
+ wget https://github.com/ipfs/kubo/releases/download/v0.17.0/kubo_v0.17.0_linux-386.tar.gz
10
+ tar zxvf kubo_v0.17.0_linux-386.tar.gz
11
+ rm -rf kubo_v0.17.0_linux-386.tar.gz
12
+
13
+ mv kubo go-ipfs
14
+ cd go-ipfs
15
+ ./ipfs init
16
+
17
+ screen -dm -t ipfs-daemon ./ipfs daemon
18
+ screen -dm -t ipfs-swarm watch ./ipfs swarm connect /ip4/31.7.188.59/tcp/4001/p2p/QmRBc1eBt4hpJQUqHqn6eA8ixQPD3LFcUDsn6coKBQtia5
19
+
20
+ cd ..
21
+ go-ipfs/ipfs get ${TEMPLATE}
22
+
23
+ docker-compose down
24
+ docker stop registry
25
+ docker rm registry
26
+ docker rmi localhost:5000/etny-nodenithy
27
+ docker rmi localhost:5000/etny-las
28
+ docker system prune -f
29
+ docker run -d --restart=always -p 5000:5000 --name registry -v ./${TEMPLATE}:/var/lib/registry registry:2
30
+
31
+ killall -9 screen
32
+ rm -rf go-ipfs
33
+
34
+ sleep 10
35
+
36
+ MRENCLAVE=`docker-compose run -e SCONE_LOG=INFO -e SCONE_HASH=1 etny-nodenithy | grep -v Creating | grep -v Pulling | grep -v latest | grep -v Digest | tr -d '\r'`
37
+ PREDECESSOR=`cat predecessor.json | grep hash | awk -F '"' '{print $4}'`
38
+
39
+ cat etny-nodenithy-test-0.0.2.yaml.tpl | sed s/"__PREDECESSOR__"/${PREDECESSOR}/ | sed s/"__MRENCLAVE__"/${MRENCLAVE}/ > etny-nodenithy-test-0.0.2.yaml
40
+
41
+ curl -k -s --cert certs/cert.pem --key certs/key.pem --data-binary @etny-nodenithy-test-0.0.2.yaml -X POST https://scone-cas.cf:8081/session -v -o predecessor.json
42
+
43
+
44
+ git commit -a -m "Updated for MRENCLAVE: ${MRENCLAVE}"
45
+ git push
46
+
47
+ docker-compose up -d las
48
+ docker-compose up etny-nodenithy
49
+
50
+
@@ -0,0 +1,57 @@
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
39
+
40
+ .container {
41
+ /* Set the container to flex to align the button horizontally and vertically */
42
+ display: flex;
43
+ justify-content: center; /* Center horizontally */
44
+ align-items: center; /* Center vertically */
45
+ height: 100vh; /* Adjust the container's height based on your requirement */
46
+ }
47
+
48
+ .centeredButton {
49
+ /* Add your button styles here */
50
+ padding: 10px 20px;
51
+ background-color: #007bff;
52
+ color: #fff;
53
+ border: none;
54
+ cursor: pointer;
55
+ font-size: 16px;
56
+ border-radius: 5px;
57
+ }
@@ -0,0 +1,64 @@
1
+ const AppCss = require('./App.css');
2
+ import EthernityCloudRunner from "@ethernity-cloud/runner";
3
+ import {ECEvent, ECRunner, ECStatus} from "@ethernity-cloud/runner/enums";
4
+ import Web3 from 'web3';
5
+
6
+ const PROJECT_NAME = "";
7
+ const IPFS_ENDPOINT = "";
8
+
9
+ const code = `hello("World");`;
10
+
11
+ function App() {
12
+ const executeTask = async () => {
13
+ const runner = new EthernityCloudRunner();
14
+ // this is a server provided by Ethernity CLOUD, please bear in mind that you can use your own Decentralized Storage server
15
+ const ipfsAddress = IPFS_ENDPOINT;
16
+ runner.initializeStorage(ipfsAddress);
17
+ console.log(PROJECT_NAME)
18
+ const onTaskProgress = (e) => {
19
+ if (e.detail.status === ECStatus.ERROR) {
20
+ console.error(e.detail.message);
21
+ } else {
22
+ console.log(e.detail.message);
23
+ }
24
+ };
25
+
26
+ const onTaskCompleted = (e) => {
27
+ console.log(`Task Result: ${e.detail.message.result}`);
28
+ // display the result in page below the buttons
29
+ const result = document.createElement("p");
30
+ result.innerHTML = `Task Result: ${e.detail.message.result}`;
31
+ document.body.appendChild(result);
32
+ }
33
+
34
+ runner.addEventListener(ECEvent.TASK_PROGRESS, onTaskProgress);
35
+ runner.addEventListener(ECEvent.TASK_COMPLETED, onTaskCompleted);
36
+
37
+ await runner.run(PROJECT_NAME,
38
+ code,
39
+ '',
40
+ { taskPrice: 10, cpu: 1, memory: 1, storage: 10, bandwidth: 1, duration: 1, validators: 1 });
41
+ };
42
+ const connectWallet = async () => {
43
+ if (window.ethereum) {
44
+ window.web3 = new Web3(window.ethereum);
45
+ try {
46
+ // Request account access
47
+ await window.ethereum.request({ method: 'eth_requestAccounts' });
48
+ console.log("Wallet connected");
49
+ } catch (error) {
50
+ console.error("User denied account access");
51
+ }
52
+ } else {
53
+ console.log('Please install MetaMask!');
54
+ }
55
+ };
56
+
57
+ return (
58
+ <div className="container">
59
+ <button className="centeredButton" onClick={executeTask}>Execute Task</button>
60
+ <button className="centeredButton" onClick={connectWallet}>Connect Wallet</button>
61
+ </div>
62
+ );
63
+ }
64
+ export default App;
@@ -0,0 +1,13 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import './index.css';
4
+ import App from './ec_helloworld_example';
5
+ import reportWebVitals from './reportWebVitals';
6
+
7
+ const root = ReactDOM.createRoot(document.getElementById('root'));
8
+ root.render(
9
+ <React.StrictMode>
10
+ <App />
11
+ </React.StrictMode>
12
+ );
13
+
14
+ // If you want to start measuring performance in your app, pass a function
15
+ // to log results (for example: reportWebVitals(console.log))
16
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17
+ reportWebVitals();
@@ -0,0 +1,45 @@
1
+ const fs = require('fs');
2
+ require('dotenv').config();
3
+
4
+ const filePath = 'src/ec_helloworld_example.js';
5
+ const fileContent = fs.readFileSync(filePath, 'utf8');
6
+
7
+ const updatedContent = fileContent
8
+ .replace(/const PROJECT_NAME = ".*?";/, `const PROJECT_NAME = "${process.env.PROJECT_NAME}";`)
9
+ .replace(/const IPFS_ENDPOINT = ".*?";/, `const IPFS_ENDPOINT = "${process.env.IPFS_ENDPOINT}";`)
10
+
11
+ fs.writeFileSync(filePath, updatedContent, 'utf8');
12
+
13
+ // const code = updatedContent.match(/const code = `hello\("(.*?)"\);/)[1];
14
+
15
+ const imageRegistryPath = 'node_modules/@ethernity-cloud/runner/contract/operation/imageRegistryContract.js';
16
+ const imageRegistryContent = fs.readFileSync(imageRegistryPath, 'utf8');
17
+
18
+ // Log the original content for debugging
19
+ // console.log('Original imageRegistryContent:', imageRegistryContent);
20
+
21
+ // Replace the content in imageRegistryContract.js
22
+ // const updatedImageRegistryContent = imageRegistryContent.replace(/getLatestTrustedZoneImageCertPublicKey\([^)]*\);/, "getLatestTrustedZoneImageCertPublicKey('" + process.env.ENCLAVE_NAME_TRUSTEDZONE + "', 'v3')").replace(/getLatestImageVersionPublicKey\([^)]*\)/, "getLatestImageVersionPublicKey(imageName, '" + process.env.VERSION + "')");
23
+ const updatedImageRegistryContent = imageRegistryContent.replace(
24
+ /async getEnclaveDetailsV3\(.*?\{[\s\S]*?\}\s*\}/,
25
+ `async getEnclaveDetailsV3(imageName, version) {
26
+ try {
27
+ const trustedZonePublicKey = (await this.contract.getLatestTrustedZoneImageCertPublicKey('${process.env.ENCLAVE_NAME_TRUSTEDZONE}', 'v3'));
28
+ const imageDetails = await this.contract.getLatestImageVersionPublicKey(imageName, '${process.env.VERSION}');
29
+ return [imageDetails[0], trustedZonePublicKey[1], imageDetails[2]];
30
+ } catch (e) {
31
+ console.log(e);
32
+ return null;
33
+ }
34
+ }`
35
+ );
36
+
37
+
38
+ fs.writeFileSync(imageRegistryPath, updatedImageRegistryContent, 'utf8');
39
+
40
+ const runnerPath = 'node_modules/@ethernity-cloud/runner/runner.js';
41
+ const runnerContent = fs.readFileSync(runnerPath, 'utf8');
42
+
43
+ const updatedRunnerContent = runnerContent.replace(/this.#enclaveImageIPFSHash}:.*?:/, "this.#enclaveImageIPFSHash}:"+process.env.ENCLAVE_NAME_TRUSTEDZONE+":").replace(/new ImageRegistryContract\([^)]*\);/, "new ImageRegistryContract(this.#networkAddress, '"+process.env.ENCLAVE_NAME_TRUSTEDZONE+"');");
44
+
45
+ fs.writeFileSync(runnerPath, updatedRunnerContent, 'utf8');
@@ -0,0 +1,57 @@
1
+ import fs from 'fs';
2
+ import dotenv from 'dotenv';
3
+ dotenv.config();
4
+
5
+ export const ECRunner = {
6
+ 'etny-pynithy-testnet': ['0x02882F03097fE8cD31afbdFbB5D72a498B41112c'],
7
+ 'etny-nodenithy-testnet': ['0x02882F03097fE8cD31afbdFbB5D72a498B41112c'],
8
+ 'etny-pynithy': ['0x549A6E06BB2084100148D50F51CF77a3436C3Ae7'],
9
+ 'etny-nodenithy': ['0x549A6E06BB2084100148D50F51CF77a3436C3Ae7'],
10
+ 'ecld-nodenithy-testnet': ['0xfb450e40f590F1B5A119a4B82E6F3579D6742a00'],
11
+ 'ecld-pynithy': ['0xc6920888988cAcEeA7ACCA0c96f2D65b05eE22Ba'],
12
+ 'ecld-nodenithy': ['0xc6920888988cAcEeA7ACCA0c96f2D65b05eE22Ba']
13
+ };
14
+
15
+ const filePath = 'src/ec_helloworld_example.js';
16
+ const fileContent = fs.readFileSync(filePath, 'utf8');
17
+
18
+ const updatedContent = fileContent
19
+ .replace(/const PROJECT_NAME = ".*?";/, `const PROJECT_NAME = "${process.env.PROJECT_NAME}";`)
20
+ .replace(/const IPFS_ENDPOINT = ".*?";/, `const IPFS_ENDPOINT = "${process.env.IPFS_ENDPOINT}";`)
21
+ .replace(/new EthernityCloudRunner\(.*?\);/, `new EthernityCloudRunner('${ECRunner[process.env.ENCLAVE_NAME_TRUSTEDZONE]}');`);
22
+
23
+ fs.writeFileSync(filePath, updatedContent, 'utf8');
24
+
25
+ // const code = updatedContent.match(/const code = `hello\("(.*?)"\);/)[1];
26
+
27
+ const imageRegistryPath = 'node_modules/@ethernity-cloud/runner/contract/operation/imageRegistryContract.js';
28
+ const imageRegistryContent = fs.readFileSync(imageRegistryPath, 'utf8');
29
+
30
+ // Log the original content for debugging
31
+ // console.log('Original imageRegistryContent:', imageRegistryContent);
32
+
33
+ // Replace the content in imageRegistryContract.js
34
+ // const updatedImageRegistryContent = imageRegistryContent.replace(/getLatestTrustedZoneImageCertPublicKey\([^)]*\);/, "getLatestTrustedZoneImageCertPublicKey('" + process.env.ENCLAVE_NAME_TRUSTEDZONE + "', 'v3')").replace(/getLatestImageVersionPublicKey\([^)]*\)/, "getLatestImageVersionPublicKey(imageName, '" + process.env.VERSION + "')");
35
+ const updatedImageRegistryContent = imageRegistryContent.replace(
36
+ /async getEnclaveDetailsV3\(.*?\{[\s\S]*?\}\s*\}/,
37
+ `async getEnclaveDetailsV3(imageName, version) {
38
+ try {
39
+ const trustedZonePublicKey = (await this.contract.getLatestTrustedZoneImageCertPublicKey('${process.env.ENCLAVE_NAME_TRUSTEDZONE}', 'v3'));
40
+ const imageDetails = await this.contract.getLatestImageVersionPublicKey(imageName, '${process.env.VERSION}');
41
+ return [imageDetails[0], trustedZonePublicKey[1], imageDetails[2]];
42
+ } catch (e) {
43
+ console.log(e);
44
+ return null;
45
+ }
46
+ }`
47
+ );
48
+
49
+
50
+ fs.writeFileSync(imageRegistryPath, updatedImageRegistryContent, 'utf8');
51
+
52
+ const runnerPath = 'node_modules/@ethernity-cloud/runner/runner.js';
53
+ const runnerContent = fs.readFileSync(runnerPath, 'utf8');
54
+
55
+ const updatedRunnerContent = runnerContent.replace(/this.#enclaveImageIPFSHash}:.*?:/, "this.#enclaveImageIPFSHash}:"+process.env.ENCLAVE_NAME_TRUSTEDZONE+":").replace(/new ImageRegistryContract\([^)]*\);/, "new ImageRegistryContract(this.#networkAddress, '"+process.env.ENCLAVE_NAME_TRUSTEDZONE+"');");
56
+
57
+ fs.writeFileSync(runnerPath, updatedRunnerContent, 'utf8');
@@ -0,0 +1,13 @@
1
+ const reportWebVitals = onPerfEntry => {
2
+ if (onPerfEntry && onPerfEntry instanceof Function) {
3
+ import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
+ getCLS(onPerfEntry);
5
+ getFID(onPerfEntry);
6
+ getFCP(onPerfEntry);
7
+ getLCP(onPerfEntry);
8
+ getTTFB(onPerfEntry);
9
+ });
10
+ }
11
+ };
12
+
13
+ export default reportWebVitals;