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

jsdecrypt

v1.0.4

Published

decrypt JSEncrypt

Downloads

992

Readme

JSDecrypt

Descifra en el lado del servidor las galletas rellenas que te vienen cifradas del lado del cliente con JSEncrypt.

Decrypt on the server side pink unicorns that come from the client side with JSEncrypt

versión Castellano

Generación par de llaves, privada y pública, RSA

openssl genrsa -out privada.key 4096
openssl rsa -pubout -in privada.key -out publica.key

En el lado del cliente y con el uso de JSEncrypt, siendo una implementación de cifrado asimétrico, se ha cifrado una cadena, con la pública, que llega al servidor, y se ha de descifrar con la privada.

npm install jsdecrypt

Copiamos el contenido de la llave privada, como contenido de la variable, "lallaveprivada"

cat privada.key

Y código

var jsdecrypt = require('jsdecrypt');


var lallaveprivada = '-----BEGIN RSA PRIVATE KEY-----\n\
MIICXAIBAAKBgQCenqBKWqSbqJ4mARAQENYs6lM+uiaoNknhv9bnpsmevuBVLnoV\n\
eAdt2ihE3d0nTpB7zOKo1bqTzo27I/G5DUSk3l2KOsEvABtBuZSdZ9TSE96DdP/Z\n\
JJVBOn/rjnBtGTfD/8AYMEsWKh45hTjI/AB3Ia5Kc5+rV3LiEOVdh4cOWwIDAQAB\n\
AoGANUrwaerocVAGypgC0JMHkpGsJGAgytVqn0l4J96W0RoqfxQdeocYX+UzMGgm\n\
fKVdz+p3oOgmRrDYV67s8RKvI/hX41P8HqDNWfIWd/ukpQnBS/omBbeb3Fd5lcML\n\
308lFNAxjUzN84Dkn5uGsvRuIpBX4TXCbVUQtt4hzegL6vkCQQDsg7aTL8/PMbX4\n\
YGHJRi+Kb9Vx+iZfMzT2jtpnOrA9s2ATE1QMOLOsXs4N31589TQWQvW2pB3/4IG+\n\
1+nGstA9AkEAq7ALq/IedORCRW/gBqDzOAhWGZm/3daLU1jvDrS0ZLEMKnPxThYf\n\
9KAaskeQYov9FV3BtE1Orp4VsWRnrNtqdwJBAMcB7NXcHRdR1LOxJZaeH9J0Vz0Y\n\
JsFj7OSpPswtba39CJIEaWv/Ke+XtfmmQXMTP0ib/vQ3E6cB2Sojsukl/GECQD4N\n\
j/pitT1cbtN3/wmGTMIYyT3RgzZj39GNGEJBb93g29vQMgweFQiugVekY/wqSpvZ\n\
WjSXqHOWcZK/DnW8jDsCQH2Xvlz0uU83M6dlaDDo4IxbqBNO1MW9FLWkIPUfy+Wy\n\
mhE8ZQK2DRTd2UeojcXovMSlGL+vzdWeYxorAf9tQcA=\n\
-----END RSA PRIVATE KEY-----';


var elchoricillo = 'bBAaWhOEtEboZc46K9IykrEtMC/idACvCMEuWM696K6exk8N3lrNuQInCbUFd9bBQdkLrmJZMbU9DovasOu6Q7slN3cPVbnl0RTpt7INTboMV6DFsMDi/c2byDgD+7CgrGhJ2MUrBH+WfnTOD6iZb3N3a5GkkQf7b6vpHiVm2es=';


console.log(jsdecrypt.dec(lallaveprivada, elchoricillo));

english version

Generating key pairs

openssl genrsa -out private.key 4096
openssl rsa -pubout -in private.key -out public.key

From the client side and using JSEncrypt, you send a string to the server side

npm install jsdecrypt

Copy the private key, in the "privkey" variable

cat private.key

And code

var jsdecrypt = require('jsdecrypt');


var privkey = '-----BEGIN RSA PRIVATE KEY-----\n\
MIICXAIBAAKBgQCenqBKWqSbqJ4mARAQENYs6lM+uiaoNknhv9bnpsmevuBVLnoV\n\
eAdt2ihE3d0nTpB7zOKo1bqTzo27I/G5DUSk3l2KOsEvABtBuZSdZ9TSE96DdP/Z\n\
JJVBOn/rjnBtGTfD/8AYMEsWKh45hTjI/AB3Ia5Kc5+rV3LiEOVdh4cOWwIDAQAB\n\
AoGANUrwaerocVAGypgC0JMHkpGsJGAgytVqn0l4J96W0RoqfxQdeocYX+UzMGgm\n\
fKVdz+p3oOgmRrDYV67s8RKvI/hX41P8HqDNWfIWd/ukpQnBS/omBbeb3Fd5lcML\n\
308lFNAxjUzN84Dkn5uGsvRuIpBX4TXCbVUQtt4hzegL6vkCQQDsg7aTL8/PMbX4\n\
YGHJRi+Kb9Vx+iZfMzT2jtpnOrA9s2ATE1QMOLOsXs4N31589TQWQvW2pB3/4IG+\n\
1+nGstA9AkEAq7ALq/IedORCRW/gBqDzOAhWGZm/3daLU1jvDrS0ZLEMKnPxThYf\n\
9KAaskeQYov9FV3BtE1Orp4VsWRnrNtqdwJBAMcB7NXcHRdR1LOxJZaeH9J0Vz0Y\n\
JsFj7OSpPswtba39CJIEaWv/Ke+XtfmmQXMTP0ib/vQ3E6cB2Sojsukl/GECQD4N\n\
j/pitT1cbtN3/wmGTMIYyT3RgzZj39GNGEJBb93g29vQMgweFQiugVekY/wqSpvZ\n\
WjSXqHOWcZK/DnW8jDsCQH2Xvlz0uU83M6dlaDDo4IxbqBNO1MW9FLWkIPUfy+Wy\n\
mhE8ZQK2DRTd2UeojcXovMSlGL+vzdWeYxorAf9tQcA=\n\
-----END RSA PRIVATE KEY-----';


var cryptham = 'bBAaWhOEtEboZc46K9IykrEtMC/idACvCMEuWM696K6exk8N3lrNuQInCbUFd9bBQdkLrmJZMbU9DovasOu6Q7slN3cPVbnl0RTpt7INTboMV6DFsMDi/c2byDgD+7CgrGhJ2MUrBH+WfnTOD6iZb3N3a5GkkQf7b6vpHiVm2es=';


console.log(jsdecrypt.dec(privkey, cryptham));

https://www.npmjs.com/package/jsdecrypt

https://github.com/gurumelo/jsdecrypt