Skip to content

Create a vFunction

A vFunction is just a function (like AWS lambda) that has extended capabilities to verified its correcteness and its results.

Secrets retrieval

Your code will run on a secure AWS nitro enclave. This enclave provides an attestation document used to prove that the enclave is the one requesting the sensitive data.

The first part of a vFunction should consist of retrieving the secrets from a server. You can check how to do this in the Secrets Management documentation.

Generating results

Once you obtain data from the secret manager, you can process it as you require.

python
from verifiably import NSM

nsm_dev = NSM()

credentials = ... # Credentials obtained from a server

# Call the function to process the information
result = process_data(credentials)

Now that you have the result, you have to publish it. You can do this securely by creating an attestation document that contains the results of your function.

python
# Generate attestation document with result
attestation_doc = nsm_dev.get_attestation_doc(user_data=result)
result_obj = {"attestation_doc": str(attestation_doc)}

# There are different methods to publish your results, in this case
# we are going to use a verifiably API.

request.post(verifiably_publish_api_url, data = result_obj)

References

Verifiably Documentation