RESOURCES

Python SDK

SDK to integrate Phase in server-side applications running Python.

The Python SDK allows you to encrypt data server-side, as well as decrypt data.


Install the SDK

The Python SDK is distributed via PyPI. You can install it using the following command.

Install

pip install phase-dev

Import the SDK

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

from phase import Phase;

Initialize the SDK

Initialize the SDK with your APP_ID and APP_SECRET.

phase = Phase(APP_ID, APP_SECRET)

Usage

Encrypt

The encrypt API allows you to encrypt data. It returns an encrypted string in the Phase Ciphertext format.

ciphertext = phase.encrypt('hello world')

Decrypt

The decrypt API allows you to decrypt a Phase Ciphertext string. It returns a plaintext string.

plaintext = phase.decrypt(ciphertext)