SDK to integrate Phase in server-side applications running Node.js.
The Node.js SDK allows you to encrypt data server-side, as well as decrypt data.
The Node.js SDK is distributed via npm. You can install it using the following command for your preferred package manager.
npm i @phase.dev/phase-node
Once installed, you can import the Node.js SDK into your project.
const Phase = require('@phase.dev/phase-node')
Initialize the SDK with your
const phase = new Phase(APP_ID, APP_SECRET)
encrypt API allows you to encrypt data. It returns a
Promise that resolves in a encrypted string in the Phase Ciphertext format, so you need to
const ciphertext = await phase.encrypt('hello world')
decrypt API allows you to decrypt a Phase Ciphertext string. It returns a
Promise that resolves in a plaintext string, so you need to
const plaintext = await phase.decrypt(ciphertext)