top-secret

0.1.1 • Public • Published

top-secret

Encrypt and decrypt strings without exposing your secret key!

top-secret uses AES for encryption and decryption.

Installation

npm install top-secret

Usage

const topSecret = require('top-secret');

let secretKey = 'correct horse battery staple';

// initialize
let secret = topSecret(secretKey);

// clear secret key from environment
secretKey = undefined;

// encrypt plaintext
let ciphertext = secret.encrypt(
  "What's the object-oriented way to become wealthy? ... Inheritance."
);

// decrypt ciphertext
let plaintext = secret.decrypt(ciphertext);

// wipe secret key, and prevent encryption and decryption
secret.wipe();

ciphertext = secret.encrypt('This should fail'); // throws an Error: No secret key. Please initialize another topSecret object.

Readme

Keywords

Package Sidebar

Install

npm i top-secret

Weekly Downloads

0

Version

0.1.1

License

Apache-2.0

Unpacked Size

14.7 kB

Total Files

5

Last publish

Collaborators

  • joshuous