Guides
Go SDK
You can use our Go SDK to:
- Encrypt data server-side including files
- Decrypt data server-side
- Invoke Functions
- Invoke Cages
- Proxy requests through Outbound Relay
Encrypting/Decrypting data with our backend SDKs instead of Inbound Relay may expose you to greater compliance burden because because your server handles plaintext data.
Instead you can:
- Use an Inbound Relay to encrypt data before it reaches your server.
- Use an Outbound Relay to decrypt data before it reaches a third-party service.
- Use our client-side SDKs to encrypt data before sending it to your server.
Quickstart
Install SDK
Initialize SDK
Now, let's initialize the SDK using our App's ID and API key. If you don't have one yet, you can get one by creating an App in the Evervault Dashboard.
Encrypt a string
Now that the SDK is initialized, we can encrypt a string.
Decrypt data
Decrypt data previously encrypted using the Encrypt()
function or through Relay.
An API key with the decrypt
permission must be used to perform this operation.
Decrypting data with our backend SDKs is not available if you are part of the PCI or HIPAA compliance use cases
Instead you can:
- Use Outbound Relay to decrypt data before it reaches third-party services.
- Use Functions or Cages to process encrypted data.
Creating Client Side Decrypt Tokens
Client Side Decrypt Tokens are versatile and short-lived tokens that frontend applications can utilise to decrypt data previously encrypted through Evervault. Client Side Decrypt Tokens are restricted to specific payloads.
By default, a Client Side Decrypt Token will live for 5 minutes into the future. The maximum time to live of the token is 10 minutes into the future.
Construct a http.Client
configured for Outbound Relay
The returned client is configured to proxy requests through Outbound Relay, enabling decryption of data before it reaches the requests destination.
Construct a http.Client
for connecting to a Cage
The returned client will be configured to connect to the cage and attest the connection on each request with the pcrs provided.
Full example
Pulling all of this together leaves us with the following working example. You can copy and paste the code below (using a sandbox API key), run it in your own environment and run the encryption for yourself.
Reference
The full reference is available on Go pkg