Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

encryptdecryptwithkey

sumeetghimire9MIT1.0.8

A Node.js package for encrypting and decrypting strings using the AES-128-CTR algorithm with a customizable encryption key

crypt, cryptr, crypter, encrypt, decrypt, encryption, decryption, crypto, cipher, aes-256, aes256, aes-128-ctr, aes-128-gcm, hash, two-way-hash

readme

encryptdecryptwithkey

A Node.js package for encrypting and decrypting strings using the AES-256-GCM algorithm with a customizable encryption key.

Installation

To install encryptdecryptwithkey, use the following command:
npm install encryptdecryptwithkey

Usage

Note: Do not use for encrypting Password

Encryption

const { encryptString } = require('encryptdecryptwithkey');

const originalString = 'Hello, World!';

const encryptedString = encryptString(originalString);

console.log('Original String:', originalString);

console.log('Encrypted String:', encryptedString);

Decryption



const { decryptString } = require('encryptdecryptwithkey');

const encryptedString = 'yourEncryptedStringHere';

const decryptedString = decryptString(encryptedString);

console.log('Encrypted String:', encryptedString);

console.log('Decrypted String:', decryptedString);

Environment Variable

Make sure to set the ENCRYPT_KEY environment variable in your project. If not set, a default key will be used.

export ENCRYPT_KEY=yourSecretKey

If ENCRYPT_KEY is not set, a default key will be used,

Issues

If you encounter any issues or have questions, please open an issue on the GitHub Issues page.

License

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

Acknowledgments

Special thanks to contributors and the open-source community.