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

cpay-enc-dec

v1.0.6

Published

cpay encrpt and decrpt text through rsa ssl certificate files or text.

Downloads

2

Readme

CPay encryption and decryption through RSA certificate key files or text.

The following methods for RSA encryption and decryption :

cPayGetEncryptionDataFromKeyFile(input_data, key_filepath, calback);

cPayGetEncryptionDataFromKeyText(input_data, key_txt, calback);

cPayGetDecryptionDataFromKeyFile(input_data, key_filepath, calback);

cPayGetDecryptionDataFromKeyText(input_data, key_txt, calback);

Example Code:

var cpayEncDec = require('cpay-enc-dec');

var json = {
    "name" : "cpay"
}

var enc_rslts: any;

// convert json/string data to rsa encrypted format with public key file
cpayEncDec.cPayGetEncryptionDataFromKeyFile(json, '/certificates/public.key', (encrpt_err, encrpt_res)=>{
    if(encrpt_err){
        console.log(encrpt_res);
        //with error do something
    }
    else{
        console.log(encrpt_res);
        enc_rslts = encrpt_res;
        //with encrypted data do something
    }
})


// convert rsa encrypted data to decrypted json/string data format with private key file
cpayEncDec.cPayGetDecryptionDataFromKeyFile(enc_rslts, '/certificates/private.key', (dcrpt_err, dcrpt_res)=>{
    if(dcrpt_err){
        console.log(dcrpt_res);
        //with error do something
    }
    else{
        console.log(dcrpt_res);
        //with decrypted data do something
    }
})

var public_key_txt = "IgUMIRSetSr2XU+E5lUvYe2y0yEgHjAkb82++B1G/yw6o0YCsnNg8GhQbSHKTHLanJvdLYv5W5kmFCdQCWyFtmc45MeT1MTwkPUav1xhSzEu5UcErONggQLIhDnAjRNuxbo5p4Hvw3R/zOgnNtE";


var pvt_key_txt = "MIIJKAIBAAKCAgEAwnja95l9qwlMgj1yyXVf1AemEx1tY4cLRb6TnbyCedgrVkatjHUCUUJXnlMN2NdiUURWiChmb1IX/2AAVN3GWjjYoaavC2FKt7sa22Cq+KjmrLDMyrSjZKmETpv91j5nHZst7sPhbGXp9oembcl61ix41b/AP0X1gn";


// convert json/string data to rsa encrypted format with public key text
cpayEncDec.cPayGetEncryptionDataFromKeyText(json, public_key_txt, (encrpt_err, encrpt_res)=>{
    if(encrpt_err){
        console.log(encrpt_res);
        //with error do something
    }
    else{
        console.log(encrpt_res);
        enc_rslts = encrpt_res;
        //with encrypted data do something
    }
})


// convert rsa encrypted data to decrypted json/string data format with private key text
cpayEncDec.cPayGetDecryptionDataFromKeyText(enc_rslts, pvt_key_txt, (dcrpt_err, dcrpt_res)=>{
    if(dcrpt_err){
        console.log(dcrpt_res);
        //with error do something
    }
    else{
        console.log(dcrpt_res);
        //with decrypted data do something
    }
})