A full reference of our Node.js SDK.
You can use our Node.js SDK to:
- Encrypt data at your server
- Run your Cages
- Encrypt/decrypt data with Relay
Our Node.js SDK encrypts all data fields by default unless you specify what to encrypt.
You can use our Node.js SDK to encrypt data — rather than with Relay — and still send it to a third-party via Relay. Encrypting with our backend SDKs is best for developers who want to avoid the network latency of Relay and/or want to avoid sending plaintext data to Relay to be encrypted.
Encrypting data with our backend SDKs instead of Relay may expose you to greater compliance burden because plaintext data touches your server before it is encrypted. If you want to avoid sending plaintext data to Relay and want to reduce your compliance burden — by never having plaintext data touch your infrastructure — using our frontend SDKs to encrypt in the browser or on the client is best.
You don’t need to change your database configuration. You can store Evervault-encrypted data in your database as you would the plaintext version.
Our Node.js SDK is distributed via npm, and can be installed using your preferred package manager.
bash# Install using npmnpm install @evervault/sdk# Install using Yarnyarn add @evervault/sdk
The Evervault Node.js SDK will automatically pass all outbound network requests through Relay by overriding your default HTTP Agent. To disable this behaviour, set the
relay value to
false in the options.
The Evervault Node.js SDK exposes three functions:
evervault.encrypt() encrypts data for use in your Cages and through Relay. To encrypt data at the server, simply pass an object or string into the
evervault.encrypt() function. Store the encrypted data in your database as normal.
|Data to be encrypted.|
evervault.run() lets you invoke a Cage with a given payload.
|Name of the Cage to be run.|
|Payload for the Cage.|
|Options for the cage run.|
|Run your Cage in async mode. Async Cage runs will be queued for processing.|
|Specify the version of your Cage to run. By default, the latest version will be run.|
You may configure the SDK to automatically route all outbound HTTPS requests through Relay by setting
true in the initialization options.