https://github.com/evervault/hello-enclave
A simple "Hello, World!" example to get started with Enclaves.
https://github.com/evervault/hello-enclave
Last synced: over 1 year ago
JSON representation
A simple "Hello, World!" example to get started with Enclaves.
- Host: GitHub
- URL: https://github.com/evervault/hello-enclave
- Owner: evervault
- Created: 2022-10-19T11:29:03.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-27T14:56:42.000Z (almost 2 years ago)
- Last Synced: 2024-08-27T16:23:33.561Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hello World Enclave
A simple node server that can be deployed into a Enclave.
Use the [Evervault CLI](https://docs.evervault.com/sdks/cli) to get started with Enclaves.
## Endpoints
### Hello
A simple endpoint that returns a hello message and echoes any body passed into it back in the response. Any Evervault encrypted strings will be decrypted in the response to demonstrate automatic decryption within Enclaves.
```bash
curl --request GET \
--url [ENCLAVE_DOMAIN]/hello \
--header 'Content-Type: application/json' \
--header 'api-key: [EV-API-KEY]' \
--data '{
"name": "Ada",
"dob": "10/12/1815"
}' -k
```
### Egress
An endpoint that calls out to a simple public API to demonstrate egress. NOTE: Egress must be enabled in your Enclave's `enclave.toml` file for this endpoint to work.
```bash
curl --request GET \
--url [ENCLAVE_DOMAIN]/egress \
--header 'Content-Type: application/json' \
--header 'api-key: [EV-API-KEY]' -k
```
### Encrypt
An endpoint that encrypts any JSON body is passed into it with your Evervault key. This is done through the crypto API available within the Enclave when it's deployed.
```bash
curl --request POST \
--url [ENCLAVE_DOMAIN]/encrypt \
--header 'Content-Type: application/json' \
--header 'api-key: [EV-API-KEY]' \
--data '{
"name": "Claude",
"dob": "30/04/1916"
}' -k
```
### Decrypt
An endpoint that decrypts any encrypted JSON body is passed into it with your Evervault key. This is done through the crypto API available within the Enclave when it's deployed.
```bash
curl --request POST \
--url [ENCLAVE_DOMAIN]/decrypt \
--header 'Content-Type: application/json' \
--header 'api-key: [EV-API-KEY]' \
--data '{
"name": "EVERVAULT ENCRYPTED STRING",
"dob": "EVERVAULT ENCRYPTED STRING"
}' -k
```
### Compute
An endpoint that runs simple computation on two inputs. It adds two numbers together. Try passing an encrypted number into this function to see how Enclaves can process sensitive data securely.
```bash
curl --request POST \
--url [ENCLAVE_DOMAIN]/compute \
--header 'Content-Type: application/json' \
--header 'api-key: [EV-API-KEY]' \
--data '{
"b": "40",
"a": "10"
}' -k
```
With encrypted number (You will have to use a string encrypted with your own Evervault key. See encrypt endpoint):
```bash
curl --request POST \
--url [ENCLAVE_DOMAIN]/compute \
--header 'Content-Type: application/json' \
--header 'api-key: [EV-API-KEY]' \
--data '{
"b": "EVERVAULT ENCRYPTED STRING",
"a": "EVERVAULT ENCRYPTED STRING"
}' -k
```