Skip to content

koltyakov/cpass

Repository files navigation

cpass - simplified secured password two-ways encryption

NPM

npm version Downloads Build Status

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

Usage

JavaScript

const Cpass = require('cpass').Cpass;
const cpass = new Cpass();

const password = 'password';

const secured = cpass.encode(password);
// secured: "40bbb043608f54d....MhKghXTcaR2A//yNXg==" - is unique on different machines

const unsecured = cpass.decode(secured);
// unsecured: 'password'

TypeScript

import { Cpass } from 'cpass';
const cpass = new Cpass();

const password = 'password';

const secured = cpass.encode(password);
// secured: "40bbb043608f54d....MhKghXTcaR2A//yNXg==" - is unique on different machines

const unsecured = cpass.decode(secured);
// unsecured: 'password'

Decoding plain text will return it back:

const plainText = 'plain (not encoded text)';
const decodedText = cpass.decode(plainText);
// decodedText: 'plain (not encoded text)'
// plainText === decodedText

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

# Build an image
docker build -f ./docker/Dockerfile.node8 -t cpass.node8 .
# Run tests
docker run cpass.node8

Comments

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.

About

🔐 Simple secure string password convertor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published