cpass - simplified secured password two-ways encryption
Encrypts password to some sort of a 'secure string' to be stored in text configs to reduce risks of a silly leak.
Decripts a 'secure string' to plain password.
Installation
npm install cpass --save-dev
or
yarn add cpass
Usage
JavaScript
const Cpass = require('cpass').Cpass;
const cpass = new Cpass();
const password = 'password';
let secured = cpass.encode(password);
let unsecured = cpass.decode(secured);
TypeScript
import { Cpass } from 'cpass';
const cpass = new Cpass();
const password = 'password';
let secured = cpass.encode(password);
let unsecured = cpass.decode(secured);
Decoding plain text will return it back:
let plainText = 'plain (not encoded text)';
let decodedText = cpass.decode(plainText);
Encryption with master key
import { Cpass } from 'cpass';
const cpass = new Cpass('MasterKey');
Tests
Local run
npm run test
Run in Docker for specific Node.js version
docker build -f ./docker/Dockerfile.node8 -t cpass.node8 .
docker run cpass.node8
This module is not for a real security purposes. Just for 'dummy hackers' secure and minifying risks of any password storage in a plain form.
Once encoded, the password secured form can be decoded only on the same machine, but the logic behind this is very straightforward.