strcrypter

0.0.2 • Public • Published

strcrypter

Encrypt and decrypt strings easily, no dependencies, using crypto.

Installing

npm i strcrypter

USAGE

//random iv
const Crypter = require("strcrypter");
const key = Crypter.createKey();
const secret = "my secret";
let crypter = new Crypter({ key });
const encrypted = crypter.encrypt(secret);
console.log(encrypted);
crypter = new Crypter({ key, iv: encrypted.iv });
const decoded = crypter.decrypt(encrypted.data);
console.log(decoded);
//set iv
const Crypter = require("strcrypter");
const key = Crypter.createKey();
const iv = Crypter.createKey();
const secret = "my secret";
const crypter = new Crypter({ key, iv });
const encrypted = crypter.encrypt(secret);
console.log(encrypted);
const decoded = crypter.decrypt(encrypted.data);
console.log(decoded);

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Readme

Keywords

Package Sidebar

Install

npm i strcrypter

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

3.25 kB

Total Files

4

Last publish

Collaborators

  • niradler55