0.0.9 • Published 5 years ago

@hnw/easyaes v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

EasyAes

Block cipher library for non-serious use

Description

Entering a raw password on the command line, in an environment variable, or in plain text can cause security issues.

In order to prevent the secret leakage from plain text (ex. shoulder hack), we should save encrypted strings in all storage, and decrypt passwords only when a raw password is required.

EasyAes provides easy-to-use encryption/decription functions. This library allows you to use encrypted strings easily in configuration files, environment variables, and command line.

Features

  • Easy-to-use
  • Node.js module which provides {AES, Blowfish, 3DES} {encryption, decryption}
  • A command line tool which provides {encryption, decryption, secret key generator}
  • Force CBC mode
  • Automatically randomize initialization vector

Install

$ npm i @hnw/easyaes

Setup

$ $(npm bin)/easyaes --keygen > $HOME/.easyaes

Example 1

$ echo "foobar" | $(npm bin)/easyaes --encrypt
8EpauI1BBxvo8VzSeA3zsg==
$ echo "8EpauI1BBxvo8VzSeA3zsg==" | $(npm bin)/easyaes --decrypt
foobar

Example 2

const EasyAes=require("@hnw/easyaes");
cipher = new EasyAes();
console.log(cipher.decrypt('8EpauI1BBxvo8VzSeA3zsg==')); // foobar

Example 3

const EasyAes = require("@hnw/easyaes");
const cipher = new EasyAes();
const yargs = require('yargs')
let argv = yargs.argv;
argv = cipher.decrypt(argv);
console.log(argv);
$ node test.js --encrypted=8EpauI1BBxvo8VzSeA3zsg==
{ _: [], encrypted: 'foobar', '$0': 'test.js' }
0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago