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

encrypt-decrypt-crypto

v1.0.1

Published

Used to encrypt and decrypt credentials on the go!

Downloads

3

Readme

encrypt-decrypt-crypto

The encrypt-decrypt-crypto package can be used to create a secret key, encrypt a plain text password and thereby generate an encrypted password and an IV, decrypt a password to plain text from the encrypted password and IV.

Installation

npm install encrypt-decrypt-crypto

Features

The package supports the below features:

  • Create a base64-encoded encryption key
  • Encrypt a plain text password to an encrypted password and an IV using a Secret key (initialization vector - An initialization vector (IV) is an arbitrary number that can be used with a secret key for data encryption to foil cyber attacks. This number, also called a nonce (number used once), is employed only one time in any session to prevent unauthorized decryption of the message by a suspicious or malicious actor.)
  • Decrypt an encrypted password using the corresponding key and IV.

Usage

  1. Install the package.

  2. To Create a Secret key a. Create a new file to create the secret key b. Import the current package const credentialHelper = require('encrypt-decrypt-crypto'); c. Add a call to create a secret key - mostly used one time or when the secret key needs to be changed const secretKey = await credentialHelper.createSecretKey(); console.log("Secret Key: " + secretKey); d. Run the file to create the Secret key, sample command below node script.js

  3. Encrypt a plain text password a. Create a new file for encryption OR reuse the above file created for secret key b. Import the current package const credentialHelper = require('encrypt-decrypt-crypto'); c. Add a call to encrypt the password - mostly used one time or when the plain text password is changed. The return value is an array where the first value is the Encrypted text and the second value is the IV. const encryptedText = await credentialHelper.encryptText("plainTextPassword", secretKey); console.log("Encrypted Text is: " + encryptedText[0] + ", IV: " + encryptedText[1]); d. Run the file to encrypt the Plain text password, sample command below: node script.js

  4. Decrypted the encrypted password a. Import the current package in the file where the decryption of the password is needed. const credentialHelper = require('encrypt-decrypt-crypto'); b. Add a call to decrypt the password and pass the encrypted text, IV and the secret key. const decryptedText = await credentialHelper.decryptText(encryptedText, IV, secretKey); console.log("Decrypted Plain password: " + decryptedText);

Note: The createSecretKey, encryptText and decryptText are async functions, so please add the calls to these in an async function or an async block. Sample below: (async () => { ---- code here })();