https://github.com/evervault/template-python-hello-function
Evervault template Hello World Function for Python.
https://github.com/evervault/template-python-hello-function
Last synced: 12 months ago
JSON representation
Evervault template Hello World Function for Python.
- Host: GitHub
- URL: https://github.com/evervault/template-python-hello-function
- Owner: evervault
- License: mit
- Created: 2022-10-20T11:07:05.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T11:35:41.000Z (over 2 years ago)
- Last Synced: 2025-02-15T12:16:59.560Z (over 1 year ago)
- Language: Python
- Size: 23.4 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hello Function
[Evervault](https://evervault.com) makes it easy to encrypt data at source, process it in a Cage — a secure, serverless function — and never store it unencrypted.
This is a simple Evervault Function example, to help get you up and running on the Evervault platform quickly.
## Getting started with Evervault
Evervault consists of two parts, encrypting your data at source, using either our any of our SDKs and then sending that encrypted data to a Function to be processed securely.
This Function takes a payload that should contain a `name` key. Running the Function is very simple.
## The steps
1. Encrypt your data at source, using one of our SDKs.
2. Process the encrypted data in a Function
### Encrypting at source
```python
# This example uses the Evervault Python SDK.
import evervault
# Initialize the client with your app's API key
evervault.init("")
# Encrypt your data
encrypted = evervault.encrypt({ "name": "Claude" })
```
### Process your encrypted data in a Function
You should encrypt this payload using any SDKs, then run it in the Hello Function:
```python
# Process the encrypted data in a Function
result = evervault.run("", encrypted)
```
## Understanding the Function
This Function is very simple. Here is the full code:
```python
def handler(data):
if (data["name"] and isinstance(data["name"], str)):
print(f'A name of length {len(data["name"])} has arrived into the Function.');
return {
"message": f'Hello from a Function! It seems you have {len(data["name"])} letters in your name',
"name": f'{context["encrypt"](data["name"])}',
}
else:
print('An empty name has arrived into the Function.');
return {
"message": 'Hello from a Function! Send an encrypted `name` parameter to show Function decryption in action',
}
```
Or check it out in [main.py](./main.py).
---
If you want to know more about Evervault, check out our [documentation](https://docs.evervault.com).