@ethernity-cloud/sdk-js 1.6.2 → 1.7.1

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 (57) hide show
  1. package/README.md +86 -48
  2. package/cas/config.js +61 -3
  3. package/info.js +14 -5
  4. package/init.js +24 -6
  5. package/network.js +51 -0
  6. package/nodenithy/build/securelock/Dockerfile.tmpl +34 -32
  7. package/nodenithy/build/securelock/scripts/binary-fs-build.sh +7 -6
  8. package/nodenithy/build.mjs +80 -68
  9. package/nodenithy/run/docker-compose-final.yml.tmpl +36 -31
  10. package/nodenithy/run/docker-compose.yml.tmpl +34 -45
  11. package/nodenithy/run/image_registry.js +17 -4
  12. package/nodenithy/run.js +42 -28
  13. package/nodenithy/src/ec_helloworld_example.js +46 -42
  14. package/nodenithy/src/preStart.mjs +41 -51
  15. package/package.json +6 -3
  16. package/publish.js +4 -2
  17. package/pynithy/build/securelock/Dockerfile.base.tpl +13 -0
  18. package/pynithy/build/securelock/Dockerfile.tpl +131 -0
  19. package/pynithy/build/securelock/scripts/binary-fs-build.sh +25 -34
  20. package/pynithy/build/securelock/scripts/pyfreeze.sh +32 -0
  21. package/pynithy/build/securelock/src/{pox.abi → abi/etnyImplementationV2.abi} +1489 -1489
  22. package/pynithy/build/securelock/src/abi/image_registry.abi +1 -0
  23. package/pynithy/build/securelock/src/ecld_state.py +906 -0
  24. package/pynithy/build/securelock/src/esr.abi +1 -0
  25. package/pynithy/build/securelock/src/esr_local.py +267 -0
  26. package/pynithy/build/securelock/src/esr_wallet.py +150 -0
  27. package/pynithy/build/securelock/src/etny_crypto.py +208 -167
  28. package/pynithy/build/securelock/src/etny_exec.py +385 -79
  29. package/pynithy/build/securelock/src/etny_exec_flask.py +535 -0
  30. package/pynithy/build/securelock/src/etny_exec_serv.py +353 -0
  31. package/pynithy/build/securelock/src/etny_session_exec.py +245 -0
  32. package/pynithy/build/securelock/src/get_sgx_report.so +0 -0
  33. package/pynithy/build/securelock/src/image_registry.abi +1 -1
  34. package/pynithy/build/securelock/src/key_generation.py +17 -17
  35. package/pynithy/build/securelock/src/local_api.py +189 -0
  36. package/pynithy/build/securelock/src/models.py +200 -176
  37. package/pynithy/build/securelock/src/securelock.py.tmpl +1037 -731
  38. package/pynithy/build/securelock/src/swift_stream_service.py +206 -186
  39. package/pynithy/build.mjs +139 -89
  40. package/pynithy/run/docker-compose-final.yml.tmpl +58 -51
  41. package/pynithy/run/docker-compose.yml.tmpl +62 -48
  42. package/pynithy/run/etny-securelock-test.yaml.tpl +4 -1
  43. package/pynithy/run/image_registry.js +17 -4
  44. package/pynithy/run.js +44 -28
  45. package/pynithy/src/ec_helloworld_example.js +46 -42
  46. package/pynithy/src/preStart.mjs +41 -51
  47. package/pynithy/src/serverless/Dockerfile.serverless +8 -0
  48. package/pynithy/src/serverless/requirements.txt +6 -0
  49. package/run.js +37 -34
  50. package/nodenithy/build/las/Dockerfile +0 -5
  51. package/nodenithy/src/preStart.js +0 -45
  52. package/pynithy/build/docker-compose.yml +0 -70
  53. package/pynithy/build/las/Dockerfile +0 -11
  54. package/pynithy/build/las/src/etny_entrypoint.sh +0 -6
  55. package/pynithy/build/las/src/las_entrypoint.sh +0 -26
  56. package/pynithy/build/scripts/binary-fs-build.sh +0 -28
  57. package/pynithy/build/securelock/Dockerfile.tmpl +0 -95
@@ -1,6 +0,0 @@
1
-
2
- #!/bin/bash
3
-
4
- ( tail -f -n0 /var/log/las.log & ) | grep -q "Sign request failed with Enclave lost after power transition or used in child process created by"
5
-
6
- killall -9 las
@@ -1,26 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- SOCKET="/var/run/aesmd/aesm.socket"
6
-
7
- # Try to connect to the socket
8
- # Previously we merely checked that the socket file exists. However, the
9
- # file is not removed when the container stops and, thus, when we restart
10
- # the file still exists and we assume that we are supposed to use an
11
- # outside AESM.
12
- if socat -u OPEN:/dev/null UNIX-CONNECT:${SOCKET}; then
13
- # An AESM socket was already mounted into the container, don't start a local AESM service, start LAS directly
14
- echo "${SOCKET} exists - Will use mounted AESM socket; the local in-container AESM service will not be started!"
15
- exec "$@"
16
- else
17
- # No AESM socket present, delegate execution to the local AESM service
18
- echo "${SOCKET} not found or unable to connect - Starting local in-container AESM service"
19
- if [ -e ${SOCKET} ]; then
20
- # Ensure the socket file does not exist - AESM won't start if it does...
21
- rm ${SOCKET}
22
- fi
23
- exec /entrypoint.sh "$@"
24
- fi
25
-
26
- /etny_entrypoint.sh &
@@ -1,28 +0,0 @@
1
- #!/bin/bash -v
2
-
3
- pip3 install pyinstaller
4
- apk add binutils
5
-
6
- cd /etny-securelock
7
- pyinstaller etny_result.py
8
-
9
- EXEC=(scone binaryfs / /binary-fs-dir -v \
10
- --include '/usr/local/lib/python3.10/*' \
11
- --include '/etny-securelock/*' \
12
- --host-path=/etc/resolv.conf \
13
- --host-path=/etc/hosts)
14
-
15
-
16
- for FILE in `cat ./build/etny_result/COLLECT-00.toc | grep '.so' | grep BINARY | awk -F "'" '{print $4}'`
17
- do
18
- EXEC+=(--include "${FILE}"'*')
19
- done
20
-
21
- rm -rf build dist etny_result.spec
22
-
23
- echo "${EXEC[@]}"
24
-
25
- SCONE_MODE=auto
26
- exec "${EXEC[@]}"
27
-
28
- exit
@@ -1,95 +0,0 @@
1
- # FROM registry.scontain.com:5050/sconecuratedimages/apps:python3.10.5-alpine3.15-scone5.8-pre-release as release
2
- FROM registry.ethernity.cloud:443/debuggingdelight/ethernity-cloud-sdk-registry/sconecuratedimages/apps:python3.10.5-alpine3.15-scone5.8-pre-release as release
3
-
4
-
5
-
6
- RUN apk update
7
-
8
- RUN cd /
9
- RUN apk add bash openrc bind-tools sudo npm binutils curl
10
- RUN pip3 install --upgrade pip
11
- RUN pip3 install --upgrade setuptools
12
- RUN pip3 install python-dotenv
13
- RUN pip3 install web3==5.31.0
14
- RUN pip3 install cryptography==42.0.7
15
- RUN pip3 install ecdsa
16
- RUN pip3 install pyasn1
17
- RUN pip3 install tinyec
18
- RUN pip3 install pyinstaller
19
- RUN pip3 install minio
20
- RUN pip3 install pynacl
21
- RUN pip3 install pytest
22
- RUN pip3 install numpy
23
- RUN pip3 install scipy
24
- RUN pip3 install hypothesis
25
- RUN pip3 install pooch
26
- RUN pip3 install ipywidgets
27
-
28
- #RUN pip3 install requests
29
- #RUN pip3 install beautifulsoup4
30
- #RUN pip3 install tokenizers
31
- #RUN pip3 install transformers
32
- #RUN pip3 install tensorflow
33
-
34
-
35
- ENV ENCLAVE_NAME_SECURELOCK=__ENCLAVE_NAME_SECURELOCK__
36
- ENV BUCKET_NAME=__BUCKET_NAME__
37
- ENV SMART_CONTRACT_ADDRESS=__SMART_CONTRACT_ADDRESS__
38
- ENV IMAGE_REGISTRY_ADDRESS=__IMAGE_REGISTRY_ADDRESS__
39
- ENV RPC_URL=__RPC_URL__
40
- ENV CHAIN_ID=__CHAIN_ID__
41
- ENV TRUSTED_ZONE_IMAGE=__TRUSTED_ZONE_IMAGE__
42
- ENV VALIDATOR_REGISTRY_ADDRESS=__VALIDATOR_REGISTRY_ADDRESS__
43
-
44
-
45
- RUN mkdir binary-fs-dir
46
-
47
- COPY ./src /etny-securelock/
48
- COPY ./scripts/* /etny-securelock/
49
-
50
- RUN etny-securelock/binary-fs-build.sh
51
-
52
- FROM registry.ethernity.cloud:443/debuggingdelight/ethernity-cloud-sdk-registry/sconecuratedimages/crosscompilers as build
53
-
54
- COPY --from=release /binary-fs-dir /.
55
-
56
- RUN scone gcc ./binary_fs_blob.s ./libbinary_fs_template.a -shared -o /libbinary-fs.so
57
-
58
- FROM registry.ethernity.cloud:443/debuggingdelight/ethernity-cloud-sdk-registry/sconecuratedimages/apps:python3.10.5-alpine3.15-scone5.8-pre-release
59
-
60
- COPY --from=build /usr/local/bin/scone /usr/local/bin/scone
61
-
62
- #RUN scone cas attest scone-cas.cf 3061b9feb7fa67f3815336a085f629a13f04b0a1667c93b14ff35581dc8271e4 -GCS --only_for_testing-debug --only_for_testing-ignore-signer
63
-
64
- COPY --from=build /libbinary-fs.so /lib/libbinary-fs.so
65
-
66
- RUN openssl genrsa -3 -out /enclave-key.pem 3072
67
-
68
- # SCONE runtime env. Must match the enclave-creation params passed to
69
- # scone-signer below (any drift makes SCONE recompute + debug re-sign at load,
70
- # which CAS rejects on mainnet). Values mirror the run/docker-compose securelock
71
- # service (SCONE_HEAP=1024M, SCONE_STACK=4M, dlopen=1, extensions=libbinary-fs).
72
- ENV SCONE_LOG=INFO
73
- ENV SCONE_HEAP=1024M
74
- ENV SCONE_STACK=4M
75
- ENV SCONE_ALLOW_DLOPEN=1
76
- ENV SCONE_EXTENSIONS_PATH=/lib/libbinary-fs.so
77
-
78
- # Rendered by build.mjs. Signs the EXECUTED binary (/usr/local/bin/python -- the
79
- # ENTRYPOINT and the run/publish compose command both run /usr/local/bin/python;
80
- # python3 is a SEPARATE symlink, signing it leaves the executed binary
81
- # debug-signed). Mainnet adds --production (CAS/DCAP); testnet omits it (non-CAS
82
- # self-sign). On testnet builds this line is a no-op comment.
83
- __SCONE_SIGN__
84
-
85
- # Record the SIGNED MRENCLAVE so publish (run.js) can assert the runtime enclave
86
- # measurement matches what was signed before registering the CAS session. Only
87
- # produced for --production (mainnet); on testnet the file is absent and the
88
- # check is skipped. Capture to a file first (piping scone-signer into head/grep
89
- # kills it with SIGPIPE / exit 141 under buildkit's pipefail shell).
90
- __SIGNED_MRENCLAVE__
91
-
92
- RUN rm -rf /enclave-key.pem
93
-
94
-
95
- ENTRYPOINT ["/usr/local/bin/python", "/etny-securelock/securelock.py"]