JavaScript SDK

SDK to integrate Phase in client-side Javascript applications.

The JavaScript SDK can be used with any JavaScript client-side application to encrypt data client-side, in your user's browsers.

Install the SDK

The JavaScript SDK is distributed via npm. You can install it using the following command for your preferred package manager.


npm i

Import the SDK

Once installed, you can import the JavaScript SDK into your project.

import Phase from ''

Initialize the SDK

In order to use the SDK, you need to initialize it with your APP_ID.

const phase = new Phase(APP_ID)


Now that you have initialized the SDK, you can use it to encrypt data.


The encrypt API allows you to encrypt a string. It returns a Promise that resolves in a encrypted string in the Phase Ciphertext format, so you need to await it.

const ciphertext = await phase.encrypt('hello world')