encryptdecryptwithkey

1.0.8 • Public • Published

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.

Package Sidebar

Install

npm i encryptdecryptwithkey

Weekly Downloads

6

Version

1.0.8

License

MIT

Unpacked Size

6.21 kB

Total Files

5

Last publish

Collaborators

  • sumeetghimire