Node.js Sample Application

Run demonstration test encrypt and decrypt calls with this sample application

Overview

This sample application will demonstrate how to encrypt and decrypt data using the different APIs.

Installation

First clone the sample source code the Ubiq repository and change directory to the sample application git clone (repository)

cd ubiq-node/example

Continue with the existing Installation Commands npm or yarn:

cd example
npm install
#or
yarn install

Credentials file

Edit the credentials file with your account API Key Credentials created using the Ubiq Dashboard:

[default]
ACCESS_KEY_ID = ...
SECRET_SIGNING_KEY = ...
SECRET_CRYPTO_ACCESS_KEY = ...

View program options

From within the example directory:

cd example
node ubiq_sample.js -h

Demonstrate using the simple (-s) API interface to encrypt this README.md file and write the encrypted data to /tmp/readme.enc

node ubiq_sample.js -i ./README.md -o /tmp/readme.enc -e -s -c ./credentials

Demonstrate using the simple (-s) API interface to decrypt the /tmp/readme.enc file and write the decrypted output to /tmp/README.out

node ubiq_sample.js -i /tmp/readme.enc -o /tmp/README.out -d -s -c ./credentials

Demonstrate using the piecewise (-p) API interface to encrypt this README.md file and write the encrypted data to /tmp/readme.enc

node ubiq_sample.js -i ./README.md -o /tmp/readme.enc -e -p -c ./credentials

Demonstrate using the piecewise (-p / --piecewise) API interface to decrypt the /tmp/readme.enc file and write the decrypted output to /tmp/README.out

node ubiq_sample.js -i /tmp/readme.enc -o /tmp/README.out -d -p -c ./credentials