encryption-se

1.0.3 • Public • Published

Encryption SE

NPM Version NPM Downloads Install Size CircleCI Coverage Status

Description

A simple module wrapping around NodeJS Crypto module allowing handling IV by prefixing it to encrypted string.

Options

Name Default Description
password null Password secret REQUIRED
passwordSalt This is my salt 362 Password salt
iterationCount 100000 Number of iterations for PBKDF2
encryptionKey null Encryption key as array of bytes

How to use it

Installation

// First you have to get module and instantiate it

npm install encryption-se

OR

yarn add encryption-se

After installing module, add this to your code:

const options = {
  password: process.env.encryptionPassword || 'SomePassword'
};

const encryption = require('encryption-se')(options);

How to encrypt?

encryption
  .encrypt('This is to be encrypted')
  .then(enc => {
    // 'enc' contains encrypted string in base64 format
  })
  .catch((err) => {
    // This is to handle errors
  })

How to decrypt?

encryption
  .decrypt('iQ6qlRWlwWXtmGPFbBiEc4WKKAbHCLQK0+HLxoGLKY0=')
  .then((text) => {
    // 'text' contains decrypted string
  })
  .catch((err) => {
    // This is to handle errors
  })

Contact

Image

Readme

Keywords

none

Package Sidebar

Install

npm i encryption-se

Weekly Downloads

72

Version

1.0.3

License

MIT

Unpacked Size

15.1 kB

Total Files

9

Last publish

Collaborators

  • michaelortho