npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@davodm/dgcrypt-node

v0.0.4

Published

A simple Nodejs library for encryption and decryption using AES-256-CBC to be usable in different language/devices.

Downloads

7

Readme

Dgcrypt

Dgcrypt is a simple Node.js library for encryption and decryption using various encryption methods, including AES-256-CBC, AES-256-GCM, and ChaCha20-Poly1305. It is designed to securely encrypt data on the backend, which can then be easily decrypted on the client side, such as on Android, iOS, and other platforms. This ensures that the data remains secure during transmission and cannot be easily cracked in between.

Platform Compatibility

The Dgcrypt library is designed to work seamlessly across multiple platforms. You can find corresponding libraries for the following platforms:

These libraries allow you to easily decrypt data that was encrypted on the backend using this PHP library, ensuring secure communication between your backend and client applications.

Supported Encryption Methods

Dgcrypt supports the following encryption methods:

  • AES-256-CBC: Standard encryption method providing confidentiality.
  • AES-256-GCM: Provides both encryption and authentication.
  • ChaCha20-Poly1305: Modern encryption method known for its performance and security.

Installation

You can install the package via npm, available for Node.js v16 and above:

npm install @davodm/dgcrypt-node

Usage

Encrypting Data:

const Dgcrypt = require('@davodm/dgcrypt-node');

const dgcrypt = new Dgcrypt('aes-256-cbc'); // Specify the encryption method
const secretKey = 'your-secret-key';
const data = 'Hello, World!';

const encryptedData = dgcrypt.encrypt(data, secretKey);
console.log('Encrypted Data:', encryptedData);

Decrypting Data:

const Dgcrypt = require('@davodm/dgcrypt-node');

const dgcrypt = new Dgcrypt('aes-256-cbc'); // Specify the encryption method
const secretKey = 'your-secret-key';
const encryptedData = 'your-encrypted-data';

const decryptedData = dgcrypt.setCipherMethod('aes-256-cbc').decrypt(encryptedData, secretKey);
console.log('Decrypted Data:', decryptedData);

Generating a Secure Key

const Dgcrypt = require('@davodm/dgcrypt-node');

const dgcrypt = new Dgcrypt();
const generatedKey = dgcrypt.generateKey();
console.log('Generated Key:', generatedKey); // Display the key in hexadecimal format

Testing

To run the tests, use Jest:

npm test

License

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

Author

Davod Mozafari - Twitter